nxds-cli 0.5.0 → 0.6.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 +46 -19
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4543,7 +4543,7 @@ async function fetchRelease(registry, version) {
|
|
|
4543
4543
|
if (isNewerSchema(value)) {
|
|
4544
4544
|
const release = version === "latest" ? "The latest nxds release" : `nxds ${version}`;
|
|
4545
4545
|
throw new CliError(
|
|
4546
|
-
`${release} needs a newer nxds-cli than ${"0.
|
|
4546
|
+
`${release} needs a newer nxds-cli than ${"0.6.0"}. Run \`${CLI_COMMAND}\` to get the newest one.`
|
|
4547
4547
|
);
|
|
4548
4548
|
}
|
|
4549
4549
|
const invalid2 = (problems) => new CliError(
|
|
@@ -6295,7 +6295,7 @@ function localPackage(source) {
|
|
|
6295
6295
|
function assertWritable(out, overwrite) {
|
|
6296
6296
|
if (!existsSync9(out) || readdirSync(out).length === 0 || overwrite) return;
|
|
6297
6297
|
throw new UsageError(
|
|
6298
|
-
`${out} already has files. Pass --overwrite to replace
|
|
6298
|
+
`${out} already has files. Pass --overwrite to replace the export in it, or choose another --out.`
|
|
6299
6299
|
);
|
|
6300
6300
|
}
|
|
6301
6301
|
function readPaths(file) {
|
|
@@ -6351,6 +6351,26 @@ function readProject2(root) {
|
|
|
6351
6351
|
}
|
|
6352
6352
|
return files;
|
|
6353
6353
|
}
|
|
6354
|
+
var ROOT_FILES = ["coverage.md", "SETUP.md"];
|
|
6355
|
+
function readRootFiles(root) {
|
|
6356
|
+
const files = /* @__PURE__ */ new Map();
|
|
6357
|
+
for (const name of ROOT_FILES) {
|
|
6358
|
+
const file = path10.join(root, name);
|
|
6359
|
+
if (!existsSync9(file)) continue;
|
|
6360
|
+
if (!lstatSync(file).isFile()) {
|
|
6361
|
+
throw new CliError(`The release's ${name} isn't a regular file.`);
|
|
6362
|
+
}
|
|
6363
|
+
files.set(name, readFileSync5(file));
|
|
6364
|
+
}
|
|
6365
|
+
return files;
|
|
6366
|
+
}
|
|
6367
|
+
function writeRootFiles(out, files) {
|
|
6368
|
+
for (const name of ROOT_FILES) {
|
|
6369
|
+
const bytes = files.get(name);
|
|
6370
|
+
if (bytes) writeFileSync3(path10.join(out, name), bytes);
|
|
6371
|
+
else rmSync(path10.join(out, name), { force: true });
|
|
6372
|
+
}
|
|
6373
|
+
}
|
|
6354
6374
|
function mergeIndex(files, currentFile) {
|
|
6355
6375
|
const exported = files.get("design-system.json");
|
|
6356
6376
|
if (!exported) throw new CliError("The release has no design-system.json.");
|
|
@@ -6427,41 +6447,48 @@ async function exportClaudeDesign(cwd, options) {
|
|
|
6427
6447
|
);
|
|
6428
6448
|
try {
|
|
6429
6449
|
const files = readProject2(pkg.root);
|
|
6450
|
+
const rootFiles = readRootFiles(pkg.root);
|
|
6430
6451
|
if (options.index) mergeIndex(files, path10.resolve(cwd, options.index));
|
|
6431
6452
|
const exported = new Set(
|
|
6432
6453
|
[...files.keys()].map((file) => `project/${file}`)
|
|
6433
6454
|
);
|
|
6434
6455
|
const removed = options.existing ? stalePaths(readPaths(path10.resolve(cwd, options.existing)), exported) : [];
|
|
6435
|
-
const coverageFile = path10.join(pkg.root, "coverage.md");
|
|
6436
|
-
const coverage = existsSync9(coverageFile) ? readFileSync5(coverageFile) : void 0;
|
|
6437
6456
|
writeProject(out, files);
|
|
6438
|
-
|
|
6457
|
+
writeRootFiles(out, rootFiles);
|
|
6458
|
+
const removedFile = path10.join(out, "removed.json");
|
|
6439
6459
|
if (options.existing) {
|
|
6440
|
-
writeFileSync3(
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
);
|
|
6460
|
+
writeFileSync3(removedFile, `${JSON.stringify(removed, null, 2)}
|
|
6461
|
+
`);
|
|
6462
|
+
} else {
|
|
6463
|
+
rmSync(removedFile, { force: true });
|
|
6445
6464
|
}
|
|
6446
6465
|
const relative = path10.relative(cwd, out) || ".";
|
|
6447
6466
|
const lines2 = [
|
|
6448
|
-
`Exported nxds ${pkg.version} as a Claude Design System: ${files.size} files in ${path10.join(relative, "project")}
|
|
6449
|
-
`Publish ${relative} as a Design System artifact in Claude, with ${relative} as the root.`
|
|
6467
|
+
`Exported nxds ${pkg.version} as a Claude Design System: ${files.size} files in ${path10.join(relative, "project")}.`
|
|
6450
6468
|
];
|
|
6451
|
-
if (
|
|
6469
|
+
if (rootFiles.has("coverage.md")) {
|
|
6452
6470
|
lines2.push(
|
|
6453
|
-
`
|
|
6471
|
+
`The props the canvas can't set are in ${path10.join(relative, "coverage.md")}.`
|
|
6454
6472
|
);
|
|
6455
6473
|
}
|
|
6456
|
-
if (
|
|
6474
|
+
if (removed.length > 0) {
|
|
6457
6475
|
lines2.push(
|
|
6458
|
-
`
|
|
6476
|
+
`Remove the ${removed.length} files the system has and this release doesn't: they're listed in ${path10.join(relative, "removed.json")}.`
|
|
6459
6477
|
);
|
|
6460
6478
|
}
|
|
6479
|
+
lines2.push(
|
|
6480
|
+
rootFiles.has("SETUP.md") ? `Read ${path10.join(relative, "SETUP.md")} and follow it. It publishes the system, installs it on a canvas and checks it.` : `Publish ${relative} as a Design System artifact in Claude, with ${relative} as the root.`
|
|
6481
|
+
);
|
|
6461
6482
|
return {
|
|
6462
6483
|
ok: true,
|
|
6463
6484
|
lines: lines2,
|
|
6464
|
-
data: {
|
|
6485
|
+
data: {
|
|
6486
|
+
version: pkg.version,
|
|
6487
|
+
out,
|
|
6488
|
+
files: files.size,
|
|
6489
|
+
removed,
|
|
6490
|
+
root: [...rootFiles.keys()].map((name) => path10.join(out, name))
|
|
6491
|
+
}
|
|
6465
6492
|
};
|
|
6466
6493
|
} finally {
|
|
6467
6494
|
pkg.cleanup();
|
|
@@ -6895,7 +6922,7 @@ function program(done, write) {
|
|
|
6895
6922
|
// Errors are printed once, by `main`, as text or JSON.
|
|
6896
6923
|
outputError: () => {
|
|
6897
6924
|
}
|
|
6898
|
-
}).exitOverride().name(CLI_COMMAND).description("Add nxds to your app.").version("0.
|
|
6925
|
+
}).exitOverride().name(CLI_COMMAND).description("Add nxds to your app.").version("0.6.0", "-v, --version", "print the version").helpOption("-h, --help", "show help").helpCommand("help [command]", "show help for a command").option("--json", "print machine-readable JSON").option("--cwd <path>", "run in another folder").addOption(
|
|
6899
6926
|
new Option(
|
|
6900
6927
|
"--registry <url|path>",
|
|
6901
6928
|
"where to get nxds releases (default: https://nxds.dev/r)"
|
|
@@ -6987,7 +7014,7 @@ Docs: https://nxds.dev/getting-started/install`
|
|
|
6987
7014
|
).option(
|
|
6988
7015
|
"--existing <path>",
|
|
6989
7016
|
"a JSON list of the system's current file paths, to list the ones this release removes"
|
|
6990
|
-
).option("--overwrite", "replace the
|
|
7017
|
+
).option("--overwrite", "replace the export in --out", false).option(
|
|
6991
7018
|
"--source <path>",
|
|
6992
7019
|
"a built @nxds/claude-design dist folder, instead of the npm release"
|
|
6993
7020
|
).addOption(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nxds-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Install nxds components, blocks and setup into your app.",
|
|
6
6
|
"keywords": [
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@types/semver": "^7.8.0",
|
|
46
46
|
"tsup": "^8.5.1",
|
|
47
47
|
"typescript": "^5.9.3",
|
|
48
|
-
"@nxds/claude-design": "0.
|
|
48
|
+
"@nxds/claude-design": "0.13.0",
|
|
49
49
|
"@nxds/core": "0.12.0",
|
|
50
50
|
"@nxds/catalog": "0.0.1"
|
|
51
51
|
},
|