Compare commits
8
Commits
a11dfd8f7e
..
v1.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e482810328 | ||
|
|
86aa0b7539 | ||
|
|
c7bc4421c5 | ||
|
|
a496dc4865 | ||
|
|
677aabfa30 | ||
|
|
8ca8c57793 | ||
|
|
3f391ff584 | ||
|
|
ef453eadd0 |
@@ -17,9 +17,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: https://github.com/actions/setup-node@v4
|
- uses: https://github.com/actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 22
|
||||||
cache: pnpm
|
|
||||||
registry-url: https://dev.pivoine.art/api/packages/valknar/npm/
|
|
||||||
|
|
||||||
- run: pnpm install --frozen-lockfile
|
- run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
@@ -27,12 +25,17 @@ jobs:
|
|||||||
- run: pnpm run typecheck
|
- run: pnpm run typecheck
|
||||||
- run: pnpm run format:check
|
- run: pnpm run format:check
|
||||||
- run: pnpm run test
|
- run: pnpm run test
|
||||||
- run: pnpm run build
|
|
||||||
|
|
||||||
- name: Set package version from the tag
|
- name: Set package version from the tag
|
||||||
run: npm pkg set version="${GITHUB_REF_NAME#v}"
|
run: npm pkg set version="${GITHUB_REF_NAME#v}"
|
||||||
|
|
||||||
|
# Scoped to this one registry host+path (via publishConfig.registry in package.json) rather
|
||||||
|
# than actions/setup-node's registry-url, which would set it as the *default* registry for
|
||||||
|
# every install - breaking `pnpm install` for this project's own (unscoped, public) deps.
|
||||||
|
- name: Configure registry auth for publish
|
||||||
|
run: pnpm config set "//dev.pivoine.art/api/packages/valknar/npm/:_authToken" "$PACKAGE_TOKEN"
|
||||||
|
env:
|
||||||
|
PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
||||||
|
|
||||||
- name: Publish to Gitea npm registry
|
- name: Publish to Gitea npm registry
|
||||||
run: pnpm publish --no-git-checks
|
run: pnpm publish --no-git-checks
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# dependencies
|
# dependencies
|
||||||
/node_modules
|
/node_modules
|
||||||
|
/.pnpm-store
|
||||||
/.pnp
|
/.pnp
|
||||||
.pnp.*
|
.pnp.*
|
||||||
.yarn/*
|
.yarn/*
|
||||||
|
|||||||
@@ -1,2 +1,7 @@
|
|||||||
# Machine-generated - pnpm owns this file's formatting, not prettier.
|
# Machine-generated - pnpm owns this file's formatting, not prettier.
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
|
|
||||||
|
# pnpm's local content-addressable store - on some runners this ends up inside the workspace
|
||||||
|
# instead of the global cache location; its blobs aren't source files (some happen to parse as
|
||||||
|
# JS/TS-like content, which crashes prettier's parser rather than just wasting time on them).
|
||||||
|
.pnpm-store/
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ Type-specific fields:
|
|||||||
| `string` | `text` (or `password` if `secret: true`) | `textarea` (needs `multiline: true`), `password` |
|
| `string` | `text` (or `password` if `secret: true`) | `textarea` (needs `multiline: true`), `password` |
|
||||||
| `number` | `number` | `slider` (requires both `min` and `max`) |
|
| `number` | `number` | `slider` (requires both `min` and `max`) |
|
||||||
| `boolean` | `checkbox` | `switch` |
|
| `boolean` | `checkbox` | `switch` |
|
||||||
| `enum` | `select` | `radio` |
|
| `enum` | `select` | `radio`, `combobox` (searchable, single-select) |
|
||||||
| `multiselect` | `multiselect` (combobox) | `checkboxGroup` |
|
| `multiselect` | `multiselect` (combobox) | `checkboxGroup` |
|
||||||
|
|
||||||
### `passAs` semantics
|
### `passAs` semantics
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Check, ChevronsUpDown } from "lucide-react";
|
||||||
|
import { buttonVariants } from "@/components/ui/button";
|
||||||
|
import {
|
||||||
|
Command,
|
||||||
|
CommandEmpty,
|
||||||
|
CommandGroup,
|
||||||
|
CommandInput,
|
||||||
|
CommandItem,
|
||||||
|
CommandList,
|
||||||
|
} from "@/components/ui/command";
|
||||||
|
import {
|
||||||
|
Popover,
|
||||||
|
PopoverContent,
|
||||||
|
PopoverTrigger,
|
||||||
|
} from "@/components/ui/popover";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
interface ComboboxProps {
|
||||||
|
choices: string[];
|
||||||
|
value: string;
|
||||||
|
onChange: (value: string) => void;
|
||||||
|
placeholder?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Combobox({
|
||||||
|
choices,
|
||||||
|
value,
|
||||||
|
onChange,
|
||||||
|
placeholder = "Select...",
|
||||||
|
}: ComboboxProps) {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Popover open={open} onOpenChange={setOpen}>
|
||||||
|
<PopoverTrigger
|
||||||
|
className={cn(
|
||||||
|
buttonVariants({ variant: "outline" }),
|
||||||
|
"h-auto min-h-8 w-full justify-between font-normal",
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
className={cn("flex-1 text-left", !value && "text-muted-foreground")}
|
||||||
|
>
|
||||||
|
{value || placeholder}
|
||||||
|
</span>
|
||||||
|
<ChevronsUpDown className="text-muted-foreground size-4 shrink-0" />
|
||||||
|
</PopoverTrigger>
|
||||||
|
<PopoverContent className="w-80 p-0">
|
||||||
|
<Command>
|
||||||
|
<CommandInput placeholder="Search..." />
|
||||||
|
<CommandList>
|
||||||
|
<CommandEmpty>No matches.</CommandEmpty>
|
||||||
|
<CommandGroup>
|
||||||
|
{choices.map((choice) => (
|
||||||
|
<CommandItem
|
||||||
|
key={choice}
|
||||||
|
onSelect={() => {
|
||||||
|
onChange(choice);
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
className={cn(
|
||||||
|
"mr-2 size-4",
|
||||||
|
value === choice ? "opacity-100" : "opacity-0",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{choice}
|
||||||
|
</CommandItem>
|
||||||
|
))}
|
||||||
|
</CommandGroup>
|
||||||
|
</CommandList>
|
||||||
|
</Command>
|
||||||
|
</PopoverContent>
|
||||||
|
</Popover>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
import { Slider } from "@/components/ui/slider";
|
import { Slider } from "@/components/ui/slider";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { MultiSelect } from "./controls/multi-select";
|
import { MultiSelect } from "./controls/multi-select";
|
||||||
|
import { Combobox } from "./controls/combobox";
|
||||||
import type { ClientVariable } from "@/lib/config/serialize";
|
import type { ClientVariable } from "@/lib/config/serialize";
|
||||||
|
|
||||||
export function FieldRenderer({ variable }: { variable: ClientVariable }) {
|
export function FieldRenderer({ variable }: { variable: ClientVariable }) {
|
||||||
@@ -211,6 +212,29 @@ export function FieldRenderer({ variable }: { variable: ClientVariable }) {
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
case "combobox":
|
||||||
|
return (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>
|
||||||
|
{label}
|
||||||
|
{variable.required && (
|
||||||
|
<span className="text-destructive"> *</span>
|
||||||
|
)}
|
||||||
|
</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<Combobox
|
||||||
|
choices={variable.type === "enum" ? variable.choices : []}
|
||||||
|
value={field.value ?? ""}
|
||||||
|
onChange={(value) => field.onChange(value)}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
{variable.description && (
|
||||||
|
<FormDescription>{variable.description}</FormDescription>
|
||||||
|
)}
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
);
|
||||||
|
|
||||||
case "radio":
|
case "radio":
|
||||||
return (
|
return (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const controlSchema = z.enum([
|
|||||||
"switch",
|
"switch",
|
||||||
"select",
|
"select",
|
||||||
"radio",
|
"radio",
|
||||||
|
"combobox",
|
||||||
"multiselect",
|
"multiselect",
|
||||||
"checkboxGroup",
|
"checkboxGroup",
|
||||||
]);
|
]);
|
||||||
@@ -115,6 +116,13 @@ const variableWithChecks = variableSchema.superRefine((variable, ctx) => {
|
|||||||
path: ["control"],
|
path: ["control"],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (variable.control === "combobox" && variable.type !== "enum") {
|
||||||
|
ctx.addIssue({
|
||||||
|
code: "custom",
|
||||||
|
message: "control 'combobox' requires type 'enum'",
|
||||||
|
path: ["control"],
|
||||||
|
});
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
variable.control === "slider" &&
|
variable.control === "slider" &&
|
||||||
variable.type === "number" &&
|
variable.type === "number" &&
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export function buildInvocation(
|
|||||||
const argv = [...script.args];
|
const argv = [...script.args];
|
||||||
const env: Record<string, string> = {};
|
const env: Record<string, string> = {};
|
||||||
const redactedArgv = [...script.args];
|
const redactedArgv = [...script.args];
|
||||||
|
const redactedEnvAssignments: string[] = [];
|
||||||
const redactedVariables: Record<string, unknown> = {};
|
const redactedVariables: Record<string, unknown> = {};
|
||||||
|
|
||||||
for (const variable of script.variables) {
|
for (const variable of script.variables) {
|
||||||
@@ -55,6 +56,9 @@ export function buildInvocation(
|
|||||||
case "env": {
|
case "env": {
|
||||||
const value = stringifyValue(raw, variable.joinWith);
|
const value = stringifyValue(raw, variable.joinWith);
|
||||||
env[variable.envName!] = value;
|
env[variable.envName!] = value;
|
||||||
|
redactedEnvAssignments.push(
|
||||||
|
`${variable.envName}=${variable.secret ? REDACTED : value}`,
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "stdin": {
|
case "stdin": {
|
||||||
@@ -74,7 +78,11 @@ export function buildInvocation(
|
|||||||
)
|
)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const redactedCommandLine = [script.command, ...redactedArgv].join(" ");
|
const redactedCommandLine = [
|
||||||
|
...redactedEnvAssignments,
|
||||||
|
script.command,
|
||||||
|
...redactedArgv,
|
||||||
|
].join(" ");
|
||||||
|
|
||||||
return { argv, env, stdin, redactedVariables, redactedCommandLine };
|
return { argv, env, stdin, redactedVariables, redactedCommandLine };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user