torch-glare 2.5.0 → 2.5.1
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/apps/lib/registry.json +58 -1
- package/dist/bin/index.js +8 -4
- package/dist/bin/index.js.map +1 -1
- package/dist/src/commands/add.d.ts +3 -2
- package/dist/src/commands/add.d.ts.map +1 -1
- package/dist/src/commands/add.js +27 -35
- package/dist/src/commands/add.js.map +1 -1
- package/dist/src/commands/hook.d.ts.map +1 -1
- package/dist/src/commands/hook.js +23 -13
- package/dist/src/commands/hook.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +6 -2
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/layout.d.ts.map +1 -1
- package/dist/src/commands/layout.js +23 -13
- package/dist/src/commands/layout.js.map +1 -1
- package/dist/src/commands/provider.d.ts.map +1 -1
- package/dist/src/commands/provider.js +22 -12
- package/dist/src/commands/provider.js.map +1 -1
- package/dist/src/commands/utils.d.ts.map +1 -1
- package/dist/src/commands/utils.js +21 -28
- package/dist/src/commands/utils.js.map +1 -1
- package/dist/src/shared/copyComponentsRecursively.d.ts +5 -3
- package/dist/src/shared/copyComponentsRecursively.d.ts.map +1 -1
- package/dist/src/shared/copyComponentsRecursively.js +5 -6
- package/dist/src/shared/copyComponentsRecursively.js.map +1 -1
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.js +1 -1
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.js.map +1 -1
- package/dist/src/shared/installDependencies.d.ts +16 -1
- package/dist/src/shared/installDependencies.d.ts.map +1 -1
- package/dist/src/shared/installDependencies.js +41 -21
- package/dist/src/shared/installDependencies.js.map +1 -1
- package/dist/src/shared/installFromPlan.d.ts +23 -0
- package/dist/src/shared/installFromPlan.d.ts.map +1 -0
- package/dist/src/shared/installFromPlan.js +77 -0
- package/dist/src/shared/installFromPlan.js.map +1 -0
- package/dist/src/shared/resolveEntry.d.ts +21 -0
- package/dist/src/shared/resolveEntry.d.ts.map +1 -0
- package/dist/src/shared/resolveEntry.js +54 -0
- package/dist/src/shared/resolveEntry.js.map +1 -0
- package/dist/src/shared/suggestOtherCommand.d.ts +8 -0
- package/dist/src/shared/suggestOtherCommand.d.ts.map +1 -0
- package/dist/src/shared/suggestOtherCommand.js +34 -0
- package/dist/src/shared/suggestOtherCommand.js.map +1 -0
- package/dist/src/shared/tailwindInit.d.ts +3 -1
- package/dist/src/shared/tailwindInit.d.ts.map +1 -1
- package/dist/src/shared/tailwindInit.js +3 -1
- package/dist/src/shared/tailwindInit.js.map +1 -1
- package/dist/src/shared/wireStylesheet.d.ts +32 -0
- package/dist/src/shared/wireStylesheet.d.ts.map +1 -0
- package/dist/src/shared/wireStylesheet.js +92 -0
- package/dist/src/shared/wireStylesheet.js.map +1 -0
- package/dist/src/types/main.d.ts +6 -0
- package/dist/src/types/main.d.ts.map +1 -1
- package/docs/reference/cli.md +28 -3
- package/docs/tutorials/getting-started.md +7 -0
- package/package.json +1 -1
package/apps/lib/registry.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.5.
|
|
2
|
+
"version": "2.5.1",
|
|
3
3
|
"generatedBy": "scripts/bin/generateRegistry",
|
|
4
|
+
"npmVersions": {
|
|
5
|
+
"@dnd-kit/core": "^6.3.1",
|
|
6
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
7
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
8
|
+
"@editorjs/checklist": "^1.6.0",
|
|
9
|
+
"@editorjs/code": "^2.9.4",
|
|
10
|
+
"@editorjs/delimiter": "^1.4.2",
|
|
11
|
+
"@editorjs/editorjs": "^2.31.1",
|
|
12
|
+
"@editorjs/embed": "^2.8.0",
|
|
13
|
+
"@editorjs/header": "^2.8.8",
|
|
14
|
+
"@editorjs/inline-code": "^1.5.2",
|
|
15
|
+
"@editorjs/link": "^2.6.2",
|
|
16
|
+
"@editorjs/list": "^2.0.9",
|
|
17
|
+
"@editorjs/marker": "^1.4.0",
|
|
18
|
+
"@editorjs/nested-list": "^1.4.3",
|
|
19
|
+
"@editorjs/quote": "^2.7.6",
|
|
20
|
+
"@editorjs/raw": "^2.5.1",
|
|
21
|
+
"@editorjs/simple-image": "^1.6.0",
|
|
22
|
+
"@editorjs/table": "^2.4.5",
|
|
23
|
+
"@editorjs/text-variant-tune": "^1.0.3",
|
|
24
|
+
"@editorjs/underline": "^1.2.1",
|
|
25
|
+
"@editorjs/warning": "^1.4.1",
|
|
26
|
+
"@radix-ui/react-alert-dialog": "^1.1.6",
|
|
27
|
+
"@radix-ui/react-avatar": "^1.1.3",
|
|
28
|
+
"@radix-ui/react-checkbox": "^1.1.4",
|
|
29
|
+
"@radix-ui/react-context-menu": "^2.3.2",
|
|
30
|
+
"@radix-ui/react-dialog": "^1.1.6",
|
|
31
|
+
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
|
32
|
+
"@radix-ui/react-label": "^2.1.2",
|
|
33
|
+
"@radix-ui/react-popover": "^1.1.6",
|
|
34
|
+
"@radix-ui/react-radio-group": "^1.2.3",
|
|
35
|
+
"@radix-ui/react-scroll-area": "^1.2.3",
|
|
36
|
+
"@radix-ui/react-select": "^2.1.6",
|
|
37
|
+
"@radix-ui/react-slider": "^1.4.2",
|
|
38
|
+
"@radix-ui/react-slot": "^1.1.2",
|
|
39
|
+
"@radix-ui/react-switch": "^1.1.3",
|
|
40
|
+
"@radix-ui/react-tabs": "^1.1.13",
|
|
41
|
+
"@radix-ui/react-toggle": "^1.1.2",
|
|
42
|
+
"@radix-ui/react-toggle-group": "^1.1.11",
|
|
43
|
+
"@radix-ui/react-tooltip": "^1.1.8",
|
|
44
|
+
"@tanstack/react-table": "^8.21.3",
|
|
45
|
+
"@tanstack/react-virtual": "^3.14.9",
|
|
46
|
+
"chart.js": "^4.5.1",
|
|
47
|
+
"class-variance-authority": "^0.7.1",
|
|
48
|
+
"clsx": "^2.1.1",
|
|
49
|
+
"date-fns": "^4.1.0",
|
|
50
|
+
"editorjs-undo": "^2.0.28",
|
|
51
|
+
"input-otp": "^1.4.2",
|
|
52
|
+
"lucide-react": "^0.507.0",
|
|
53
|
+
"next": "15.2.1",
|
|
54
|
+
"react-day-picker": "^9.6.7",
|
|
55
|
+
"react-hook-form": "^7.54.2",
|
|
56
|
+
"react-hot-toast": "^2.5.2",
|
|
57
|
+
"tailwind-merge": "^3.0.2",
|
|
58
|
+
"torch-react-mobile-picker": "^1.1.0",
|
|
59
|
+
"vaul": "^1.1.2"
|
|
60
|
+
},
|
|
4
61
|
"items": [
|
|
5
62
|
{
|
|
6
63
|
"name": "ActionButton",
|
package/dist/bin/index.js
CHANGED
|
@@ -30,20 +30,24 @@ program
|
|
|
30
30
|
.action((component, options) => add(component, !!options.force));
|
|
31
31
|
program
|
|
32
32
|
.command("hook [hook]")
|
|
33
|
+
.option("-f, --force", "Overwrite it if it already exists")
|
|
33
34
|
.description("Add a hook interactively or install a specified one")
|
|
34
|
-
.action((hook) => addHook(hook
|
|
35
|
+
.action((hook, options) => addHook(hook, !!options.force));
|
|
35
36
|
program
|
|
36
37
|
.command("layout [layout]")
|
|
38
|
+
.option("-f, --force", "Overwrite it if it already exists")
|
|
37
39
|
.description("Add a Layout interactively or install a specified one")
|
|
38
|
-
.action((layout) => addLayout(layout
|
|
40
|
+
.action((layout, options) => addLayout(layout, !!options.force));
|
|
39
41
|
program
|
|
40
42
|
.command("util [util]")
|
|
43
|
+
.option("-f, --force", "Overwrite it if it already exists")
|
|
41
44
|
.description("Add a utils interactively or install a specified one")
|
|
42
|
-
.action((util) => addUtil(util));
|
|
45
|
+
.action((util, options) => addUtil(util, !!options.force));
|
|
43
46
|
program
|
|
44
47
|
.command("provider [provider]")
|
|
48
|
+
.option("-f, --force", "Overwrite it if it already exists")
|
|
45
49
|
.description("Add a provider interactively or install a specified one")
|
|
46
|
-
.action((provider) => addProvider(provider
|
|
50
|
+
.action((provider, options) => addProvider(provider, !!options.force));
|
|
47
51
|
program
|
|
48
52
|
.command("update")
|
|
49
53
|
.description("Update everything installed")
|
package/dist/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../cli/bin/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,4EAA4E;AAC5E,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAC5B,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,CACxE,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,2CAA2C,CAAC;KACxD,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAA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B,MAAM,CAAC,aAAa,EAAE,mCAAmC,CAAC;KAC5D,WAAW,CAAC,sDAAsD,CAAC;KACnE,MAAM,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAE7D,OAAO;KACJ,OAAO,CAAC,qBAAqB,CAAC;KAC5B,MAAM,CAAC,aAAa,EAAE,mCAAmC,CAAC;KAC5D,WAAW,CAAC,yDAAyD,CAAC;KACtE,MAAM,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAEzE,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,GAAG,EAAE,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAE7C,OAAO;KACJ,OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,kDAAkD,CAAC;KAC/D,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;AAE5B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Add a component and everything it needs.
|
|
3
|
+
*
|
|
3
4
|
* @param {string} component - The name of the component to add.
|
|
4
|
-
* @param {boolean} replace -
|
|
5
|
+
* @param {boolean} replace - Overwrite what is already there, dependencies included.
|
|
5
6
|
*/
|
|
6
7
|
export declare function add(component?: string, replace?: boolean): Promise<void>;
|
|
7
8
|
//# sourceMappingURL=add.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/add.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/add.ts"],"names":[],"mappings":"AAoBA;;;;;GAKG;AACH,wBAAsB,GAAG,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CrF"}
|
package/dist/src/commands/add.js
CHANGED
|
@@ -1,71 +1,63 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
2
|
import inquirer from "inquirer";
|
|
4
3
|
import { fileURLToPath } from "url";
|
|
5
4
|
import { ensureDirectoryExists } from "../shared/ensureDirectoryExists.js";
|
|
6
5
|
import { getInstallPaths } from "../shared/getInstallPaths.js";
|
|
7
6
|
import { copyComponentsRecursively } from "../shared/copyComponentsRecursively.js";
|
|
8
7
|
import { getAvailableFiles } from "../shared/getAvailableFiles.js";
|
|
9
|
-
import {
|
|
8
|
+
import { installDependencies } from "../shared/installDependencies.js";
|
|
9
|
+
import { installFromPlan, reportInstall } from "../shared/installFromPlan.js";
|
|
10
|
+
import { isInstalled, resolveEntry } from "../shared/resolveEntry.js";
|
|
10
11
|
import { getConfig } from "../shared/getConfig.js";
|
|
12
|
+
import { suggestOtherCommand } from "../shared/suggestOtherCommand.js";
|
|
11
13
|
import { CONFIG_FILE } from "./init.js";
|
|
12
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
-
// Get the current file and directory paths
|
|
14
15
|
const __dirname = path.dirname(__filename);
|
|
15
|
-
// Define the path to the templates directory
|
|
16
16
|
const templatesDir = path.resolve(__dirname, "../../../apps/lib/components");
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Add a component and everything it needs.
|
|
19
|
+
*
|
|
19
20
|
* @param {string} component - The name of the component to add.
|
|
20
|
-
* @param {boolean} replace -
|
|
21
|
+
* @param {boolean} replace - Overwrite what is already there, dependencies included.
|
|
21
22
|
*/
|
|
22
23
|
export async function add(component, replace = false) {
|
|
23
24
|
const targetFile = getConfig(CONFIG_FILE);
|
|
24
25
|
const availableComponents = getAvailableFiles(templatesDir);
|
|
25
|
-
// If no component is provided, prompt the user to select one
|
|
26
26
|
if (!component) {
|
|
27
27
|
component = await promptComponentSelection(availableComponents);
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
const resolved = resolveComponentEntry(component, availableComponents, templatesDir);
|
|
29
|
+
const resolved = resolveEntry(component, availableComponents, templatesDir);
|
|
31
30
|
if (!resolved) {
|
|
32
31
|
console.error(`❌ Component "${component}" not found.`);
|
|
32
|
+
// It may well exist — as a hook, util, layout or provider. Say which command to use rather
|
|
33
|
+
// than leaving the caller to guess.
|
|
34
|
+
const hint = suggestOtherCommand(component);
|
|
35
|
+
if (hint)
|
|
36
|
+
console.error(` ${hint}`);
|
|
33
37
|
return;
|
|
34
38
|
}
|
|
39
|
+
// The registry knows the whole graph, so resolve it in one pass. `replace` reaches every item
|
|
40
|
+
// in the plan, which is what `--force` has always implied and never did.
|
|
41
|
+
const name = resolved.replace(/\.(tsx|ts)$/, "");
|
|
42
|
+
const result = installFromPlan("components", name, targetFile, replace);
|
|
43
|
+
if (result) {
|
|
44
|
+
reportInstall(resolved, result, targetFile.path);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Not in the registry — something added to apps/lib before `pnpm run registry` was re-run.
|
|
48
|
+
// Copy it alone and say so, rather than pretending the dependencies were handled.
|
|
49
|
+
console.warn(`⚠️ "${resolved}" is not in registry.json, so its dependencies cannot be resolved.\n` +
|
|
50
|
+
` Copying the files only. Re-run \`pnpm run registry\` in the library to fix this.`);
|
|
35
51
|
const { source, targetDir } = getInstallPaths(resolved, targetFile, templatesDir, "components");
|
|
36
|
-
|
|
37
|
-
if (isFileExists(targetDir, resolved) && !replace) {
|
|
52
|
+
if (isInstalled(targetDir, resolved) && !replace) {
|
|
38
53
|
console.log(`⚠️ Component "${resolved}" already exists.`);
|
|
39
54
|
return;
|
|
40
55
|
}
|
|
41
|
-
// Ensure the target directory exists
|
|
42
|
-
// if the directory is not exists, create it
|
|
43
56
|
ensureDirectoryExists(targetDir);
|
|
44
|
-
// Copy the component (directory or file) and install dependencies
|
|
45
57
|
copyComponentsRecursively(source, targetDir);
|
|
58
|
+
installDependencies(source);
|
|
46
59
|
console.log(`✅ ${resolved} has been added to ${targetFile.path}!`);
|
|
47
60
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Resolve a user-provided component name to an actual entry in the templates
|
|
50
|
-
* directory. Tries (in order):
|
|
51
|
-
* 1. exact match (e.g. "Button.tsx" or "DataViews")
|
|
52
|
-
* 2. with `.tsx` suffix (e.g. user typed "Button")
|
|
53
|
-
* 3. with `.ts` suffix (for non-JSX modules)
|
|
54
|
-
* Returns the matching entry name, or null if nothing matches.
|
|
55
|
-
*/
|
|
56
|
-
function resolveComponentEntry(input, available, dir) {
|
|
57
|
-
if (available.includes(input))
|
|
58
|
-
return input;
|
|
59
|
-
const candidates = [`${input}.tsx`, `${input}.ts`];
|
|
60
|
-
for (const c of candidates) {
|
|
61
|
-
if (available.includes(c))
|
|
62
|
-
return c;
|
|
63
|
-
}
|
|
64
|
-
// Last-ditch: see if it exists on disk even if `getAvailableFiles` missed it.
|
|
65
|
-
if (fs.existsSync(path.join(dir, input)))
|
|
66
|
-
return input;
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
61
|
/**
|
|
70
62
|
* Prompt the user to select a component from a list.
|
|
71
63
|
* @param {string[]} availableComponents - Array of available components.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../cli/src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../cli/src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,aAAa,EA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;IACjE,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAChD;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,wCAAwC;YACjD,OAAO,EAAE,mBAAmB;SAC/B;KACJ,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/hook.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/hook.ts"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAuCpF"}
|
|
@@ -7,7 +7,8 @@ import { getInstallPaths } from "../shared/getInstallPaths.js";
|
|
|
7
7
|
import { copyComponentsRecursively } from "../shared/copyComponentsRecursively.js";
|
|
8
8
|
import { getConfig } from "../shared/getConfig.js";
|
|
9
9
|
import { CONFIG_FILE } from "./init.js";
|
|
10
|
-
import {
|
|
10
|
+
import { installFromPlan, reportInstall } from "../shared/installFromPlan.js";
|
|
11
|
+
import { isInstalled, resolveEntry } from "../shared/resolveEntry.js";
|
|
11
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
13
|
const __dirname = path.dirname(__filename);
|
|
13
14
|
// Define the path to the hooks templates directory
|
|
@@ -24,23 +25,32 @@ export async function addHook(hook, replace = false) {
|
|
|
24
25
|
if (!hook) {
|
|
25
26
|
hook = await promptHookSelection(availableHooks);
|
|
26
27
|
}
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// Resolve the name the way every other command does — a bare `hook` name, a name with
|
|
29
|
+
// its extension, or a folder all reach the same entry.
|
|
30
|
+
const resolved = resolveEntry(hook, availableHooks, hooksTemplatesDir);
|
|
31
|
+
if (!resolved) {
|
|
32
|
+
console.error(`❌ Hook "${hook}" not found.`);
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
// The registry resolves the whole graph in one pass, so `replace` reaches every item — and a
|
|
36
|
+
// dependency is never skipped-and-forgotten the way the per-file walker used to skip it.
|
|
37
|
+
const name = resolved.replace(/\.(tsx|ts)$/, "");
|
|
38
|
+
const result = installFromPlan("hooks", name, targetFile, replace);
|
|
39
|
+
if (result) {
|
|
40
|
+
reportInstall(resolved, result, targetFile.path);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Not in registry.json — copy it alone, and say why the dependencies were not resolved.
|
|
44
|
+
console.warn(`⚠️ "${resolved}" is not in registry.json, so its dependencies cannot be resolved.\n` +
|
|
45
|
+
` Copying the file only. Re-run \`pnpm run registry\` in the library to fix this.`);
|
|
46
|
+
const { source, targetDir } = getInstallPaths(resolved, targetFile, hooksTemplatesDir, "hooks");
|
|
47
|
+
if (isInstalled(targetDir, resolved) && !replace) {
|
|
48
|
+
console.log(`⚠️ Hook "${resolved}" already exists.`);
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
41
|
-
|
|
51
|
+
ensureDirectoryExists(targetDir);
|
|
42
52
|
copyComponentsRecursively(source, targetDir);
|
|
43
|
-
console.log(`✅ ${
|
|
53
|
+
console.log(`✅ ${resolved} has been added to ${targetFile.path}!`);
|
|
44
54
|
}
|
|
45
55
|
/**
|
|
46
56
|
* Get a list of available hooks from the hooks templates directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.js","sourceRoot":"","sources":["../../../cli/src/commands/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,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QACrD,OAAO;IACX,CAAC;IACD,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACjC,yBAAyB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,sBAAsB,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,iBAAyB;IAChD,OAAO,EAAE,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACxF,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,mBAAmB,CAAC,cAAwB;IACvD,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAC3C;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,mCAAmC;YAC5C,OAAO,EAAE,cAAc;SAC1B;KACJ,CAAC,CAAC;IACH,OAAO,YAAY,CAAC;AACxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/init.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,WAAW,eAAe,CAAC;AAGxC,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAehD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import { tailwindInit } from "../shared/tailwindInit.js";
|
|
3
|
+
import { wireStylesheet } from "../shared/wireStylesheet.js";
|
|
3
4
|
export const CONFIG_FILE = "glare.json";
|
|
4
5
|
export async function initConfig() {
|
|
5
6
|
const defaultConfig = { path: "./" };
|
|
@@ -10,7 +11,10 @@ export async function initConfig() {
|
|
|
10
11
|
else {
|
|
11
12
|
console.log("⚠️ glare.json already exists, skipping creation.");
|
|
12
13
|
}
|
|
13
|
-
//
|
|
14
|
-
|
|
14
|
+
// Install the Tailwind packages, then actually wire them into the project's stylesheet.
|
|
15
|
+
// Installing them and stopping — which is what this did — leaves a project that builds fine
|
|
16
|
+
// and renders every design token unstyled, with no error to explain it.
|
|
17
|
+
const { isV3 } = tailwindInit();
|
|
18
|
+
wireStylesheet(isV3);
|
|
15
19
|
}
|
|
16
20
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../cli/src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../cli/src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAM7D,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AAGxC,MAAM,CAAC,KAAK,UAAU,UAAU;IAC5B,MAAM,aAAa,GAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAElD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9B,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IAC3D,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IACpE,CAAC;IAED,wFAAwF;IACxF,4FAA4F;IAC5F,wEAAwE;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,EAAE,CAAC;IAChC,cAAc,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/layout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/layout.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAuCxF"}
|
|
@@ -7,7 +7,8 @@ import { getConfig } from "../shared/getConfig.js";
|
|
|
7
7
|
import { getInstallPaths } from "../shared/getInstallPaths.js";
|
|
8
8
|
import { ensureDirectoryExists } from "../shared/ensureDirectoryExists.js";
|
|
9
9
|
import { CONFIG_FILE } from "./init.js";
|
|
10
|
-
import {
|
|
10
|
+
import { installFromPlan, reportInstall } from "../shared/installFromPlan.js";
|
|
11
|
+
import { isInstalled, resolveEntry } from "../shared/resolveEntry.js";
|
|
11
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
13
|
const __dirname = path.dirname(__filename);
|
|
13
14
|
// Define the path to the layouts templates directory
|
|
@@ -24,23 +25,32 @@ export async function addLayout(layout, replace = false) {
|
|
|
24
25
|
if (!layout) {
|
|
25
26
|
layout = await promptLayoutSelection(availableLayouts);
|
|
26
27
|
}
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// Resolve the name the way every other command does — a bare `layout` name, a name with
|
|
29
|
+
// its extension, or a folder all reach the same entry.
|
|
30
|
+
const resolved = resolveEntry(layout, availableLayouts, layoutsTemplatesDir);
|
|
31
|
+
if (!resolved) {
|
|
32
|
+
console.error(`❌ Layout "${layout}" not found.`);
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
// The registry resolves the whole graph in one pass, so `replace` reaches every item — and a
|
|
36
|
+
// dependency is never skipped-and-forgotten the way the per-file walker used to skip it.
|
|
37
|
+
const name = resolved.replace(/\.(tsx|ts)$/, "");
|
|
38
|
+
const result = installFromPlan("layouts", name, targetFile, replace);
|
|
39
|
+
if (result) {
|
|
40
|
+
reportInstall(resolved, result, targetFile.path);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Not in registry.json — copy it alone, and say why the dependencies were not resolved.
|
|
44
|
+
console.warn(`⚠️ "${resolved}" is not in registry.json, so its dependencies cannot be resolved.\n` +
|
|
45
|
+
` Copying the file only. Re-run \`pnpm run registry\` in the library to fix this.`);
|
|
46
|
+
const { source, targetDir } = getInstallPaths(resolved, targetFile, layoutsTemplatesDir, "layouts");
|
|
47
|
+
if (isInstalled(targetDir, resolved) && !replace) {
|
|
48
|
+
console.log(`⚠️ Layout "${resolved}" already exists.`);
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
41
|
-
|
|
51
|
+
ensureDirectoryExists(targetDir);
|
|
42
52
|
copyComponentsRecursively(source, targetDir);
|
|
43
|
-
console.log(`✅ ${
|
|
53
|
+
console.log(`✅ ${resolved} has been added to ${targetFile.path}!`);
|
|
44
54
|
}
|
|
45
55
|
/**
|
|
46
56
|
* Get a list of available layouts from the layouts templates directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../../cli/src/commands/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OA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AM,EAAE,SAAS,CAAC,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,sBAAsB,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,mBAA2B;IACpD,OAAO,EAAE,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAClF,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,qBAAqB,CAAC,gBAA0B;IAC3D,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;QAC7C;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,qCAAqC;YAC9C,OAAO,EAAE,gBAAgB;SAC5B;KACJ,CAAC,CAAC;IACH,OAAO,cAAc,CAAC;AAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/provider.ts"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC5F"}
|
|
@@ -7,7 +7,8 @@ import { ensureDirectoryExists } from "../shared/ensureDirectoryExists.js";
|
|
|
7
7
|
import { getInstallPaths } from "../shared/getInstallPaths.js";
|
|
8
8
|
import { copyComponentsRecursively } from "../shared/copyComponentsRecursively.js";
|
|
9
9
|
import inquirer from "inquirer";
|
|
10
|
-
import {
|
|
10
|
+
import { installFromPlan, reportInstall } from "../shared/installFromPlan.js";
|
|
11
|
+
import { isInstalled, resolveEntry } from "../shared/resolveEntry.js";
|
|
11
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
13
|
const __dirname = path.dirname(__filename);
|
|
13
14
|
// Define the path to the provider templates directory
|
|
@@ -24,23 +25,32 @@ export async function addProvider(provider, replace = false) {
|
|
|
24
25
|
if (!provider) {
|
|
25
26
|
provider = await promptProviderSelection(availableProviders);
|
|
26
27
|
}
|
|
27
|
-
//
|
|
28
|
-
|
|
28
|
+
// Resolve the name the way every other command does — a bare `provider` name, a name with
|
|
29
|
+
// its extension, or a folder all reach the same entry.
|
|
30
|
+
const resolved = resolveEntry(provider, availableProviders, providerTemplatesDir);
|
|
31
|
+
if (!resolved) {
|
|
29
32
|
console.error(`❌ Provider "${provider}" not found.`);
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
// The registry resolves the whole graph in one pass, so `replace` reaches every item — and a
|
|
36
|
+
// dependency is never skipped-and-forgotten the way the per-file walker used to skip it.
|
|
37
|
+
const name = resolved.replace(/\.(tsx|ts)$/, "");
|
|
38
|
+
const result = installFromPlan("providers", name, targetFile, replace);
|
|
39
|
+
if (result) {
|
|
40
|
+
reportInstall(resolved, result, targetFile.path);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Not in registry.json — copy it alone, and say why the dependencies were not resolved.
|
|
44
|
+
console.warn(`⚠️ "${resolved}" is not in registry.json, so its dependencies cannot be resolved.\n` +
|
|
45
|
+
` Copying the file only. Re-run \`pnpm run registry\` in the library to fix this.`);
|
|
46
|
+
const { source, targetDir } = getInstallPaths(resolved, targetFile, providerTemplatesDir, "providers");
|
|
47
|
+
if (isInstalled(targetDir, resolved) && !replace) {
|
|
48
|
+
console.log(`⚠️ Provider "${resolved}" already exists.`);
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
41
|
-
|
|
51
|
+
ensureDirectoryExists(targetDir);
|
|
42
52
|
copyComponentsRecursively(source, targetDir);
|
|
43
|
-
console.log(`✅ ${
|
|
53
|
+
console.log(`✅ ${resolved} has been added to ${targetFile.path}!`);
|
|
44
54
|
}
|
|
45
55
|
/**
|
|
46
56
|
* Get a list of available providers from the provider templates directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../cli/src/commands/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../cli/src/commands/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,QAAQ,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
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/utils.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CpF"}
|
|
@@ -7,7 +7,8 @@ import { ensureDirectoryExists } from "../shared/ensureDirectoryExists.js";
|
|
|
7
7
|
import { getInstallPaths } from "../shared/getInstallPaths.js";
|
|
8
8
|
import inquirer from "inquirer";
|
|
9
9
|
import { copyComponentsRecursively } from "../shared/copyComponentsRecursively.js";
|
|
10
|
-
import {
|
|
10
|
+
import { installFromPlan, reportInstall } from "../shared/installFromPlan.js";
|
|
11
|
+
import { isInstalled, resolveEntry } from "../shared/resolveEntry.js";
|
|
11
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
13
|
const __dirname = path.dirname(__filename);
|
|
13
14
|
// Define the path to the utils templates directory
|
|
@@ -25,24 +26,34 @@ export async function addUtil(util, replace = false) {
|
|
|
25
26
|
util = await promptUtilSelection(availableUtils);
|
|
26
27
|
}
|
|
27
28
|
// Resolve user input — accepts "cn", "cn.ts", or a folder name like "dataViews".
|
|
28
|
-
const resolved =
|
|
29
|
+
const resolved = resolveEntry(util, availableUtils, utilsTemplatesDir);
|
|
29
30
|
if (!resolved) {
|
|
30
31
|
console.error(`❌ Utility file "${util}" not found.`);
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
util = resolved;
|
|
34
|
-
//
|
|
35
|
+
// The registry resolves the whole graph in one pass, so `replace` reaches every item.
|
|
36
|
+
const name = resolved.replace(/\.(tsx|ts)$/, "");
|
|
37
|
+
const result = installFromPlan("utils", name, targetFile, replace);
|
|
38
|
+
if (result) {
|
|
39
|
+
reportInstall(resolved, result, targetFile.path);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Not in registry.json — copy it alone, and say why the dependencies were not resolved.
|
|
43
|
+
console.warn(`⚠️ "${resolved}" is not in registry.json, so its dependencies cannot be resolved.\n` +
|
|
44
|
+
` Copying the file only. Re-run \`pnpm run registry\` in the library to fix this.`);
|
|
35
45
|
const { source, targetDir } = getInstallPaths(util, targetFile, utilsTemplatesDir, "utils");
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
// Check if utility file already exists
|
|
41
|
-
if (isFileExists(targetDir, util) && !replace) {
|
|
46
|
+
// Check *before* removing anything. This used to `rmSync` the target first, which made the
|
|
47
|
+
// check below permanently false — so every visit re-copied the file and re-printed the success
|
|
48
|
+
// line, which is why one `add` reported "cn.ts has been added" five times.
|
|
49
|
+
if (isInstalled(targetDir, util) && !replace) {
|
|
42
50
|
console.log(`⚠️ Utility file "${util}" already exists.`);
|
|
43
51
|
return;
|
|
44
52
|
}
|
|
45
|
-
|
|
53
|
+
const target = path.join(targetDir, util);
|
|
54
|
+
if (fs.existsSync(target))
|
|
55
|
+
fs.rmSync(target, { recursive: true, force: true });
|
|
56
|
+
ensureDirectoryExists(targetDir);
|
|
46
57
|
copyComponentsRecursively(source, target);
|
|
47
58
|
console.log(`✅ ${util} has been added to ${targetFile.path}!`);
|
|
48
59
|
}
|
|
@@ -54,24 +65,6 @@ export async function addUtil(util, replace = false) {
|
|
|
54
65
|
function getAvailableUtils(utilsTemplatesDir) {
|
|
55
66
|
return fs.readdirSync(utilsTemplatesDir).map((file) => path.basename(file));
|
|
56
67
|
}
|
|
57
|
-
/**
|
|
58
|
-
* Resolve a user-provided util name to an actual entry. Tries:
|
|
59
|
-
* 1. exact match (e.g. "cn.ts" or "dataViews")
|
|
60
|
-
* 2. with `.ts` suffix
|
|
61
|
-
* 3. with `.tsx` suffix
|
|
62
|
-
*/
|
|
63
|
-
function resolveUtilEntry(input, available, dir) {
|
|
64
|
-
if (available.includes(input))
|
|
65
|
-
return input;
|
|
66
|
-
const candidates = [`${input}.ts`, `${input}.tsx`];
|
|
67
|
-
for (const c of candidates) {
|
|
68
|
-
if (available.includes(c))
|
|
69
|
-
return c;
|
|
70
|
-
}
|
|
71
|
-
if (fs.existsSync(path.join(dir, input)))
|
|
72
|
-
return input;
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
68
|
/**
|
|
76
69
|
* Prompt the user to select a utility file from a list.
|
|
77
70
|
* @param {string[]} availableUtils - Array of available utility files.
|