@barqjs/ui-cli 0.2.0-next.0 → 0.2.0-next.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/dist/{build-CcNYbuwH.js → build-C65qsG0d.js} +1 -2
- package/dist/index.d.ts +1 -3
- package/dist/index.js +11 -21
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join, relative, resolve } from "node:path";
|
|
3
|
-
|
|
3
|
+
// src/build.ts
|
|
4
4
|
/**
|
|
5
5
|
* `build`: a directory of components, as a registry someone else can `add`.
|
|
6
6
|
*
|
|
@@ -133,5 +133,4 @@ function buildRegistry(from, to) {
|
|
|
133
133
|
}, null, 2)}\n`);
|
|
134
134
|
return items.length;
|
|
135
135
|
}
|
|
136
|
-
//#endregion
|
|
137
136
|
export { buildRegistry };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/index.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Exported so the suite can drive the commands, and guarded so importing it
|
|
4
3
|
* does not run one. The guard compares the script node was asked to run with
|
|
@@ -7,5 +6,4 @@
|
|
|
7
6
|
* engines range admits. `argv[1]` is the `.bin` symlink under a package
|
|
8
7
|
* manager, hence the realpath.
|
|
9
8
|
*/
|
|
10
|
-
export declare function run(): Promise<void>;
|
|
11
|
-
//#endregion
|
|
9
|
+
export declare function run(): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
8
8
|
import { createInterface } from "node:readline/promises";
|
|
9
|
-
|
|
9
|
+
// src/files.ts
|
|
10
10
|
/**
|
|
11
11
|
* Writing a component into a project, and the import rewriting that needs.
|
|
12
12
|
*
|
|
@@ -114,8 +114,7 @@ function read(path) {
|
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
//#region src/add.ts
|
|
117
|
+
// src/add.ts
|
|
119
118
|
/**
|
|
120
119
|
* `add`: the item, everything it needs, and the files that result.
|
|
121
120
|
*
|
|
@@ -216,8 +215,7 @@ function missingDependencies(items, installed, field = "dependencies") {
|
|
|
216
215
|
for (const item of items) for (const dependency of item[field]) if (!installed.has(packageName(dependency))) wanted.add(dependency);
|
|
217
216
|
return [...wanted].toSorted();
|
|
218
217
|
}
|
|
219
|
-
|
|
220
|
-
//#region src/schema.ts
|
|
218
|
+
// src/schema.ts
|
|
221
219
|
const TYPES = /* @__PURE__ */ new Set([
|
|
222
220
|
"registry:ui",
|
|
223
221
|
"registry:lib",
|
|
@@ -391,8 +389,7 @@ function parseConfig(value) {
|
|
|
391
389
|
items: Object.fromEntries(Object.entries(items).map(([name, files]) => [name, Object.fromEntries(Object.entries(record(files, `components.json.items.${name}`)).map(([path, hash]) => [path, text(hash, `components.json.items.${name}.${path}`)]))]))
|
|
392
390
|
};
|
|
393
391
|
}
|
|
394
|
-
|
|
395
|
-
//#region src/config.ts
|
|
392
|
+
// src/config.ts
|
|
396
393
|
/**
|
|
397
394
|
* `components.json`: finding it, reading it, writing it back.
|
|
398
395
|
*
|
|
@@ -442,8 +439,7 @@ function requireConfig(cwd) {
|
|
|
442
439
|
config: readConfig(root)
|
|
443
440
|
};
|
|
444
441
|
}
|
|
445
|
-
|
|
446
|
-
//#region src/project.ts
|
|
442
|
+
// src/project.ts
|
|
447
443
|
/**
|
|
448
444
|
* What the project already has, and the package manager that gives it more.
|
|
449
445
|
*
|
|
@@ -520,8 +516,7 @@ function install(root, packages, options = {}) {
|
|
|
520
516
|
if (result.error !== void 0) throw new Error(`could not run ${command}: ${result.error.message}\nRun it yourself: ${[command, ...args].join(" ")}`);
|
|
521
517
|
if (result.status !== 0) throw new Error(`${[command, ...args].join(" ")} exited with ${String(result.status)}.\nThe files were written; the packages were not installed.`);
|
|
522
518
|
}
|
|
523
|
-
|
|
524
|
-
//#region src/registry.ts
|
|
519
|
+
// src/registry.ts
|
|
525
520
|
/**
|
|
526
521
|
* Where an item comes from, and what else it needs.
|
|
527
522
|
*
|
|
@@ -662,8 +657,7 @@ async function resolveItems(registries, addresses) {
|
|
|
662
657
|
for (const address of addresses) await visit(address);
|
|
663
658
|
return out;
|
|
664
659
|
}
|
|
665
|
-
|
|
666
|
-
//#region src/theme.ts
|
|
660
|
+
// src/theme.ts
|
|
667
661
|
/**
|
|
668
662
|
* A chosen radius REPLACES the base's own, rather than following it.
|
|
669
663
|
*
|
|
@@ -806,8 +800,7 @@ ${darkRule}
|
|
|
806
800
|
\`;
|
|
807
801
|
`;
|
|
808
802
|
}
|
|
809
|
-
|
|
810
|
-
//#region src/diff.ts
|
|
803
|
+
// src/diff.ts
|
|
811
804
|
/** The edit script turning `before` into `after`. */
|
|
812
805
|
function diffLines(before, after) {
|
|
813
806
|
const n = before.length;
|
|
@@ -895,8 +888,7 @@ function unified(before, after, options = {}) {
|
|
|
895
888
|
});
|
|
896
889
|
return out.join("\n");
|
|
897
890
|
}
|
|
898
|
-
|
|
899
|
-
//#region src/tty.ts
|
|
891
|
+
// src/tty.ts
|
|
900
892
|
/**
|
|
901
893
|
* Writing to a terminal, and asking it a question.
|
|
902
894
|
*
|
|
@@ -986,8 +978,7 @@ function ask(allowed = true) {
|
|
|
986
978
|
}
|
|
987
979
|
};
|
|
988
980
|
}
|
|
989
|
-
|
|
990
|
-
//#region src/index.ts
|
|
981
|
+
// src/index.ts
|
|
991
982
|
/**
|
|
992
983
|
* `barq-ui` — copy barq's components into a project, and keep them in
|
|
993
984
|
* sync with the registry they came from.
|
|
@@ -1721,7 +1712,7 @@ async function chooseStyle(args) {
|
|
|
1721
1712
|
async function build(args) {
|
|
1722
1713
|
const directory = args.rest[0];
|
|
1723
1714
|
if (directory === void 0) throw new Error("which directory? `barq-ui build ./src/ui`");
|
|
1724
|
-
const { buildRegistry } = await import("./build-
|
|
1715
|
+
const { buildRegistry } = await import("./build-C65qsG0d.js");
|
|
1725
1716
|
const written = buildRegistry(resolve(args.cwd, directory), resolve(args.cwd, "registry"));
|
|
1726
1717
|
say(`${green("Built")} ${String(written)} items into registry/`);
|
|
1727
1718
|
}
|
|
@@ -1767,5 +1758,4 @@ function invokedDirectly() {
|
|
|
1767
1758
|
return script !== void 0 && realpathSync(script) === fileURLToPath(import.meta.url);
|
|
1768
1759
|
}
|
|
1769
1760
|
if (invokedDirectly()) await run();
|
|
1770
|
-
//#endregion
|
|
1771
1761
|
export { run };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barqjs/ui-cli",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.1",
|
|
4
4
|
"description": "Copy @barqjs/ui components into your project, and keep them in sync",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"barq",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"test": "bun test --timeout 60000"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@types/bun": "^1.4.
|
|
55
|
+
"@types/bun": "^1.4.4",
|
|
56
56
|
"typescript": "^7.0.2"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|