@expcat/tigercat-cli 1.4.0 → 1.5.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/dist/index.js +65 -41
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -43,29 +43,29 @@ function readFileSafe(filePath) {
|
|
|
43
43
|
|
|
44
44
|
// src/constants.ts
|
|
45
45
|
var CLI_NAME = "tigercat";
|
|
46
|
-
var CLI_VERSION = "1.
|
|
46
|
+
var CLI_VERSION = "1.5.0";
|
|
47
47
|
var TEMPLATES = ["vue3", "react"];
|
|
48
48
|
var TEMPLATE_VERSIONS = {
|
|
49
49
|
// Tigercat packages (use caret on latest major)
|
|
50
|
-
tigercat: "^1.
|
|
50
|
+
tigercat: "^1.5.0",
|
|
51
51
|
// Frameworks
|
|
52
|
-
vue: "^3.5.
|
|
53
|
-
react: "^19.2.
|
|
54
|
-
reactDom: "^19.2.
|
|
52
|
+
vue: "^3.5.38",
|
|
53
|
+
react: "^19.2.7",
|
|
54
|
+
reactDom: "^19.2.7",
|
|
55
55
|
// Build toolchain
|
|
56
56
|
typescript: "^6.0.3",
|
|
57
|
-
vite: "^8.0
|
|
58
|
-
tailwindcss: "^4.
|
|
59
|
-
tailwindcssVite: "^4.
|
|
57
|
+
vite: "^8.1.0",
|
|
58
|
+
tailwindcss: "^4.3.1",
|
|
59
|
+
tailwindcssVite: "^4.3.1",
|
|
60
60
|
// Vite plugins
|
|
61
|
-
vitejsPluginVue: "^6.0.
|
|
62
|
-
vitejsPluginReact: "^6.0.
|
|
61
|
+
vitejsPluginVue: "^6.0.7",
|
|
62
|
+
vitejsPluginReact: "^6.0.3",
|
|
63
63
|
// Type definitions
|
|
64
|
-
typesReact: "^19.2.
|
|
64
|
+
typesReact: "^19.2.17",
|
|
65
65
|
typesReactDom: "^19.2.3",
|
|
66
66
|
// Vue-specific
|
|
67
67
|
vueTsconfig: "^0.9.1",
|
|
68
|
-
vueTsc: "^3.
|
|
68
|
+
vueTsc: "^3.3.5"
|
|
69
69
|
};
|
|
70
70
|
var COMPONENT_CATEGORIES = {
|
|
71
71
|
basic: [
|
|
@@ -625,6 +625,20 @@ async function runCreate(name, templateArg, dryRun = false) {
|
|
|
625
625
|
console.log(" pnpm install");
|
|
626
626
|
console.log(" pnpm dev\n");
|
|
627
627
|
}
|
|
628
|
+
function runCommand(command, options = {}) {
|
|
629
|
+
try {
|
|
630
|
+
execSync(command, { cwd: options.cwd, stdio: "inherit" });
|
|
631
|
+
} catch (error) {
|
|
632
|
+
if (options.allowFailure) return;
|
|
633
|
+
if (options.failureMessage !== void 0) {
|
|
634
|
+
logError(options.failureMessage);
|
|
635
|
+
process.exit(1);
|
|
636
|
+
}
|
|
637
|
+
throw error;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// src/commands/add.ts
|
|
628
642
|
function createAddCommand() {
|
|
629
643
|
return new Command("add").argument("[components...]", "Component names to add (e.g. Button Input Select)").option("-f, --framework <framework>", "Framework override (vue3 | react)").option("--install", "Install missing Tigercat dependencies before generating snippets").option("--snippet <file>", "Generate a reusable import snippet file").option("--dry-run", "Preview generated demo files without writing them").description("Add component import boilerplate to your project").action(async (components, opts) => {
|
|
630
644
|
await runAdd(components ?? [], opts);
|
|
@@ -726,7 +740,7 @@ async function runAdd(components, options = {}) {
|
|
|
726
740
|
const installCommand = formatAddCommand(packageManager, missingDeps);
|
|
727
741
|
if (options.install && !dryRun) {
|
|
728
742
|
logInfo(`Installing missing dependencies: ${missingDeps.join(", ")}`);
|
|
729
|
-
|
|
743
|
+
runCommand(installCommand, { cwd });
|
|
730
744
|
} else {
|
|
731
745
|
logInfo(`Missing dependencies detected. Run: ${installCommand}`);
|
|
732
746
|
}
|
|
@@ -828,7 +842,7 @@ async function runPlayground(templateArg, port = "3456", open = true, dryRun = f
|
|
|
828
842
|
const tmpDir = resolve(process.cwd(), ".tigercat-playground");
|
|
829
843
|
const projectDir = join(tmpDir, `playground-${template}`);
|
|
830
844
|
if (dryRun) {
|
|
831
|
-
const
|
|
845
|
+
const safePort2 = /^\d+$/.test(port) ? port : "3456";
|
|
832
846
|
logInfo(`Dry run: would prepare ${template} playground in ${projectDir}.`);
|
|
833
847
|
if (!existsSync(projectDir)) {
|
|
834
848
|
const files = template === "vue3" ? getVue3Template("playground") : getReactTemplate("playground");
|
|
@@ -837,7 +851,7 @@ async function runPlayground(templateArg, port = "3456", open = true, dryRun = f
|
|
|
837
851
|
}
|
|
838
852
|
logInfo("Would run pnpm install");
|
|
839
853
|
}
|
|
840
|
-
logInfo(`Would start Vite on port ${
|
|
854
|
+
logInfo(`Would start Vite on port ${safePort2}${open ? " and open the browser" : ""}`);
|
|
841
855
|
return;
|
|
842
856
|
}
|
|
843
857
|
if (!existsSync(projectDir)) {
|
|
@@ -852,21 +866,16 @@ async function runPlayground(templateArg, port = "3456", open = true, dryRun = f
|
|
|
852
866
|
writeFileSafe(resolve(projectDir, filePath), content);
|
|
853
867
|
}
|
|
854
868
|
logInfo("Installing dependencies...");
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
process.exit(1);
|
|
860
|
-
}
|
|
869
|
+
runCommand("pnpm install", {
|
|
870
|
+
cwd: projectDir,
|
|
871
|
+
failureMessage: "Failed to install dependencies. Make sure pnpm is available."
|
|
872
|
+
});
|
|
861
873
|
}
|
|
862
874
|
logSuccess(`Starting playground on port ${port}...
|
|
863
875
|
`);
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
execSync(`npx vite --port ${safePort}${openFlag}`, { cwd: projectDir, stdio: "inherit" });
|
|
868
|
-
} catch {
|
|
869
|
-
}
|
|
876
|
+
const safePort = /^\d+$/.test(port) ? port : "3456";
|
|
877
|
+
const openFlag = open ? " --open" : "";
|
|
878
|
+
runCommand(`npx vite --port ${safePort}${openFlag}`, { cwd: projectDir, allowFailure: true });
|
|
870
879
|
}
|
|
871
880
|
function createGenerateCommand() {
|
|
872
881
|
const cmd = new Command("generate").description("Code generation utilities");
|
|
@@ -1154,8 +1163,10 @@ Document keyboard behavior, roles, labels, and focus management.
|
|
|
1154
1163
|
List boundary states, empty states, loading states, and controlled/uncontrolled behavior.
|
|
1155
1164
|
`;
|
|
1156
1165
|
}
|
|
1157
|
-
var
|
|
1158
|
-
var
|
|
1166
|
+
var MIN_NODE_VERSION = { major: 22, minor: 13, patch: 0 };
|
|
1167
|
+
var MIN_PNPM_VERSION = { major: 11, minor: 9, patch: 0 };
|
|
1168
|
+
var MIN_NODE_RANGE = "22.13.0";
|
|
1169
|
+
var MIN_PNPM_RANGE = "11.9.0";
|
|
1159
1170
|
var REQUIRED_TAILWIND_MAJOR = 4;
|
|
1160
1171
|
var REQUIRED_TIGERCAT_MAJOR = 1;
|
|
1161
1172
|
var FRAMEWORK_PEER_RANGES = {
|
|
@@ -1173,8 +1184,16 @@ var REQUIRED_CORE_EXPORTS = [
|
|
|
1173
1184
|
"./figma-variables.json"
|
|
1174
1185
|
];
|
|
1175
1186
|
var VERSION_COMPATIBILITY_MATRIX = [
|
|
1176
|
-
{
|
|
1177
|
-
|
|
1187
|
+
{
|
|
1188
|
+
name: "Node.js",
|
|
1189
|
+
range: `>=${MIN_NODE_RANGE}`,
|
|
1190
|
+
reason: "Matches workspace engines and CLI templates"
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
name: "pnpm",
|
|
1194
|
+
range: `>=${MIN_PNPM_RANGE}`,
|
|
1195
|
+
reason: "Required by workspace package management"
|
|
1196
|
+
},
|
|
1178
1197
|
{ name: "Tailwind CSS", range: ">=4.0.0", reason: "Required by Tigercat theme utilities" },
|
|
1179
1198
|
{ name: "Vue", range: "^3.0.0", reason: "Peer range for @expcat/tigercat-vue" },
|
|
1180
1199
|
{ name: "React", range: "^19.0.0", reason: "Peer range for @expcat/tigercat-react" }
|
|
@@ -1286,18 +1305,18 @@ function createPackageCheck(result) {
|
|
|
1286
1305
|
}
|
|
1287
1306
|
function createNodeCheck(version) {
|
|
1288
1307
|
const parsed = parseVersion(version);
|
|
1289
|
-
if (!parsed || parsed
|
|
1308
|
+
if (!parsed || isVersionLessThan(parsed, MIN_NODE_VERSION)) {
|
|
1290
1309
|
return {
|
|
1291
1310
|
name: "Node.js",
|
|
1292
1311
|
status: "fail",
|
|
1293
|
-
message: `Node ${
|
|
1294
|
-
suggestions: [`Install Node ${
|
|
1312
|
+
message: `Node ${MIN_NODE_RANGE}+ is required, current version is ${version}`,
|
|
1313
|
+
suggestions: [`Install Node ${MIN_NODE_RANGE}+ and rerun tigercat doctor`]
|
|
1295
1314
|
};
|
|
1296
1315
|
}
|
|
1297
1316
|
return {
|
|
1298
1317
|
name: "Node.js",
|
|
1299
1318
|
status: "pass",
|
|
1300
|
-
message: `Node ${version} satisfies >=${
|
|
1319
|
+
message: `Node ${version} satisfies >=${MIN_NODE_RANGE}`
|
|
1301
1320
|
};
|
|
1302
1321
|
}
|
|
1303
1322
|
function createPnpmCheck(packageJson, env) {
|
|
@@ -1306,23 +1325,23 @@ function createPnpmCheck(packageJson, env) {
|
|
|
1306
1325
|
return {
|
|
1307
1326
|
name: "pnpm",
|
|
1308
1327
|
status: "warn",
|
|
1309
|
-
message: `Could not detect pnpm version; Tigercat templates expect pnpm ${
|
|
1310
|
-
suggestions: ["Add packageManager: pnpm@
|
|
1328
|
+
message: `Could not detect pnpm version; Tigercat templates expect pnpm ${MIN_PNPM_RANGE}+`,
|
|
1329
|
+
suggestions: ["Add packageManager: pnpm@11.9.0 to package.json or run through pnpm"]
|
|
1311
1330
|
};
|
|
1312
1331
|
}
|
|
1313
1332
|
const parsed = parseVersion(version);
|
|
1314
|
-
if (!parsed || parsed
|
|
1333
|
+
if (!parsed || isVersionLessThan(parsed, MIN_PNPM_VERSION)) {
|
|
1315
1334
|
return {
|
|
1316
1335
|
name: "pnpm",
|
|
1317
1336
|
status: "fail",
|
|
1318
|
-
message: `pnpm ${
|
|
1319
|
-
suggestions: [`Upgrade pnpm to ${
|
|
1337
|
+
message: `pnpm ${MIN_PNPM_RANGE}+ is required, detected ${version}`,
|
|
1338
|
+
suggestions: [`Upgrade pnpm to ${MIN_PNPM_RANGE}+`]
|
|
1320
1339
|
};
|
|
1321
1340
|
}
|
|
1322
1341
|
return {
|
|
1323
1342
|
name: "pnpm",
|
|
1324
1343
|
status: "pass",
|
|
1325
|
-
message: `pnpm ${version} satisfies >=${
|
|
1344
|
+
message: `pnpm ${version} satisfies >=${MIN_PNPM_RANGE}`
|
|
1326
1345
|
};
|
|
1327
1346
|
}
|
|
1328
1347
|
function createTailwindCheck(packageJson) {
|
|
@@ -1571,6 +1590,11 @@ function parseVersion(value) {
|
|
|
1571
1590
|
patch: Number(match[3] ?? 0)
|
|
1572
1591
|
};
|
|
1573
1592
|
}
|
|
1593
|
+
function isVersionLessThan(current, minimum) {
|
|
1594
|
+
if (current.major !== minimum.major) return current.major < minimum.major;
|
|
1595
|
+
if (current.minor !== minimum.minor) return current.minor < minimum.minor;
|
|
1596
|
+
return current.patch < minimum.patch;
|
|
1597
|
+
}
|
|
1574
1598
|
function getRangeMajor(range) {
|
|
1575
1599
|
if (!range) return null;
|
|
1576
1600
|
if (/^(workspace|file|link|catalog):/.test(range)) return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expcat/tigercat-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tooling for Tigercat UI library — project scaffolding, component generation, and more",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,8 +33,11 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=22.12.0"
|
|
38
|
+
},
|
|
36
39
|
"dependencies": {
|
|
37
|
-
"commander": "^
|
|
40
|
+
"commander": "^15.0.0",
|
|
38
41
|
"picocolors": "^1.1.1",
|
|
39
42
|
"prompts": "^2.4.2"
|
|
40
43
|
},
|