@dexhq/canvas 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/README.md +21 -18
- package/app/canvas/activity.tsx +8 -15
- package/app/canvas/anchoring.ts +3 -5
- package/app/canvas/canvas-input.ts +151 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +5 -42
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +7 -3
- package/app/canvas/canvas-ui.ts +2 -1
- package/app/canvas/canvas.css +61 -26
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +204 -82
- package/app/canvas/element-picker.ts +200 -27
- package/app/canvas/engine/canvas-gestures.ts +72 -17
- package/app/canvas/engine/canvas-store.ts +17 -1
- package/app/canvas/engine/engine.css +6 -3
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +18 -2
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-node.tsx +43 -26
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +27 -0
- package/app/canvas/live-page.ts +142 -19
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/section-node.tsx +2 -0
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/tool-cursors.ts +16 -16
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +34 -40
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/xray.ts +3 -12
- package/app/frame.tsx +5 -0
- package/app/i18n/locales/en/messages.po +114 -12
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +114 -12
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/{sets/lucide.tsx → glyphs.tsx} +7 -5
- package/app/icons/index.tsx +3 -3
- package/app/icons/types.ts +3 -10
- package/app/index.html +3 -3
- package/app/main.tsx +3 -0
- package/app/pages/canvas-settings.tsx +35 -0
- package/app/pages/canvas.tsx +27 -8
- package/app/pages/commands-settings.tsx +16 -2
- package/app/shell/about.tsx +5 -4
- package/app/shell/feedback-details.ts +0 -3
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/instructions-editor.tsx +1 -1
- package/app/shell/presence-style.ts +59 -0
- package/app/shell/presence.tsx +6 -3
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/shell/settings-sections.ts +12 -0
- package/app/shell/sidebar.tsx +1 -1
- package/app/studio-ui.d.ts +0 -9
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/prompt-editor.tsx +1 -1
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/dist/cli/banner.d.mts +4 -2
- package/dist/cli/banner.mjs +34 -11
- package/dist/cli/commands/app.mjs +19 -11
- package/dist/cli/commands/create.d.mts +26 -14
- package/dist/cli/commands/create.mjs +13 -7
- package/dist/cli/commands/dev.mjs +2 -3
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/cli/commands/init.d.mts +11 -6
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +3 -3
- package/dist/cli/main.d.mts +22 -12
- package/dist/config/index.d.mts +6 -5
- package/dist/config/project-files.d.mts +6 -3
- package/dist/config/project-files.mjs +14 -5
- package/dist/config/renamed.d.mts +0 -2
- package/dist/config/renamed.mjs +1 -3
- package/dist/config/schema.d.mts +0 -5
- package/dist/config/schema.mjs +0 -5
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/content.d.mts +3 -141
- package/dist/content/content.mjs +7 -65
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/prototype-summary.d.mts +3 -39
- package/dist/content/prototype-summary.mjs +2 -3
- package/dist/content/prototypes.mjs +1 -1
- package/dist/content/snapshot-client.mjs +1 -1
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +309 -0
- package/dist/content/thread-module.mjs +1 -1
- package/dist/content/threads.mjs +1 -1
- package/dist/paths.d.mts +0 -2
- package/dist/paths.mjs +1 -3
- package/dist/server/agent-env.d.mts +5 -1
- package/dist/server/agent-env.mjs +7 -2
- package/dist/server/agent-session.d.mts +14 -1
- package/dist/server/agent-session.mjs +84 -19
- package/dist/server/brief.mjs +3 -3
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/channel.d.mts +19 -24
- package/dist/server/channel.mjs +70 -37
- package/dist/server/claimed-presence.d.mts +18 -0
- package/dist/server/claimed-presence.mjs +58 -0
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/comments/actions.d.mts +153 -0
- package/dist/server/comments/actions.mjs +154 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +88 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +36 -13
- package/dist/server/file-errors.d.mts +7 -2
- package/dist/server/file-errors.mjs +31 -8
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +7 -8
- package/dist/server/me.d.mts +1 -1
- package/dist/server/open-page.d.mts +22 -0
- package/dist/server/open-page.mjs +20 -2
- package/dist/server/outcome.d.mts +22 -0
- package/dist/server/outcome.mjs +8 -0
- package/dist/server/own-copies.mjs +2 -2
- package/dist/server/people.d.mts +1 -1
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +32 -47
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +18 -4
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.mjs +2 -2
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/reading.mjs +13 -4
- package/dist/server/tools/show.d.mts +1 -1
- package/dist/server/tools/snapshot.d.mts +1 -1
- package/dist/server/tools/thread-list.mjs +1 -1
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.mjs +28 -31
- package/dist/server/web-app.mjs +7 -10
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/apply.mjs +8 -14
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +118 -36
- package/dist/setup/design-system-checks.mjs +3 -12
- package/dist/setup/desktop-app-script.mjs +4 -3
- package/dist/setup/desktop-app-start.d.mts +8 -2
- package/dist/setup/desktop-app-start.mjs +64 -29
- package/dist/setup/desktop-app.d.mts +8 -0
- package/dist/setup/desktop-app.mjs +20 -4
- package/dist/setup/detect.d.mts +14 -7
- package/dist/setup/detect.mjs +56 -10
- package/dist/setup/doctor.mjs +2 -4
- package/dist/setup/existing-setup.d.mts +1 -3
- package/dist/setup/existing-setup.mjs +10 -11
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/own-app.d.mts +1 -2
- package/dist/setup/own-app.mjs +4 -5
- package/dist/setup/plan.d.mts +8 -6
- package/dist/setup/plan.mjs +64 -48
- package/dist/setup/project.d.mts +6 -17
- package/dist/setup/project.mjs +17 -61
- package/dist/setup/prompts.d.mts +5 -5
- package/dist/setup/prompts.mjs +28 -61
- package/dist/setup/questions.d.mts +12 -4
- package/dist/setup/questions.mjs +10 -25
- package/dist/setup/starters.d.mts +2 -0
- package/dist/setup/starters.mjs +26 -9
- package/dist/setup/workspace-setup.d.mts +1 -2
- package/dist/setup/workspace-setup.mjs +4 -6
- package/dist/setup/write.d.mts +15 -5
- package/dist/setup/write.mjs +35 -9
- package/dist/shared/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.mjs +1 -1
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +53 -0
- package/dist/shared/comments/routes.mjs +37 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/presence-core.d.mts +11 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +7 -1
- package/dist/shared/signup.d.mts +2 -5
- package/dist/shared/signup.mjs +2 -35
- package/dist/shared/studio-events.d.mts +0 -6
- package/dist/shared/studio-events.mjs +1 -5
- package/dist/shared/studio-files.d.mts +12 -0
- package/dist/shared/studio-files.mjs +6 -1
- package/dist/shared/studio-routes.d.mts +16 -62
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +2 -2
- package/dist/shared/threads-core.mjs +1 -1
- package/extension/dist/feedback.js +148 -138
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +146 -136
- package/package.json +3 -20
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/create.ts +17 -9
- package/src/cli/commands/dev.ts +0 -3
- package/src/cli/commands/hook.ts +4 -1
- package/src/cli/help.ts +3 -3
- package/src/config/index.ts +6 -5
- package/src/config/project-files.ts +21 -11
- package/src/config/renamed.ts +0 -3
- package/src/config/schema.ts +0 -1
- package/src/content/capture.ts +6 -12
- package/src/content/content.ts +7 -244
- package/src/content/flow-specs.ts +2 -1
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/snapshot-client.ts +1 -1
- package/src/content/text-replace.ts +449 -0
- package/src/paths.ts +0 -8
- package/src/server/agent-env.ts +12 -2
- package/src/server/agent-session.ts +124 -34
- package/src/server/brief.ts +8 -3
- package/src/server/channel.ts +121 -52
- package/src/server/claimed-presence.ts +93 -0
- package/src/server/comments/actions.ts +352 -0
- package/src/server/comments/routes.ts +176 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +49 -15
- package/src/server/file-errors.ts +47 -13
- package/src/server/file-lock.ts +205 -54
- package/src/server/mcp.ts +13 -14
- package/src/server/me.ts +2 -5
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +2 -1
- package/src/server/port.ts +94 -20
- package/src/server/presence.ts +11 -3
- package/src/server/requests.ts +60 -70
- package/src/server/studio-for.ts +27 -3
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/watch.ts +7 -7
- package/src/server/vite.ts +37 -40
- package/src/server/web-app.ts +14 -12
- package/src/setup/apply.ts +10 -16
- package/src/setup/create.ts +143 -37
- package/src/setup/design-system-checks.ts +7 -15
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +24 -3
- package/src/setup/detect.ts +56 -14
- package/src/setup/doctor.ts +4 -4
- package/src/setup/existing-setup.ts +10 -12
- package/src/setup/own-app.ts +2 -5
- package/src/setup/plan.ts +93 -84
- package/src/setup/project.ts +25 -118
- package/src/setup/prompts.ts +44 -127
- package/src/setup/questions.ts +27 -29
- package/src/setup/starters.ts +35 -10
- package/src/setup/workspace-setup.ts +8 -18
- package/src/setup/write.ts +52 -9
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +79 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/page-review.ts +11 -16
- package/src/shared/presence-core.ts +16 -2
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +11 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +14 -0
- package/src/shared/studio-routes.ts +21 -64
- package/src/shared/threads-core.ts +2 -2
- package/templates/methods/review.md +2 -2
- package/templates/rules/canvas-frames.md +104 -0
- package/templates/rules/canvas.md +8 -142
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/snapshots.md +52 -0
- package/templates/starters/standalone/README.md +7 -7
- package/templates/starters/standalone/components.json +1 -1
- package/templates/starters/standalone/package.json +1 -2
- package/templates/starters/turborepo/README.md +6 -6
- package/templates/starters/turborepo/apps/web/components.json +1 -1
- package/templates/starters/turborepo/apps/web/package.json +1 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
- package/templates/starters/turborepo/packages/ui/components.json +1 -1
- package/templates/starters/turborepo/packages/ui/package.json +1 -2
- package/templates/starters/vite/README.md +7 -6
- package/templates/starters/vite/components.json +1 -1
- package/templates/starters/vite/package.json +1 -2
- package/templates/starters/vite/src/app.tsx +3 -4
- package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
- package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
- package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
- package/templates/starters/vite/src/components/ui/button.tsx +17 -12
- package/templates/starters/vite/src/components/ui/card.tsx +1 -1
- package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
- package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
- package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
- package/templates/starters/vite/src/components/ui/field.tsx +3 -1
- package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
- package/templates/starters/vite/src/components/ui/input.tsx +1 -1
- package/templates/starters/vite/src/components/ui/label.tsx +2 -0
- package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
- package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
- package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
- package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
- package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
- package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
- package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
- package/templates/starters/vite/src/index.css +533 -111
- package/app/icons/sets/hugeicons.tsx +0 -259
- package/app/icons/sets/phosphor.tsx +0 -251
- package/dist/server/icon-set.d.mts +0 -15
- package/dist/server/icon-set.mjs +0 -31
- package/dist/server/tools/close-reply.d.mts +0 -6
- package/dist/server/tools/close-reply.mjs +0 -138
- package/dist/server/tools/comment.d.mts +0 -6
- package/dist/server/tools/comment.mjs +0 -49
- package/dist/shared/icon-sets.d.mts +0 -9
- package/dist/shared/icon-sets.mjs +0 -21
- package/src/server/icon-set.ts +0 -56
- package/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
- package/src/shared/icon-sets.ts +0 -23
- /package/app/public/{sudio-192.png → dex-192.png} +0 -0
- /package/app/public/{sudio-512.png → dex-512.png} +0 -0
- /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
- /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
- /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
- /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
package/dist/setup/prompts.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isDirectory, isFile } from "../paths.mjs";
|
|
2
2
|
import { STUDIO_FILES } from "../shared/studio-files.mjs";
|
|
3
|
-
import { ICON_SET_NAMES, INTERFACE_ICONS } from "../shared/icon-sets.mjs";
|
|
4
3
|
import { dependenciesOf, packageFolder } from "../config/project-files.mjs";
|
|
5
4
|
import { isPath, providerModule } from "../config/design-system.mjs";
|
|
6
5
|
import { found } from "./findings.mjs";
|
|
@@ -8,8 +7,8 @@ import { isInside } from "./detect/workspace.mjs";
|
|
|
8
7
|
import { counted, designMdFinding, draftFor, folderComponents, fromProject, importDesignMd, isUrl, summaryLine } from "./design-md-setup.mjs";
|
|
9
8
|
import { checkAgents } from "../server/agents.mjs";
|
|
10
9
|
import { installedAgents } from "./detect.mjs";
|
|
11
|
-
import { AGENT_IDS, agentName, componentsAt
|
|
12
|
-
import { IMPORT_FLAG, PROVIDER_FILE, QUESTION, QUESTIONS } from "./questions.mjs";
|
|
10
|
+
import { AGENT_IDS, agentName, componentsAt } from "./project.mjs";
|
|
11
|
+
import { IMPORT_FLAG, PROVIDER_FILE, QUESTION, QUESTIONS, shadcnInitFlags } from "./questions.mjs";
|
|
13
12
|
import { createRequire } from "node:module";
|
|
14
13
|
import { existsSync } from "node:fs";
|
|
15
14
|
import { isAbsolute, resolve, sep } from "node:path";
|
|
@@ -164,9 +163,28 @@ const decidedComponents = (value, source, { warning, open } = {}) => ({
|
|
|
164
163
|
...warning ? { warning } : {},
|
|
165
164
|
...open ? { open } : {}
|
|
166
165
|
});
|
|
166
|
+
/** The component libraries `shadcn init --base` takes. */
|
|
167
|
+
const SHADCN_BASES = [
|
|
168
|
+
"base",
|
|
169
|
+
"radix",
|
|
170
|
+
"aria"
|
|
171
|
+
];
|
|
172
|
+
const PRESET_RE = /^[\w-]+$/;
|
|
173
|
+
/** `--preset` and `--base`, checked: what `shadcn init` is given. */
|
|
174
|
+
function shadcnInit({ preset, base }) {
|
|
175
|
+
if (base !== void 0 && !SHADCN_BASES.includes(base)) throw new Error(`Unknown --base "${base}". Choose ${SHADCN_BASES.join(", ")}.`);
|
|
176
|
+
if (preset !== void 0 && !PRESET_RE.test(preset)) throw new Error(`--preset takes a preset's name (nova) or its code from https://ui.shadcn.com/create (b2fA), not "${preset}".`);
|
|
177
|
+
return {
|
|
178
|
+
...preset ? { preset } : {},
|
|
179
|
+
...base ? { base } : {}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
167
182
|
/** The components, from a flag, a question or what was found. */
|
|
168
183
|
async function decideComponents(findings, flags, ui, ask) {
|
|
169
|
-
if (flags.shadcn) return decidedComponents({
|
|
184
|
+
if (flags.shadcn || flags.preset || flags.base) return decidedComponents({
|
|
185
|
+
kind: "shadcn",
|
|
186
|
+
...shadcnInit(flags)
|
|
187
|
+
}, flags.shadcn ? "--shadcn" : shadcnInitFlags(shadcnInit(flags)).join(" "));
|
|
170
188
|
if (flags.components === "none") return decidedComponents({ kind: "none" }, "--components none");
|
|
171
189
|
const { root } = findings;
|
|
172
190
|
if (flags.components) {
|
|
@@ -360,9 +378,8 @@ async function decideStyles(findings, components, flags, ui, ask) {
|
|
|
360
378
|
} : {}
|
|
361
379
|
};
|
|
362
380
|
}
|
|
363
|
-
|
|
381
|
+
function decidePrimitives(components, flags) {
|
|
364
382
|
const choice = components.kind === "folder" ? components.choice : void 0;
|
|
365
|
-
const fits = Boolean(choice?.baseUi && choice.import);
|
|
366
383
|
const decided = (value, source, warning) => ({
|
|
367
384
|
key: "primitives",
|
|
368
385
|
value,
|
|
@@ -371,56 +388,9 @@ async function decidePrimitives(findings, components, flags, ui, ask) {
|
|
|
371
388
|
shown: value ? `yes, from ${choice?.import}` : "no, the studio's own",
|
|
372
389
|
...warning ? { warning } : {}
|
|
373
390
|
});
|
|
374
|
-
if (flags.primitives
|
|
375
|
-
if (
|
|
376
|
-
|
|
377
|
-
return decided(true, "--primitives");
|
|
378
|
-
}
|
|
379
|
-
if (!fits) return decided(false, findings.primitives.evidence);
|
|
380
|
-
if (!ask) return decided(true, `${findings.primitives.evidence}, so they fit`);
|
|
381
|
-
return decided(answered(await ui.confirm([
|
|
382
|
-
`Build the studio's own buttons, menus and dialogs from ${choice?.import}?`,
|
|
383
|
-
" Your components use shadcn's Base UI API, so they fit.",
|
|
384
|
-
` (${QUESTION.primitives.flag})`
|
|
385
|
-
].join("\n"))), ANSWERED);
|
|
386
|
-
}
|
|
387
|
-
function iconSet(flag) {
|
|
388
|
-
const set = INTERFACE_ICONS.find((each) => each === flag.trim());
|
|
389
|
-
if (!set) throw new Error(`Unknown icon set "${flag}". Choose ${INTERFACE_ICONS.join(", ")}.`);
|
|
390
|
-
return set;
|
|
391
|
-
}
|
|
392
|
-
/** Components chosen instead of those found bring their own. */
|
|
393
|
-
async function decideIcons(findings, components, flags, ui, ask) {
|
|
394
|
-
const decided = (value, source) => ({
|
|
395
|
-
key: "icons",
|
|
396
|
-
value,
|
|
397
|
-
source,
|
|
398
|
-
flag: QUESTION.icons.flag,
|
|
399
|
-
shown: ICON_SET_NAMES[value]
|
|
400
|
-
});
|
|
401
|
-
if (flags.icons !== void 0) return decided(iconSet(flags.icons), "--icons");
|
|
402
|
-
const choice = components.kind === "folder" ? components.choice : void 0;
|
|
403
|
-
const finding = choice && choice.dir !== findings.components.value?.dir ? iconsFinding(findings.root, choice, "its components.json") : findings.icons;
|
|
404
|
-
if (!ask) {
|
|
405
|
-
const others = finding.alternatives.map((set) => ICON_SET_NAMES[set]);
|
|
406
|
-
return finding.confidence === "guess" ? {
|
|
407
|
-
...decided(finding.value, finding.evidence),
|
|
408
|
-
warning: `${ICON_SET_NAMES[finding.value]}, though ${others.join(" and ")} ${others.length === 1 ? "is" : "are"} installed too: check it, or choose with --icons`,
|
|
409
|
-
open: {
|
|
410
|
-
candidates: [finding.value, ...finding.alternatives].map((set) => ({ value: set })),
|
|
411
|
-
safe: true
|
|
412
|
-
}
|
|
413
|
-
} : decided(finding.value, finding.evidence);
|
|
414
|
-
}
|
|
415
|
-
const answer = answered(await ui.choose([
|
|
416
|
-
"Icon set: what Dex's interface draws its icons with",
|
|
417
|
-
` ${ICON_SET_NAMES[finding.value]} (${finding.evidence})`,
|
|
418
|
-
` (${QUESTION.icons.flag})`
|
|
419
|
-
].join("\n"), [finding.value, ...INTERFACE_ICONS.filter((set) => set !== finding.value)].map((set) => ({
|
|
420
|
-
value: set,
|
|
421
|
-
label: ICON_SET_NAMES[set]
|
|
422
|
-
}))));
|
|
423
|
-
return decided(answer, answer === finding.value ? finding.evidence : ANSWERED);
|
|
391
|
+
if (flags.primitives !== true) return decided(false, "Dex's own, unless --primitives");
|
|
392
|
+
if (!choice?.import) return decided(false, "--primitives", "--primitives needs components with an import path, so the studio keeps its own");
|
|
393
|
+
return decided(true, "--primitives");
|
|
424
394
|
}
|
|
425
395
|
const providerShown = (decision) => {
|
|
426
396
|
if (decision.kind === "write") return `${PROVIDER_FILE}, ${decision.need.component} (written)`;
|
|
@@ -753,11 +723,9 @@ async function decide(findings, flags, ui, { ask }) {
|
|
|
753
723
|
const dir = decideDir(flags);
|
|
754
724
|
const packageManager = decidePackageManager(findings, flags);
|
|
755
725
|
if (flags.agent !== void 0) parseAgents(flags.agent);
|
|
756
|
-
if (flags.icons !== void 0) iconSet(flags.icons);
|
|
757
726
|
const components = await decideComponents(findings, flags, ui, ask);
|
|
758
727
|
const styles = await decideStyles(findings, components.value, flags, ui, ask);
|
|
759
|
-
const primitives =
|
|
760
|
-
const icons = await decideIcons(findings, components.value, flags, ui, ask);
|
|
728
|
+
const primitives = decidePrimitives(components.value, flags);
|
|
761
729
|
const designMd = await decideDesignMd(findings, {
|
|
762
730
|
components: components.value,
|
|
763
731
|
dir: dir.value,
|
|
@@ -771,7 +739,6 @@ async function decide(findings, flags, ui, { ask }) {
|
|
|
771
739
|
components,
|
|
772
740
|
styles,
|
|
773
741
|
primitives,
|
|
774
|
-
icons,
|
|
775
742
|
...provider ? { provider } : {},
|
|
776
743
|
designMd,
|
|
777
744
|
agents
|
|
@@ -783,4 +750,4 @@ const decisionList = (decisions) => QUESTIONS.flatMap((question) => {
|
|
|
783
750
|
return decided ? [decided] : [];
|
|
784
751
|
});
|
|
785
752
|
//#endregion
|
|
786
|
-
export { Cancelled, NO_STYLES, NeedsChoice, decide, decisionList, describeComponents,
|
|
753
|
+
export { Cancelled, NO_STYLES, NeedsChoice, decide, decisionList, describeComponents, packageManagerName, parseAgents, repositoryRoot, showComponents, showDesignMd, studioDir };
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import { InterfaceIcons } from "../shared/icon-sets.mjs";
|
|
2
1
|
import { DesignMdDecision } from "./design-md-setup.mjs";
|
|
3
2
|
import { AgentId } from "./detect.mjs";
|
|
4
3
|
import { Placement } from "./detect/workspace.mjs";
|
|
5
4
|
import { ProviderNeed } from "./provider.mjs";
|
|
6
5
|
import { ComponentsChoice, PackageManagerChoice } from "./project.mjs";
|
|
7
6
|
//#region src/setup/questions.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* How `shadcn init` sets the project up, as its own flags say it: a preset
|
|
9
|
+
* (a name, or a code from ui.shadcn.com/create) and the component library.
|
|
10
|
+
*/
|
|
11
|
+
export interface ShadcnInit {
|
|
12
|
+
base?: string;
|
|
13
|
+
preset?: string;
|
|
14
|
+
}
|
|
8
15
|
/** What to build prototypes with. */
|
|
9
16
|
export type ComponentsDecision = {
|
|
10
17
|
kind: "folder";
|
|
11
18
|
choice: ComponentsChoice;
|
|
12
|
-
} | {
|
|
19
|
+
} | ({
|
|
13
20
|
kind: "shadcn";
|
|
14
|
-
} | {
|
|
21
|
+
} & ShadcnInit) | {
|
|
15
22
|
kind: "none";
|
|
16
23
|
};
|
|
24
|
+
/** `--preset` and `--base` as setup passes them on to `shadcn init`. */
|
|
25
|
+
export declare const shadcnInitFlags: ({ preset, base }: ShadcnInit) => string[];
|
|
17
26
|
/**
|
|
18
27
|
* What wraps every prototype view (`designSystem.provider`): a module of the
|
|
19
28
|
* project's (a path from where setup looked, or a package's module), the
|
|
@@ -63,7 +72,6 @@ export interface SetupDecisions {
|
|
|
63
72
|
components: Decided<ComponentsDecision>;
|
|
64
73
|
designMd: Decided<DesignMdDecision>;
|
|
65
74
|
dir: Decided<string>;
|
|
66
|
-
icons: Decided<InterfaceIcons>;
|
|
67
75
|
packageManager: Decided<PackageManagerChoice>;
|
|
68
76
|
primitives: Decided<boolean>;
|
|
69
77
|
/**
|
package/dist/setup/questions.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { posix as posix$1 } from "../paths.mjs";
|
|
2
|
-
import { ICON_SET_NAMES } from "../shared/icon-sets.mjs";
|
|
3
2
|
import { fromProject } from "./design-md-setup.mjs";
|
|
4
3
|
import { relative } from "node:path";
|
|
5
4
|
//#region src/setup/questions.ts
|
|
5
|
+
/** `--preset` and `--base` as setup passes them on to `shadcn init`. */
|
|
6
|
+
const shadcnInitFlags = ({ preset, base }) => [...preset ? ["--preset", preset] : [], ...base ? ["--base", base] : []];
|
|
6
7
|
/** The file setup writes the provider to, in the studio's folder. */
|
|
7
8
|
const PROVIDER_FILE = "provider.tsx";
|
|
8
9
|
/** How prototypes import a components folder, when it cannot be derived. */
|
|
@@ -90,7 +91,11 @@ const QUESTION = {
|
|
|
90
91
|
import: decision.choice.barrel ?? decision.choice.import
|
|
91
92
|
} : decision.kind,
|
|
92
93
|
asFlags: (decision, { cwd }) => {
|
|
93
|
-
if (decision.kind === "shadcn") return [
|
|
94
|
+
if (decision.kind === "shadcn") return [
|
|
95
|
+
"--shadcn",
|
|
96
|
+
...decision.preset ? [`--preset ${decision.preset}`] : [],
|
|
97
|
+
...decision.base ? [`--base ${decision.base}`] : []
|
|
98
|
+
];
|
|
94
99
|
if (decision.kind === "none") return ["--components none"];
|
|
95
100
|
const { barrel, dir, import: specifier } = decision.choice;
|
|
96
101
|
return [`--components ${fromCwd(dir, cwd)}`, ...specifier && !barrel ? [`--import ${specifier}`] : []];
|
|
@@ -113,28 +118,9 @@ const QUESTION = {
|
|
|
113
118
|
primitives: {
|
|
114
119
|
key: "primitives",
|
|
115
120
|
label: "Primitives",
|
|
116
|
-
flag: "--primitives
|
|
121
|
+
flag: "--primitives",
|
|
117
122
|
asJson: (primitives) => primitives,
|
|
118
|
-
asFlags: (primitives, { components }) =>
|
|
119
|
-
if (components.kind !== "folder") return [];
|
|
120
|
-
const { baseUi, import: specifier } = components.choice;
|
|
121
|
-
if (primitives) return specifier ? ["--primitives"] : [];
|
|
122
|
-
return baseUi ? ["--no-primitives"] : [];
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
icons: {
|
|
126
|
-
key: "icons",
|
|
127
|
-
label: "Icon set",
|
|
128
|
-
flag: "--icons lucide|phosphor|hugeicons",
|
|
129
|
-
asked: {
|
|
130
|
-
question: "Which icon set should Dex's interface draw with?",
|
|
131
|
-
choice: (icons) => ({
|
|
132
|
-
value: icons,
|
|
133
|
-
label: ICON_SET_NAMES[icons]
|
|
134
|
-
})
|
|
135
|
-
},
|
|
136
|
-
asJson: (icons) => icons,
|
|
137
|
-
asFlags: (icons) => [`--icons ${icons}`]
|
|
123
|
+
asFlags: (primitives, { components }) => primitives && components.kind === "folder" && components.choice.import ? ["--primitives"] : []
|
|
138
124
|
},
|
|
139
125
|
provider: {
|
|
140
126
|
key: "provider",
|
|
@@ -192,7 +178,6 @@ const QUESTIONS = [
|
|
|
192
178
|
QUESTION.components,
|
|
193
179
|
QUESTION.styles,
|
|
194
180
|
QUESTION.primitives,
|
|
195
|
-
QUESTION.icons,
|
|
196
181
|
QUESTION.provider,
|
|
197
182
|
QUESTION.designMd,
|
|
198
183
|
QUESTION.agents,
|
|
@@ -229,4 +214,4 @@ function questionEvent(question, decided, context) {
|
|
|
229
214
|
};
|
|
230
215
|
}
|
|
231
216
|
//#endregion
|
|
232
|
-
export { IMPORT_FLAG, PROVIDER_FILE, QUESTION, QUESTIONS, questionEvent, questionFor };
|
|
217
|
+
export { IMPORT_FLAG, PROVIDER_FILE, QUESTION, QUESTIONS, questionEvent, questionFor, shadcnInitFlags };
|
|
@@ -60,6 +60,8 @@ export interface StarterValues {
|
|
|
60
60
|
pmVersion?: string;
|
|
61
61
|
title: string;
|
|
62
62
|
}
|
|
63
|
+
/** What a starter writes at the project's root: "package.json", "src". */
|
|
64
|
+
export declare function starterRootNames(starter: Starter): Promise<string[]>;
|
|
63
65
|
/**
|
|
64
66
|
* Copy `starter` into `root`, which is empty: its own files, then the files
|
|
65
67
|
* it shares with another, with the name, title and package manager filled in.
|
package/dist/setup/starters.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TEMPLATES_DIR } from "../paths.mjs";
|
|
2
2
|
import { USER_AGENT_RE } from "./project.mjs";
|
|
3
|
+
import { withEsbuildBuilds } from "./write.mjs";
|
|
3
4
|
import { packageManagerName } from "./prompts.mjs";
|
|
4
5
|
import { dirname, join } from "node:path";
|
|
5
6
|
import { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
|
|
@@ -22,8 +23,8 @@ const STARTERS = {
|
|
|
22
23
|
workspace: false,
|
|
23
24
|
shared: [],
|
|
24
25
|
next: [{
|
|
25
|
-
script: "
|
|
26
|
-
what: "
|
|
26
|
+
script: "dex",
|
|
27
|
+
what: "Dex, with a first file"
|
|
27
28
|
}, {
|
|
28
29
|
script: "dev",
|
|
29
30
|
what: "your app"
|
|
@@ -51,8 +52,8 @@ const STARTERS = {
|
|
|
51
52
|
}
|
|
52
53
|
],
|
|
53
54
|
next: [{
|
|
54
|
-
script: "
|
|
55
|
-
what: "
|
|
55
|
+
script: "dex",
|
|
56
|
+
what: "Dex, with a first file"
|
|
56
57
|
}]
|
|
57
58
|
},
|
|
58
59
|
turborepo: {
|
|
@@ -78,11 +79,11 @@ const STARTERS = {
|
|
|
78
79
|
}
|
|
79
80
|
],
|
|
80
81
|
next: [{
|
|
81
|
-
script: "
|
|
82
|
-
what: "
|
|
82
|
+
script: "dex",
|
|
83
|
+
what: "Dex, with a first file"
|
|
83
84
|
}, {
|
|
84
85
|
script: "dev",
|
|
85
|
-
what: "every app: apps/web and
|
|
86
|
+
what: "every app: apps/web and Dex"
|
|
86
87
|
}]
|
|
87
88
|
}
|
|
88
89
|
};
|
|
@@ -122,6 +123,12 @@ async function packageManagerVersion(pm, exec, cwd) {
|
|
|
122
123
|
return version;
|
|
123
124
|
}
|
|
124
125
|
const RENAMED = { gitignore: ".gitignore" };
|
|
126
|
+
/** What a starter writes at the project's root: "package.json", "src". */
|
|
127
|
+
async function starterRootNames(starter) {
|
|
128
|
+
const own = await readdir(join(STARTERS_DIR, starter.name));
|
|
129
|
+
const shared = starter.shared.map(({ to }) => to.split("/")[0] ?? to);
|
|
130
|
+
return [.../* @__PURE__ */ new Set([...own.map((name) => RENAMED[name] ?? name), ...shared])];
|
|
131
|
+
}
|
|
125
132
|
/** Copy a file or a folder, filling in the values and making the changes. */
|
|
126
133
|
async function copyTree(from, to, fill) {
|
|
127
134
|
if (!(await stat(from)).isDirectory()) {
|
|
@@ -146,7 +153,16 @@ async function fitPackageManager(root, values) {
|
|
|
146
153
|
if (values.pmVersion) manifest.packageManager = `${values.pm}@${values.pmVersion}`;
|
|
147
154
|
if (values.pm === "pnpm") manifest.workspaces = void 0;
|
|
148
155
|
await writeFile(file, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
149
|
-
if (values.pm === "pnpm"
|
|
156
|
+
if (values.pm === "pnpm") await writePnpmWorkspace(root, workspaces);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* pnpm's settings file: the workspaces, in a workspace, and what to do with
|
|
160
|
+
* esbuild's install script. Vite brings esbuild, and pnpm 11 stops the
|
|
161
|
+
* install on a script nobody decided on (write.ts, withEsbuildBuilds).
|
|
162
|
+
*/
|
|
163
|
+
async function writePnpmWorkspace(root, workspaces) {
|
|
164
|
+
const packages = Array.isArray(workspaces) ? `packages:\n${workspaces.map((glob) => ` - "${glob}"`).join("\n")}\n` : "";
|
|
165
|
+
await writeFile(join(root, "pnpm-workspace.yaml"), withEsbuildBuilds(packages) ?? packages);
|
|
150
166
|
}
|
|
151
167
|
/**
|
|
152
168
|
* Copy `starter` into `root`, which is empty: its own files, then the files
|
|
@@ -161,6 +177,7 @@ async function copyStarter(starter, root, values) {
|
|
|
161
177
|
await copyTree(join(STARTERS_DIR, shared.from), join(root, shared.to), (text) => replace.reduce((changed, [from, to]) => changed.replaceAll(from, to), fill(text)));
|
|
162
178
|
}
|
|
163
179
|
if (starter.workspace) await fitPackageManager(root, values);
|
|
180
|
+
else if (values.pm === "pnpm") await writePnpmWorkspace(root, void 0);
|
|
164
181
|
}
|
|
165
182
|
//#endregion
|
|
166
|
-
export { DEFAULT_STARTER, STARTERS, STARTERS_DIR, STARTER_NAMES, TEMPLATE_FLAG, copyStarter, packageManagerVersion, starterNamed, starterPackageManager };
|
|
183
|
+
export { DEFAULT_STARTER, STARTERS, STARTERS_DIR, STARTER_NAMES, TEMPLATE_FLAG, copyStarter, packageManagerVersion, starterNamed, starterPackageManager, starterRootNames };
|
|
@@ -25,10 +25,9 @@ export declare function findingsFor(workspace: Workspace, placement: Placement,
|
|
|
25
25
|
userAgent?: string;
|
|
26
26
|
}): Promise<ProjectFindings>;
|
|
27
27
|
/** What the plan adds for a workspace, once the decisions are made. */
|
|
28
|
-
export declare function workspaceSetup(workspace: Workspace, placement: Placement, findings: ProjectFindings, decisions: SetupDecisions, { flags, cwd
|
|
28
|
+
export declare function workspaceSetup(workspace: Workspace, placement: Placement, findings: ProjectFindings, decisions: SetupDecisions, { flags, cwd }: {
|
|
29
29
|
flags: SetupFlags;
|
|
30
30
|
cwd: string;
|
|
31
|
-
iconPackages: Record<string, string>;
|
|
32
31
|
}): WorkspaceSetup;
|
|
33
32
|
/**
|
|
34
33
|
* What to look at before going ahead: a shared package's components that
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PACKAGE_NAME, posix as posix$1, studioVersion } from "../paths.mjs";
|
|
2
2
|
import { findWorkspace } from "./detect/workspace.mjs";
|
|
3
3
|
import { designMdFinding } from "./design-md-setup.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { findProject, iconsFinding } from "./project.mjs";
|
|
4
|
+
import { findProject } from "./project.mjs";
|
|
6
5
|
import { designSystemPackage, internalAliases, ownAppFacts, rootStudioScript } from "./own-app.mjs";
|
|
6
|
+
import { installCommand } from "./plan.mjs";
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
9
9
|
//#region src/setup/workspace-setup.ts
|
|
@@ -74,7 +74,6 @@ async function findingsFor(workspace, placement, options = {}) {
|
|
|
74
74
|
evidence: `${library.folder} is a shared package`,
|
|
75
75
|
alternatives: candidates.filter((choice) => choice !== shared)
|
|
76
76
|
},
|
|
77
|
-
icons: shared === value ? findings.icons : iconsFinding(findings.root, shared, `${library.folder}'s components.json`),
|
|
78
77
|
designSystem: {
|
|
79
78
|
...findings.designSystem,
|
|
80
79
|
name: library.name
|
|
@@ -120,7 +119,7 @@ function studioSpecFor(findings, placement, flags, { cwd, manager }) {
|
|
|
120
119
|
return versionSpec();
|
|
121
120
|
}
|
|
122
121
|
/** What the plan adds for a workspace, once the decisions are made. */
|
|
123
|
-
function workspaceSetup(workspace, placement, findings, decisions, { flags, cwd
|
|
122
|
+
function workspaceSetup(workspace, placement, findings, decisions, { flags, cwd }) {
|
|
124
123
|
const manager = decisions.packageManager.value;
|
|
125
124
|
const studioSpec = studioSpecFor(findings, placement, flags, {
|
|
126
125
|
cwd,
|
|
@@ -130,10 +129,9 @@ function workspaceSetup(workspace, placement, findings, decisions, { flags, cwd,
|
|
|
130
129
|
return {
|
|
131
130
|
app: placement.kind === "own-app" ? ownAppFacts(workspace, placement, {
|
|
132
131
|
componentsDir: components.kind === "folder" ? components.choice.dir : void 0,
|
|
133
|
-
iconPackages,
|
|
134
132
|
studioSpec: studioSpec ?? versionSpec()
|
|
135
133
|
}) : void 0,
|
|
136
|
-
install:
|
|
134
|
+
install: installCommand(manager.agent),
|
|
137
135
|
rootScripts: recordAt(readManifest(workspace.root), "scripts"),
|
|
138
136
|
studioScript: rootStudioScript(workspace, manager, placement),
|
|
139
137
|
studioSpec
|
package/dist/setup/write.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StylingApproach } from "../shared/design-system.mjs";
|
|
2
|
-
import { DesignSystemConfig
|
|
2
|
+
import { DesignSystemConfig } from "../config/index.mjs";
|
|
3
3
|
//#region src/setup/write.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The sentence in the pointer setup adds to the root's AGENTS.md or
|
|
@@ -42,13 +42,11 @@ export declare function designSystemConfig(facts: DesignSystemFacts, root: strin
|
|
|
42
42
|
/**
|
|
43
43
|
* dex.config.ts for a new studio: the choices made, and nothing the
|
|
44
44
|
* project's files or the defaults say. `studio` is "studio", or "." for an
|
|
45
|
-
* app of its own.
|
|
46
|
-
* choice the team made, and what the install brought in.
|
|
45
|
+
* app of its own.
|
|
47
46
|
*/
|
|
48
|
-
export declare function configSource(designSystem: DesignSystemConfig | undefined, { studio, primitives,
|
|
47
|
+
export declare function configSource(designSystem: DesignSystemConfig | undefined, { studio, primitives, next }: {
|
|
49
48
|
studio: string;
|
|
50
49
|
primitives: boolean;
|
|
51
|
-
icons: NonNullable<StudioInterface["icons"]>;
|
|
52
50
|
next?: boolean;
|
|
53
51
|
}): string;
|
|
54
52
|
/**
|
|
@@ -105,6 +103,18 @@ export declare const ignoreFile: (studio: string, { hasOwn }: {
|
|
|
105
103
|
export declare const missingIgnoreLines: (gitignore: string, wanted: string[]) => string[];
|
|
106
104
|
/** The .gitignore with the studio's lines added under a heading. */
|
|
107
105
|
export declare const withIgnoreLines: (gitignore: string, missing: string[]) => string;
|
|
106
|
+
/**
|
|
107
|
+
* Whether pnpm-workspace.yaml settles esbuild's install script already:
|
|
108
|
+
* names it in any list or map (allowBuilds, onlyBuiltDependencies...), or
|
|
109
|
+
* allows every script.
|
|
110
|
+
*/
|
|
111
|
+
export declare const pnpmDecidesEsbuild: (yaml: string) => boolean;
|
|
112
|
+
/**
|
|
113
|
+
* pnpm-workspace.yaml with `esbuild: false` under `allowBuilds`, keeping
|
|
114
|
+
* everything else; undefined when its `allowBuilds` is written some way
|
|
115
|
+
* this can't add to (`allowBuilds: {}`).
|
|
116
|
+
*/
|
|
117
|
+
export declare function withEsbuildBuilds(yaml: string): string | undefined;
|
|
108
118
|
/**
|
|
109
119
|
* The pointer setup adds to the root's AGENTS.md or CLAUDE.md, so an agent
|
|
110
120
|
* started at the root reads the studio's brief before studio work.
|
package/dist/setup/write.mjs
CHANGED
|
@@ -51,10 +51,9 @@ function designSystemConfig(facts, root) {
|
|
|
51
51
|
/**
|
|
52
52
|
* dex.config.ts for a new studio: the choices made, and nothing the
|
|
53
53
|
* project's files or the defaults say. `studio` is "studio", or "." for an
|
|
54
|
-
* app of its own.
|
|
55
|
-
* choice the team made, and what the install brought in.
|
|
54
|
+
* app of its own.
|
|
56
55
|
*/
|
|
57
|
-
function configSource(designSystem, { studio, primitives,
|
|
56
|
+
function configSource(designSystem, { studio, primitives, next }) {
|
|
58
57
|
const content = studio === "." ? "" : `\n content: "./${studio}",\n`;
|
|
59
58
|
const base = `import { defineConfig } from "${PACKAGE_NAME}/config";
|
|
60
59
|
|
|
@@ -70,10 +69,7 @@ export default defineConfig({${content}});
|
|
|
70
69
|
designSystem,
|
|
71
70
|
plugins: next ? [{ code: "next()" }] : void 0
|
|
72
71
|
},
|
|
73
|
-
ui: {
|
|
74
|
-
icons,
|
|
75
|
-
...primitives ? { primitives: true } : {}
|
|
76
|
-
}
|
|
72
|
+
...primitives ? { ui: { primitives: true } } : {}
|
|
77
73
|
});
|
|
78
74
|
}
|
|
79
75
|
/** What views need that a project's own tsconfig doesn't give them. */
|
|
@@ -153,9 +149,10 @@ const fromStudio = (content, file) => {
|
|
|
153
149
|
* The script setup adds to package.json, when the name is free: one, so
|
|
154
150
|
* the project's own file changes by a dependency and a line.
|
|
155
151
|
*/
|
|
156
|
-
const STUDIO_SCRIPTS = {
|
|
152
|
+
const STUDIO_SCRIPTS = { dex: "dex dev" };
|
|
157
153
|
/** A later setup leaves these, as anything of the project's own: as Dex wrote them, or Sudio. */
|
|
158
154
|
const OLD_SCRIPTS = {
|
|
155
|
+
studio: ["dex dev", "sudio dev"],
|
|
159
156
|
"studio:build": ["dex build", "sudio build"],
|
|
160
157
|
"studio:claude": ["dex claude", "sudio claude"]
|
|
161
158
|
};
|
|
@@ -185,6 +182,35 @@ const missingIgnoreLines = (gitignore, wanted) => {
|
|
|
185
182
|
};
|
|
186
183
|
/** The .gitignore with the studio's lines added under a heading. */
|
|
187
184
|
const withIgnoreLines = (gitignore, missing) => missing.length === 0 ? gitignore : `${gitignore.trimEnd() ? `${gitignore.trimEnd()}\n\n` : ""}# Dex\n${missing.join("\n")}\n`;
|
|
185
|
+
const ESBUILD_DECIDED_RE = /^\s*-?\s*["']?esbuild["']?\s*(:|$)/m;
|
|
186
|
+
const ALL_BUILDS_RE = /^(dangerouslyAllowAllBuilds:\s*true|strictDepBuilds:\s*false)\s*$/m;
|
|
187
|
+
const ALLOW_BUILDS_RE = /^allowBuilds:[ \t]*\n((?:[ \t]+.*\n?)*)/m;
|
|
188
|
+
const ALLOW_BUILDS_KEY_RE = /^allowBuilds:/m;
|
|
189
|
+
const INDENT_RE = /^([ \t]+)\S/;
|
|
190
|
+
/**
|
|
191
|
+
* Whether pnpm-workspace.yaml settles esbuild's install script already:
|
|
192
|
+
* names it in any list or map (allowBuilds, onlyBuiltDependencies...), or
|
|
193
|
+
* allows every script.
|
|
194
|
+
*/
|
|
195
|
+
const pnpmDecidesEsbuild = (yaml) => ESBUILD_DECIDED_RE.test(yaml) || ALL_BUILDS_RE.test(yaml);
|
|
196
|
+
/**
|
|
197
|
+
* pnpm-workspace.yaml with `esbuild: false` under `allowBuilds`, keeping
|
|
198
|
+
* everything else; undefined when its `allowBuilds` is written some way
|
|
199
|
+
* this can't add to (`allowBuilds: {}`).
|
|
200
|
+
*/
|
|
201
|
+
function withEsbuildBuilds(yaml) {
|
|
202
|
+
const block = ALLOW_BUILDS_RE.exec(yaml);
|
|
203
|
+
if (block) {
|
|
204
|
+
const indent = INDENT_RE.exec(block[1] ?? "")?.[1] ?? " ";
|
|
205
|
+
const end = block.index + block[0].length;
|
|
206
|
+
const before = yaml.slice(0, end);
|
|
207
|
+
const line = `${indent}esbuild: false\n`;
|
|
208
|
+
return `${before}${before.endsWith("\n") ? "" : "\n"}${line}${yaml.slice(end)}`;
|
|
209
|
+
}
|
|
210
|
+
if (ALLOW_BUILDS_KEY_RE.test(yaml)) return;
|
|
211
|
+
const kept = yaml.trimEnd();
|
|
212
|
+
return `${kept ? `${kept}\n` : ""}allowBuilds:\n esbuild: false\n`;
|
|
213
|
+
}
|
|
188
214
|
/**
|
|
189
215
|
* The pointer setup adds to the root's AGENTS.md or CLAUDE.md, so an agent
|
|
190
216
|
* started at the root reads the studio's brief before studio work.
|
|
@@ -202,4 +228,4 @@ const withPointer = (guide, studio) => {
|
|
|
202
228
|
return body ? `${body}\n\n${pointerText(studio)}` : pointerText(studio);
|
|
203
229
|
};
|
|
204
230
|
//#endregion
|
|
205
|
-
export { OLD_SCRIPTS, POINTER, STUDIO_SCRIPTS, STUDIO_TYPES, STUDIO_TYPES_FILE, configSource, designSystemConfig, fromRoot, fromStudio, hasPointer, ignoreFile, missingIgnoreLines, missingScripts, pointerPlace, pointerText, tsconfigJson, withIgnoreLines, withPointer };
|
|
231
|
+
export { OLD_SCRIPTS, POINTER, STUDIO_SCRIPTS, STUDIO_TYPES, STUDIO_TYPES_FILE, configSource, designSystemConfig, fromRoot, fromStudio, hasPointer, ignoreFile, missingIgnoreLines, missingScripts, pnpmDecidesEsbuild, pointerPlace, pointerText, tsconfigJson, withEsbuildBuilds, withIgnoreLines, withPointer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isSlug } from "./prototypes-core.mjs";
|
|
2
1
|
import { isRecord, isText } from "./checks.mjs";
|
|
2
|
+
import { isSlug } from "./prototypes-core.mjs";
|
|
3
3
|
import { frameKey, isFrameUid, legacyFrameUid } from "./canvas-core.mjs";
|
|
4
4
|
import { rowOwner } from "./people-core.mjs";
|
|
5
5
|
//#region src/shared/annotations-core.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { viewHref } from "./prototypes-core.mjs";
|
|
2
1
|
import { isRecord, isText } from "./checks.mjs";
|
|
3
2
|
import { gridProblems } from "./frame-grids.mjs";
|
|
3
|
+
import { viewHref } from "./prototypes-core.mjs";
|
|
4
4
|
import { isSketch, sketchFrameProblems } from "./sketch-core.mjs";
|
|
5
5
|
//#region src/shared/canvas-core.ts
|
|
6
6
|
/** The page each viewport shows, in CSS pixels. */
|