torch-glare 2.5.0 → 2.5.2
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/components/DataViews/filters/filters.tsx +7 -11
- package/apps/lib/components/FormBuilder/context.ts +8 -25
- package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +1 -1
- package/apps/lib/components/FormBuilder/form-builder.tsx +32 -172
- package/apps/lib/components/FormBuilder/index.ts +0 -4
- package/apps/lib/components/FormBuilder/types.ts +6 -16
- package/apps/lib/components/FormRenderer/FormDrawer.tsx +2 -2
- package/apps/lib/components/FormRenderer/detail.tsx +6 -6
- package/apps/lib/components/FormRenderer/form-renderer.tsx +155 -35
- package/apps/lib/components/{FormBuilder → FormRenderer}/header.tsx +12 -25
- package/apps/lib/components/FormRenderer/index.ts +4 -0
- package/apps/lib/components/FormRenderer/section.tsx +39 -0
- package/apps/lib/components/{FormBuilder → FormRenderer}/stepper.tsx +47 -19
- package/apps/lib/components/FormRenderer/types.ts +6 -6
- package/apps/lib/registry.json +62 -3
- package/apps/lib/tsconfig.tsbuildinfo +1 -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/components/form-builder.md +62 -88
- package/docs/components/form-renderer.md +61 -25
- package/docs/components/form-summary.md +18 -3
- package/docs/components/section-block.md +1 -1
- package/docs/how-to/forms-with-form-builder.md +44 -41
- package/docs/migration/changelog.md +3 -0
- package/docs/migration/form-builder-2.5.2.md +113 -0
- package/docs/reference/cli.md +28 -3
- package/docs/tutorials/getting-started.md +7 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copyComponentsRecursively.js","sourceRoot":"","sources":["../../../cli/src/shared/copyComponentsRecursively.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"copyComponentsRecursively.js","sourceRoot":"","sources":["../../../cli/src/shared/copyComponentsRecursively.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAc,EAAE,MAAc;IACpE,IAAI,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QACrC,kEAAkE;QAClE,oEAAoE;QACpE,iEAAiE;QACjE,2CAA2C;QAC3C,MAAM,WAAW,GACb,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE;YACvD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC,CAAC,MAAM,CAAC;QACjB,iBAAiB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3C,CAAC;SAAM,CAAC;QACJ,IAAI,WAAW,GAAG,MAAM,CAAC;QAEzB,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YAC9D,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACzC,CAAC;AACL,CAAC;AACD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC7B,MAAc,EACd,MAAc;IAEd,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAEhD,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACrB,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAC5C,CAAC;IACL,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,QAAgB;IACpC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -63,7 +63,7 @@ export function getDependenciesAndInstallNestedComponents(componentPath, install
|
|
|
63
63
|
else if (head === "hooks") {
|
|
64
64
|
const hookEntry = rest[1];
|
|
65
65
|
if (hookEntry) {
|
|
66
|
-
addHook(
|
|
66
|
+
addHook(hookEntry);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
else if (head === "layouts") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDependenciesAndInstallNestedComponents.js","sourceRoot":"","sources":["../../../cli/src/shared/getDependenciesAndInstallNestedComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,yCAAyC,CACrD,aAAqB,EACrB,qBAAkC;IAElC,MAAM,gBAAgB,GAAG,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,WAAW,GAAG,gDAAgD,CAAC;IACrE,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAU,CAAC;IAChD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAExC,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,UAAU;YAAE,SAAS;QAE1B,sDAAsD;QACtD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBACzC,qBAAqB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC1C,CAAC;YACD,SAAS;QACb,CAAC;QAED,+BAA+B;QAC/B,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACnE,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC;QACxD,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAErC,2DAA2D;QAC3D,IAAI,OAAO,KAAK,CAAC;YAAE,SAAS;QAE5B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAErB,qDAAqD;QACrD,uCAAuC;QACvC,uCAAuC;QACvC,sEAAsE;QACtE,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YACnB,0CAA0C;YAC1C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACzB,IAAI,SAAS,EAAE,CAAC;gBACZ,OAAO,CAAC,SAAS,CAAC,CAAA;YACtB,CAAC;QACL,CAAC;aAAM,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACzB,IAAI,SAAS,EAAE,CAAC;gBACZ,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"getDependenciesAndInstallNestedComponents.js","sourceRoot":"","sources":["../../../cli/src/shared/getDependenciesAndInstallNestedComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,E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O;YAAO,OAAO,CAAC,KAAK,CAAC,CAAC;YAAC,MAAK;QACxC,KAAK,OAAO;YAAO,OAAO,CAAC,KAAK,CAAC,CAAC;YAAC,MAAK;QACxC,KAAK,SAAS;YAAK,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YAAC,MAAK;IACxD,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY;IAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAA;AAC7C,CAAC"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Install
|
|
2
|
+
* Install a set of npm packages, skipping any the project already has.
|
|
3
|
+
*
|
|
4
|
+
* Split out from `installDependencies` so the registry-driven installer can call it **once** with
|
|
5
|
+
* the union of a whole plan's packages. It used to be reachable only as a side effect of copying a
|
|
6
|
+
* file, which meant a 35-file component ran it 35 times.
|
|
7
|
+
*
|
|
8
|
+
* @returns the packages actually installed.
|
|
9
|
+
*/
|
|
10
|
+
export declare function installNpmPackages(packages: Iterable<string>): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Legacy path: resolve a component's dependencies by scanning its imports.
|
|
13
|
+
*
|
|
14
|
+
* Only reached now for an item that is **not** in `registry.json` — something added to `apps/lib`
|
|
15
|
+
* before `pnpm run registry` was re-run. Everything registered goes through `installFromPlan`,
|
|
16
|
+
* which resolves the whole graph up front instead of discovering it one file at a time.
|
|
17
|
+
*
|
|
3
18
|
* @param {string} componentPath - Path to the component file.
|
|
4
19
|
*/
|
|
5
20
|
export declare function installDependencies(componentPath: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installDependencies.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/installDependencies.ts"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"installDependencies.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/installDependencies.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CA4BvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAW/D"}
|
|
@@ -4,33 +4,53 @@ import { detectPackageManager } from "./detectPackageManager.js";
|
|
|
4
4
|
import { getDependenciesAndInstallNestedComponents } from "./getDependenciesAndInstallNestedComponents.js";
|
|
5
5
|
import { getInstallCommand } from "./getInstallCommand.js";
|
|
6
6
|
/**
|
|
7
|
-
* Install
|
|
7
|
+
* Install a set of npm packages, skipping any the project already has.
|
|
8
|
+
*
|
|
9
|
+
* Split out from `installDependencies` so the registry-driven installer can call it **once** with
|
|
10
|
+
* the union of a whole plan's packages. It used to be reachable only as a side effect of copying a
|
|
11
|
+
* file, which meant a 35-file component ran it 35 times.
|
|
12
|
+
*
|
|
13
|
+
* @returns the packages actually installed.
|
|
14
|
+
*/
|
|
15
|
+
export function installNpmPackages(packages) {
|
|
16
|
+
const { depsNames } = getCurrentInstalledDependencies();
|
|
17
|
+
const missing = new Set();
|
|
18
|
+
for (const spec of packages) {
|
|
19
|
+
// A spec may carry a range (`react-hook-form@^7.54.2`); the installed check is by name.
|
|
20
|
+
// The leading `@` of a scoped package is not a separator.
|
|
21
|
+
const at = spec.lastIndexOf("@");
|
|
22
|
+
const name = at > 0 ? spec.slice(0, at) : spec;
|
|
23
|
+
if (!depsNames.has(name))
|
|
24
|
+
missing.add(spec);
|
|
25
|
+
}
|
|
26
|
+
if (missing.size === 0)
|
|
27
|
+
return [];
|
|
28
|
+
const packageManager = detectPackageManager();
|
|
29
|
+
const installCommand = getInstallCommand(packageManager, missing);
|
|
30
|
+
console.log(`📦 Installing ${missing.size} missing package(s) using ${packageManager}:`, [...missing].join(", "));
|
|
31
|
+
try {
|
|
32
|
+
execSync(installCommand, { stdio: "inherit" });
|
|
33
|
+
return [...missing];
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error("❌ Error installing dependencies:", error.message);
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Legacy path: resolve a component's dependencies by scanning its imports.
|
|
42
|
+
*
|
|
43
|
+
* Only reached now for an item that is **not** in `registry.json` — something added to `apps/lib`
|
|
44
|
+
* before `pnpm run registry` was re-run. Everything registered goes through `installFromPlan`,
|
|
45
|
+
* which resolves the whole graph up front instead of discovering it one file at a time.
|
|
46
|
+
*
|
|
8
47
|
* @param {string} componentPath - Path to the component file.
|
|
9
48
|
*/
|
|
10
49
|
export function installDependencies(componentPath) {
|
|
11
|
-
// get current installed dependencies on your package.json
|
|
12
50
|
const { depsNames } = getCurrentInstalledDependencies();
|
|
13
|
-
// get dependencies used in the component and it's nested components.
|
|
14
|
-
// also copy component to the target directory with it's nested components.
|
|
15
51
|
const dependenciesToInstall = getDependenciesAndInstallNestedComponents(componentPath, depsNames);
|
|
16
|
-
// if there are dependencies to install, install them
|
|
17
52
|
if (dependenciesToInstall.size > 0) {
|
|
18
|
-
|
|
19
|
-
const packageManager = detectPackageManager();
|
|
20
|
-
// get full install command
|
|
21
|
-
const installCommand = getInstallCommand(packageManager, dependenciesToInstall);
|
|
22
|
-
console.log(`📦 Installing missing dependencies using ${packageManager}:`, [...dependenciesToInstall].join(", "));
|
|
23
|
-
// execute install command
|
|
24
|
-
try {
|
|
25
|
-
execSync(installCommand, { stdio: "inherit" });
|
|
26
|
-
console.log("✅ Dependencies installed successfully.");
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
console.error("❌ Error installing dependencies:", error.message);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
console.log("✅ All dependencies are already installed.");
|
|
53
|
+
installNpmPackages(dependenciesToInstall);
|
|
34
54
|
}
|
|
35
55
|
}
|
|
36
56
|
//# sourceMappingURL=installDependencies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installDependencies.js","sourceRoot":"","sources":["../../../cli/src/shared/installDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAC3G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D
|
|
1
|
+
{"version":3,"file":"installDependencies.js","sourceRoot":"","sources":["../../../cli/src/shared/installDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAC3G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAA0B;IACzD,MAAM,EAAE,SAAS,EAAE,GAAG,+BAA+B,EAAE,CAAC;IACxD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC1B,wFAAwF;QACxF,0DAA0D;QAC1D,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAElC,MAAM,cAAc,GAAG,oBAAoB,EAAE,CAAC;IAC9C,MAAM,cAAc,GAAG,iBAAiB,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAElE,OAAO,CAAC,GAAG,CACP,iBAAiB,OAAO,CAAC,IAAI,6BAA6B,cAAc,GAAG,EAC3E,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAC1B,CAAC;IAEF,IAAI,CAAC;QACD,QAAQ,CAAC,cAAc,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,EAAE,CAAC;IACd,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,aAAqB;IACrD,MAAM,EAAE,SAAS,EAAE,GAAG,+BAA+B,EAAE,CAAC;IAExD,MAAM,qBAAqB,GAAG,yCAAyC,CACnE,aAAa,EACb,SAAS,CACZ,CAAC;IAEF,IAAI,qBAAqB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACjC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;IAC9C,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Config, RegistryItem } from "../types/main.js";
|
|
2
|
+
export interface InstallResult {
|
|
3
|
+
installed: string[];
|
|
4
|
+
skipped: string[];
|
|
5
|
+
npm: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Install one registry item and everything it needs.
|
|
9
|
+
*
|
|
10
|
+
* Dependencies come from `apps/lib/registry.json` — the same generated graph the docs and the MCP
|
|
11
|
+
* server read — rather than from scanning import statements as files are copied. The old walker had
|
|
12
|
+
* no visited set and no cycle guard, and ran once per copied file, so a 35-file component triggered
|
|
13
|
+
* 35 recursive walks; worse, a dependency skipped because its folder already existed was never
|
|
14
|
+
* descended into, which silently truncated the tree (`add DataViews` installed 16 of 55 items and
|
|
15
|
+
* exited 0).
|
|
16
|
+
*
|
|
17
|
+
* Resolving up front also gives `force` a coherent meaning: it applies to **every** item in the
|
|
18
|
+
* plan, not only the one you named.
|
|
19
|
+
*/
|
|
20
|
+
export declare function installFromPlan(type: RegistryItem["type"], name: string, config: Config, force: boolean): InstallResult | null;
|
|
21
|
+
/** `✅ 55 installed, 0 skipped` — truncation has to be visible, not inferred from silence. */
|
|
22
|
+
export declare function reportInstall(name: string, result: InstallResult, where: string): void;
|
|
23
|
+
//# sourceMappingURL=installFromPlan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installFromPlan.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/installFromPlan.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAO7D,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC3B,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,EAC1B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,GACf,aAAa,GAAG,IAAI,CA2CtB;AAED,6FAA6F;AAC7F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CActF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { copyComponentsRecursively } from "./copyComponentsRecursively.js";
|
|
5
|
+
import { ensureDirectoryExists } from "./ensureDirectoryExists.js";
|
|
6
|
+
import { installNpmPackages } from "./installDependencies.js";
|
|
7
|
+
import { isInstalled } from "./resolveEntry.js";
|
|
8
|
+
import { loadRegistry } from "./loadRegistry.js";
|
|
9
|
+
import { resolveInstallPlan } from "./resolveInstallPlan.js";
|
|
10
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
/** `apps/lib` in the published package — the root every registry `path` is relative to. */
|
|
12
|
+
const LIB_DIR = path.resolve(__dirname, "../../../apps/lib");
|
|
13
|
+
/**
|
|
14
|
+
* Install one registry item and everything it needs.
|
|
15
|
+
*
|
|
16
|
+
* Dependencies come from `apps/lib/registry.json` — the same generated graph the docs and the MCP
|
|
17
|
+
* server read — rather than from scanning import statements as files are copied. The old walker had
|
|
18
|
+
* no visited set and no cycle guard, and ran once per copied file, so a 35-file component triggered
|
|
19
|
+
* 35 recursive walks; worse, a dependency skipped because its folder already existed was never
|
|
20
|
+
* descended into, which silently truncated the tree (`add DataViews` installed 16 of 55 items and
|
|
21
|
+
* exited 0).
|
|
22
|
+
*
|
|
23
|
+
* Resolving up front also gives `force` a coherent meaning: it applies to **every** item in the
|
|
24
|
+
* plan, not only the one you named.
|
|
25
|
+
*/
|
|
26
|
+
export function installFromPlan(type, name, config, force) {
|
|
27
|
+
const registry = loadRegistry();
|
|
28
|
+
const plan = resolveInstallPlan(registry, type, name);
|
|
29
|
+
if (!plan)
|
|
30
|
+
return null;
|
|
31
|
+
const installed = [];
|
|
32
|
+
const skipped = [];
|
|
33
|
+
for (const item of plan.items) {
|
|
34
|
+
const source = path.join(LIB_DIR, item.path);
|
|
35
|
+
if (!fs.existsSync(source))
|
|
36
|
+
continue;
|
|
37
|
+
const entry = path.basename(item.path);
|
|
38
|
+
const targetDir = path.join(process.cwd(), config.path.replace("@/", ""), item.type);
|
|
39
|
+
if (isInstalled(targetDir, entry) && !force) {
|
|
40
|
+
skipped.push(`${item.type}/${item.name}`);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
// Replacing: clear the old copy first, so a folder that lost files upstream does not keep
|
|
44
|
+
// them locally.
|
|
45
|
+
const target = path.join(targetDir, entry);
|
|
46
|
+
if (force && fs.existsSync(target))
|
|
47
|
+
fs.rmSync(target, { recursive: true, force: true });
|
|
48
|
+
ensureDirectoryExists(targetDir);
|
|
49
|
+
copyComponentsRecursively(source, targetDir);
|
|
50
|
+
installed.push(`${item.type}/${item.name}`);
|
|
51
|
+
}
|
|
52
|
+
// Once, for the union — not once per file, which is what produced five "cn.ts has been added"
|
|
53
|
+
// lines and five separate npm invocations for a single `add`.
|
|
54
|
+
//
|
|
55
|
+
// Pinned to the range the library builds against. Unpinned, `add DataTable` pulled
|
|
56
|
+
// @tanstack/react-table v9 against a component written for v8 — copied code that could not
|
|
57
|
+
// compile on arrival.
|
|
58
|
+
const pinned = [...plan.npmDependencies].map((name) => {
|
|
59
|
+
const range = registry.npmVersions?.[name];
|
|
60
|
+
return range ? `${name}@${range}` : name;
|
|
61
|
+
});
|
|
62
|
+
const npm = installNpmPackages(pinned);
|
|
63
|
+
return { installed, skipped, npm };
|
|
64
|
+
}
|
|
65
|
+
/** `✅ 55 installed, 0 skipped` — truncation has to be visible, not inferred from silence. */
|
|
66
|
+
export function reportInstall(name, result, where) {
|
|
67
|
+
const { installed, skipped } = result;
|
|
68
|
+
const total = installed.length + skipped.length;
|
|
69
|
+
if (installed.length === 0 && skipped.length > 0) {
|
|
70
|
+
console.log(`⚠️ ${name} is already installed (${total} items). Use --force to overwrite.`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
console.log(`✅ ${name} → ${where}: ${installed.length} installed` +
|
|
74
|
+
(skipped.length ? `, ${skipped.length} already present` : "") +
|
|
75
|
+
` (${total} items).`);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=installFromPlan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installFromPlan.js","sourceRoot":"","sources":["../../../cli/src/shared/installFromPlan.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,gCAAgC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,2FAA2F;AAC3F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAQ7D;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAC3B,IAA0B,EAC1B,IAAY,EACZ,MAAc,EACd,KAAc;IAEd,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,MAAM,IAAI,GAAG,kBAAkB,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtD,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC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I,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC;QAC3C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7C,CAAC,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AACvC,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,MAAqB,EAAE,KAAa;IAC5E,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACtC,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAEhD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,0BAA0B,KAAK,oCAAoC,CAAC,CAAC;QAC3F,OAAO;IACX,CAAC;IAED,OAAO,CAAC,GAAG,CACP,KAAK,IAAI,MAAM,KAAK,KAAK,SAAS,CAAC,MAAM,YAAY;QACjD,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,MAAM,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,KAAK,KAAK,UAAU,CAC3B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a user-provided name to an actual entry in a templates directory.
|
|
3
|
+
*
|
|
4
|
+
* `readdirSync` returns names **with** their extensions, so comparing a bare `useDragDrop` against
|
|
5
|
+
* that list never matches — which is why `torch-glare hook useDragDrop` used to do nothing at all.
|
|
6
|
+
* Every command resolves through here now, so a bare name, a name with an extension, and a folder
|
|
7
|
+
* component all work the same way whichever command you reach for.
|
|
8
|
+
*
|
|
9
|
+
* Tries, in order: exact match · `.tsx` · `.ts` · anything on disk the listing missed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveEntry(input: string, available: string[], dir: string): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Is this item actually installed?
|
|
14
|
+
*
|
|
15
|
+
* Not `existsSync`. A directory that exists but holds no files is a leftover — from a deleted
|
|
16
|
+
* install, an interrupted run, or a user who removed the contents but not the folder — and
|
|
17
|
+
* treating it as installed is what made `add DataViews` refuse to copy anything while reporting
|
|
18
|
+
* "already exists". An empty directory is an absence.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isInstalled(targetDir: string, entry: string): boolean;
|
|
21
|
+
//# sourceMappingURL=resolveEntry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveEntry.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/resolveEntry.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU3F;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAQrE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a user-provided name to an actual entry in a templates directory.
|
|
5
|
+
*
|
|
6
|
+
* `readdirSync` returns names **with** their extensions, so comparing a bare `useDragDrop` against
|
|
7
|
+
* that list never matches — which is why `torch-glare hook useDragDrop` used to do nothing at all.
|
|
8
|
+
* Every command resolves through here now, so a bare name, a name with an extension, and a folder
|
|
9
|
+
* component all work the same way whichever command you reach for.
|
|
10
|
+
*
|
|
11
|
+
* Tries, in order: exact match · `.tsx` · `.ts` · anything on disk the listing missed.
|
|
12
|
+
*/
|
|
13
|
+
export function resolveEntry(input, available, dir) {
|
|
14
|
+
if (available.includes(input))
|
|
15
|
+
return input;
|
|
16
|
+
for (const candidate of [`${input}.tsx`, `${input}.ts`]) {
|
|
17
|
+
if (available.includes(candidate))
|
|
18
|
+
return candidate;
|
|
19
|
+
}
|
|
20
|
+
// Last-ditch: a folder component, or something the listing filtered out.
|
|
21
|
+
if (fs.existsSync(path.join(dir, input)))
|
|
22
|
+
return input;
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Is this item actually installed?
|
|
27
|
+
*
|
|
28
|
+
* Not `existsSync`. A directory that exists but holds no files is a leftover — from a deleted
|
|
29
|
+
* install, an interrupted run, or a user who removed the contents but not the folder — and
|
|
30
|
+
* treating it as installed is what made `add DataViews` refuse to copy anything while reporting
|
|
31
|
+
* "already exists". An empty directory is an absence.
|
|
32
|
+
*/
|
|
33
|
+
export function isInstalled(targetDir, entry) {
|
|
34
|
+
const target = path.join(targetDir, entry);
|
|
35
|
+
if (!fs.existsSync(target))
|
|
36
|
+
return false;
|
|
37
|
+
if (fs.lstatSync(target).isDirectory()) {
|
|
38
|
+
return hasAnyFile(target);
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
function hasAnyFile(dir) {
|
|
43
|
+
for (const item of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
44
|
+
if (item.isDirectory()) {
|
|
45
|
+
if (hasAnyFile(path.join(dir, item.name)))
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=resolveEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|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E,EAAE,CAAC;YACrB,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC;QAC3D,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A name that is not a component may still be something we ship.
|
|
3
|
+
*
|
|
4
|
+
* `torch-glare add useDragDrop` answering only "Component not found" is technically correct and
|
|
5
|
+
* practically useless — it *is* installable, just by a different command. Look before saying no.
|
|
6
|
+
*/
|
|
7
|
+
export declare function suggestOtherCommand(input: string): string | null;
|
|
8
|
+
//# sourceMappingURL=suggestOtherCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestOtherCommand.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/suggestOtherCommand.ts"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAehE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
const LIB_DIR = path.resolve(__dirname, "../../../apps/lib");
|
|
6
|
+
/** Which command installs which folder. */
|
|
7
|
+
const KINDS = [
|
|
8
|
+
{ dir: "hooks", command: "hook", label: "hook" },
|
|
9
|
+
{ dir: "utils", command: "util", label: "utility" },
|
|
10
|
+
{ dir: "layouts", command: "layout", label: "layout" },
|
|
11
|
+
{ dir: "providers", command: "provider", label: "provider" },
|
|
12
|
+
];
|
|
13
|
+
/**
|
|
14
|
+
* A name that is not a component may still be something we ship.
|
|
15
|
+
*
|
|
16
|
+
* `torch-glare add useDragDrop` answering only "Component not found" is technically correct and
|
|
17
|
+
* practically useless — it *is* installable, just by a different command. Look before saying no.
|
|
18
|
+
*/
|
|
19
|
+
export function suggestOtherCommand(input) {
|
|
20
|
+
const bare = input.replace(/\.(tsx|ts)$/, "").toLowerCase();
|
|
21
|
+
for (const kind of KINDS) {
|
|
22
|
+
const dir = path.join(LIB_DIR, kind.dir);
|
|
23
|
+
if (!fs.existsSync(dir))
|
|
24
|
+
continue;
|
|
25
|
+
for (const entry of fs.readdirSync(dir)) {
|
|
26
|
+
if (entry.replace(/\.(tsx|ts)$/, "").toLowerCase() === bare) {
|
|
27
|
+
const name = entry.replace(/\.(tsx|ts)$/, "");
|
|
28
|
+
return `"${name}" is a ${kind.label} — try \`torch-glare ${kind.command} ${name}\`.`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=suggestOtherCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggestOtherCommand.js","sourceRoot":"","sources":["../../../cli/src/shared/suggestOtherCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAE7D,2CAA2C;AAC3C,MAAM,KAAK,GAAsD;IAC7D,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAChD,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE;IACnD,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IACtD,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE;CAC/D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IAE5D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAElC,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE,CAAC;gBAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;gBAC9C,OAAO,IAAI,IAAI,UAAU,IAAI,CAAC,KAAK,wBAAwB,IAAI,CAAC,OAAO,IAAI,IAAI,KAAK,CAAC;YACzF,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwindInit.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/tailwindInit.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"tailwindInit.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/tailwindInit.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,IAAI;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAchD"}
|
|
@@ -15,6 +15,7 @@ export function tailwindInit() {
|
|
|
15
15
|
dependencies.push("@tailwindcss/container-queries");
|
|
16
16
|
}
|
|
17
17
|
installDependencies(dependencies);
|
|
18
|
+
return { isV3: LessThanV4 };
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Installs dependencies using the detected package manager.
|
|
@@ -71,7 +72,8 @@ function installDependencies(dependencies = []) {
|
|
|
71
72
|
const IsTailwindLessThanV4 = () => {
|
|
72
73
|
const packageJson = fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8');
|
|
73
74
|
const parsedJson = JSON.parse(packageJson);
|
|
74
|
-
|
|
75
|
+
// Either section — a project with tailwindcss in `dependencies` was being misread as v4.
|
|
76
|
+
const tailwindVersion = parsedJson.devDependencies?.['tailwindcss'] ?? parsedJson.dependencies?.['tailwindcss'];
|
|
75
77
|
if (!tailwindVersion)
|
|
76
78
|
return false;
|
|
77
79
|
return tailwindVersion.startsWith('^3') || tailwindVersion.startsWith('3');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwindInit.js","sourceRoot":"","sources":["../../../cli/src/shared/tailwindInit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,MAAM,UAAU,YAAY;IAC1B,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAA;IACzC,MAAM,YAAY,GAAG;QACnB,qBAAqB;QACrB,yBAAyB;QACzB,kBAAkB;QAClB,UAAU,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,yBAAyB;QAC/D,kBAAkB;KACnB,CAAC;IACF,IA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O,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;AACH,CAAC;AAGD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IAChC,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;IACtF,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAQ,CAAC;IAElD,yFAAyF;IACzF,MAAM,eAAe,GACnB,UAAU,CAAC,eAAe,EAAE,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC,CAAC;IAC1F,IAAI,CAAC,eAAe;QAAE,OAAO,KAAK,CAAC;IAEnC,OAAO,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAC5E,CAAC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an entry stylesheet lives, in the order projects usually put it.
|
|
3
|
+
* Next.js app router first, then pages/Vite, then a `styles/` convention.
|
|
4
|
+
*/
|
|
5
|
+
declare const CANDIDATES: string[];
|
|
6
|
+
/** The marker that tells us the block is already there. */
|
|
7
|
+
declare const MARKER = "glare-torch-mode";
|
|
8
|
+
/**
|
|
9
|
+
* Tailwind v4 registers the design system through the CSS file itself.
|
|
10
|
+
*
|
|
11
|
+
* The order matters and is not cosmetic: CSS requires every `@import` to precede other at-rules, so
|
|
12
|
+
* an `@import "tailwindcss"` placed *after* the `@plugin` lines is silently dropped by the bundler.
|
|
13
|
+
* That takes every `--color-*` registration with it and leaves every `bg-background-presentation-*`
|
|
14
|
+
* utility rendering as nothing — with no build error to explain it.
|
|
15
|
+
*/
|
|
16
|
+
declare const V4_BLOCK = "@import \"tailwindcss\";\n@import \"mapping-color-system-v4/tailwindVars.css\";\n@plugin \"glare-torch-mode\";\n@plugin \"tailwind-scrollbar-hide\";\n@plugin \"tailwindcss-animate\";\n@plugin \"glare-typography\";\n@plugin \"mapping-color-system-v4\";\n";
|
|
17
|
+
export declare function findStylesheet(cwd?: string): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Put the design system into the project's stylesheet.
|
|
20
|
+
*
|
|
21
|
+
* `init` used to install the five Tailwind packages and stop, leaving the wiring as a manual step
|
|
22
|
+
* buried in the docs — so a project would build cleanly and render every component unstyled. This
|
|
23
|
+
* closes that gap, and is a no-op when the block is already present, so re-running `init` is safe.
|
|
24
|
+
*
|
|
25
|
+
* @returns what happened, so the caller can report it truthfully.
|
|
26
|
+
*/
|
|
27
|
+
export declare function wireStylesheet(isV3: boolean, cwd?: string): {
|
|
28
|
+
status: "written" | "already" | "not-found" | "manual";
|
|
29
|
+
file?: string;
|
|
30
|
+
};
|
|
31
|
+
export { V4_BLOCK, MARKER, CANDIDATES };
|
|
32
|
+
//# sourceMappingURL=wireStylesheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireStylesheet.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/wireStylesheet.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,QAAA,MAAM,UAAU,UAQf,CAAC;AAEF,2DAA2D;AAC3D,QAAA,MAAM,MAAM,qBAAqB,CAAC;AAElC;;;;;;;GAOG;AACH,QAAA,MAAM,QAAQ,kQAOb,CAAC;AAYF,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAMzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC1B,IAAI,EAAE,OAAO,EACb,GAAG,GAAE,MAAsB,GAC5B;IAAE,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAoC3E;AAED,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
/**
|
|
4
|
+
* Where an entry stylesheet lives, in the order projects usually put it.
|
|
5
|
+
* Next.js app router first, then pages/Vite, then a `styles/` convention.
|
|
6
|
+
*/
|
|
7
|
+
const CANDIDATES = [
|
|
8
|
+
"app/globals.css",
|
|
9
|
+
"src/app/globals.css",
|
|
10
|
+
"src/index.css",
|
|
11
|
+
"styles/globals.css",
|
|
12
|
+
"src/styles/globals.css",
|
|
13
|
+
"app/global.css",
|
|
14
|
+
"src/styles/index.css",
|
|
15
|
+
];
|
|
16
|
+
/** The marker that tells us the block is already there. */
|
|
17
|
+
const MARKER = "glare-torch-mode";
|
|
18
|
+
/**
|
|
19
|
+
* Tailwind v4 registers the design system through the CSS file itself.
|
|
20
|
+
*
|
|
21
|
+
* The order matters and is not cosmetic: CSS requires every `@import` to precede other at-rules, so
|
|
22
|
+
* an `@import "tailwindcss"` placed *after* the `@plugin` lines is silently dropped by the bundler.
|
|
23
|
+
* That takes every `--color-*` registration with it and leaves every `bg-background-presentation-*`
|
|
24
|
+
* utility rendering as nothing — with no build error to explain it.
|
|
25
|
+
*/
|
|
26
|
+
const V4_BLOCK = `@import "tailwindcss";
|
|
27
|
+
@import "mapping-color-system-v4/tailwindVars.css";
|
|
28
|
+
@plugin "glare-torch-mode";
|
|
29
|
+
@plugin "tailwind-scrollbar-hide";
|
|
30
|
+
@plugin "tailwindcss-animate";
|
|
31
|
+
@plugin "glare-typography";
|
|
32
|
+
@plugin "mapping-color-system-v4";
|
|
33
|
+
`;
|
|
34
|
+
/** For v3 the plugins belong in `tailwind.config.*`, which is user-owned JS we do not rewrite. */
|
|
35
|
+
const V3_SNIPPET = `plugins: [
|
|
36
|
+
require("glare-torch-mode"),
|
|
37
|
+
require("tailwind-scrollbar-hide"),
|
|
38
|
+
require("tailwindcss-animate"),
|
|
39
|
+
require("glare-typography"),
|
|
40
|
+
require("mapping-color-system"),
|
|
41
|
+
require("@tailwindcss/container-queries"),
|
|
42
|
+
]`;
|
|
43
|
+
export function findStylesheet(cwd = process.cwd()) {
|
|
44
|
+
for (const candidate of CANDIDATES) {
|
|
45
|
+
const full = path.join(cwd, candidate);
|
|
46
|
+
if (fs.existsSync(full))
|
|
47
|
+
return full;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Put the design system into the project's stylesheet.
|
|
53
|
+
*
|
|
54
|
+
* `init` used to install the five Tailwind packages and stop, leaving the wiring as a manual step
|
|
55
|
+
* buried in the docs — so a project would build cleanly and render every component unstyled. This
|
|
56
|
+
* closes that gap, and is a no-op when the block is already present, so re-running `init` is safe.
|
|
57
|
+
*
|
|
58
|
+
* @returns what happened, so the caller can report it truthfully.
|
|
59
|
+
*/
|
|
60
|
+
export function wireStylesheet(isV3, cwd = process.cwd()) {
|
|
61
|
+
// v3's plugins go in tailwind.config.*, whose shape is arbitrary user JS. A wrong edit there is
|
|
62
|
+
// worse than a printed instruction, so print and let the developer place it.
|
|
63
|
+
if (isV3) {
|
|
64
|
+
console.log("ℹ️ Tailwind v3 detected. Add these plugins to your `tailwind.config.*`:\n");
|
|
65
|
+
console.log(V3_SNIPPET + "\n");
|
|
66
|
+
return { status: "manual" };
|
|
67
|
+
}
|
|
68
|
+
const file = findStylesheet(cwd);
|
|
69
|
+
if (!file) {
|
|
70
|
+
console.log("⚠️ No entry stylesheet found (looked for " +
|
|
71
|
+
CANDIDATES.slice(0, 4).join(", ") +
|
|
72
|
+
").\n Add this to yours, keeping `@import \"tailwindcss\"` first:\n");
|
|
73
|
+
console.log(V4_BLOCK);
|
|
74
|
+
return { status: "not-found" };
|
|
75
|
+
}
|
|
76
|
+
const current = fs.readFileSync(file, "utf-8");
|
|
77
|
+
if (current.includes(MARKER)) {
|
|
78
|
+
console.log(`✅ ${path.relative(cwd, file)} is already wired — left alone.`);
|
|
79
|
+
return { status: "already", file };
|
|
80
|
+
}
|
|
81
|
+
// Replace the project's own `@import "tailwindcss"` rather than adding a second one; if there
|
|
82
|
+
// is none, the block goes at the very top, which is where the import has to be anyway.
|
|
83
|
+
const existing = /^[ \t]*@import\s+["']tailwindcss["'];?[ \t]*\r?\n/m;
|
|
84
|
+
const next = existing.test(current)
|
|
85
|
+
? current.replace(existing, V4_BLOCK)
|
|
86
|
+
: V4_BLOCK + "\n" + current;
|
|
87
|
+
fs.writeFileSync(file, next);
|
|
88
|
+
console.log(`✅ Wired ${path.relative(cwd, file)} with the TORCH Glare design system.`);
|
|
89
|
+
return { status: "written", file };
|
|
90
|
+
}
|
|
91
|
+
export { V4_BLOCK, MARKER, CANDIDATES };
|
|
92
|
+
//# sourceMappingURL=wireStylesheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireStylesheet.js","sourceRoot":"","sources":["../../../cli/src/shared/wireStylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;GAGG;AACH,MAAM,UAAU,GAAG;IACf,iBAAiB;IACjB,qBAAqB;IACrB,eAAe;IACf,oBAAoB;IACpB,wBAAwB;IACxB,gBAAgB;IAChB,sBAAsB;CACzB,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,QAAQ,GAAG;;;;;;;CAOhB,CAAC;AAEF,kGAAkG;AAClG,MAAM,UAAU,GAAG;;;;;;;EAOjB,CAAC;AAEH,MAAM,UAAU,cAAc,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IACtD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACvC,IAAI,EAAE,C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CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC;QACrC,CAAC,CAAC,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC;IAEhC,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACvF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AACvC,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/src/types/main.d.ts
CHANGED
|
@@ -20,6 +20,12 @@ export interface RegistryItem {
|
|
|
20
20
|
export interface Registry {
|
|
21
21
|
version: string;
|
|
22
22
|
generatedBy: string;
|
|
23
|
+
/**
|
|
24
|
+
* The version range the library builds each package against, e.g.
|
|
25
|
+
* `{"@tanstack/react-table": "^8.21.3"}`. Installing unpinned means an upstream major can
|
|
26
|
+
* break copied source the day it lands.
|
|
27
|
+
*/
|
|
28
|
+
npmVersions?: Record<string, string>;
|
|
23
29
|
items: RegistryItem[];
|
|
24
30
|
}
|
|
25
31
|
/** Fully resolved set of work needed to install one item. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../cli/src/types/main.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACnB,IAAI,EAAE,MAAM,CAAC;CAEhB;AAED,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD;AAED,gDAAgD;AAChD,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,IAAI,EAAE,YAAY,GAAG,OAAO,GAAG,O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