liasse 0.3.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/LICENSE +21 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +284 -0
- package/dist/index.js.map +1 -0
- package/package.json +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Liasse
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { spawnSync } from "child_process";
|
|
5
|
+
import { existsSync as existsSync3 } from "fs";
|
|
6
|
+
import { join as join3 } from "path";
|
|
7
|
+
import * as p from "@clack/prompts";
|
|
8
|
+
import { Command } from "commander";
|
|
9
|
+
|
|
10
|
+
// src/add.ts
|
|
11
|
+
import { existsSync as existsSync2, mkdirSync, writeFileSync } from "fs";
|
|
12
|
+
import { dirname as dirname2, join as join2, resolve as resolve2 } from "path";
|
|
13
|
+
|
|
14
|
+
// src/registry.ts
|
|
15
|
+
import { existsSync, readFileSync, statSync } from "fs";
|
|
16
|
+
import { dirname, isAbsolute, join, resolve } from "path";
|
|
17
|
+
import { fileURLToPath } from "url";
|
|
18
|
+
var DEFAULT_REGISTRY_URL = "https://liasse.tnjl.me/registry/registry.json";
|
|
19
|
+
var DEFAULT_PRO_REGISTRY_URL = "https://liasse.tnjl.me/api/registry/pro";
|
|
20
|
+
function resolveSource(explicit) {
|
|
21
|
+
if (explicit) return explicit;
|
|
22
|
+
if (process.env.LIASSE_REGISTRY) return process.env.LIASSE_REGISTRY;
|
|
23
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
for (const start of [here, process.cwd()]) {
|
|
25
|
+
let dir = start;
|
|
26
|
+
for (let i = 0; i < 6; i++) {
|
|
27
|
+
for (const candidate of [
|
|
28
|
+
join(dir, "registry.json"),
|
|
29
|
+
join(dir, "registry", "registry.json"),
|
|
30
|
+
join(dir, "dist", "registry.json")
|
|
31
|
+
]) {
|
|
32
|
+
if (existsSync(candidate)) return candidate;
|
|
33
|
+
}
|
|
34
|
+
const parent = dirname(dir);
|
|
35
|
+
if (parent === dir) break;
|
|
36
|
+
dir = parent;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return DEFAULT_REGISTRY_URL;
|
|
40
|
+
}
|
|
41
|
+
function isUrl(source) {
|
|
42
|
+
return /^https?:\/\//i.test(source);
|
|
43
|
+
}
|
|
44
|
+
async function loadRegistry(explicit) {
|
|
45
|
+
const source = resolveSource(explicit);
|
|
46
|
+
let raw;
|
|
47
|
+
if (isUrl(source)) {
|
|
48
|
+
const res = await fetch(source);
|
|
49
|
+
if (!res.ok) {
|
|
50
|
+
throw new Error(`Failed to fetch registry from ${source} (${res.status})`);
|
|
51
|
+
}
|
|
52
|
+
raw = await res.text();
|
|
53
|
+
} else {
|
|
54
|
+
let filePath = isAbsolute(source) ? source : resolve(process.cwd(), source);
|
|
55
|
+
if (existsSync(filePath) && statSync(filePath).isDirectory()) {
|
|
56
|
+
filePath = join(filePath, "registry.json");
|
|
57
|
+
}
|
|
58
|
+
if (!existsSync(filePath)) {
|
|
59
|
+
throw new Error(`Registry file not found: ${filePath}`);
|
|
60
|
+
}
|
|
61
|
+
raw = readFileSync(filePath, "utf8");
|
|
62
|
+
}
|
|
63
|
+
let registry;
|
|
64
|
+
try {
|
|
65
|
+
registry = JSON.parse(raw);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
throw new Error(`Invalid registry JSON from ${source}: ${err.message}`);
|
|
68
|
+
}
|
|
69
|
+
if (!registry.components || typeof registry.components !== "object") {
|
|
70
|
+
throw new Error(`Registry from ${source} has no "components" map`);
|
|
71
|
+
}
|
|
72
|
+
return { registry, source };
|
|
73
|
+
}
|
|
74
|
+
function resolveProSource(explicit) {
|
|
75
|
+
return explicit ?? process.env.LIASSE_REGISTRY_PRO ?? DEFAULT_PRO_REGISTRY_URL;
|
|
76
|
+
}
|
|
77
|
+
async function fetchProComponents(names, options) {
|
|
78
|
+
const base = resolveProSource(options.proRegistryUrl);
|
|
79
|
+
const url = new URL(base);
|
|
80
|
+
url.searchParams.set("components", names.join(","));
|
|
81
|
+
let res;
|
|
82
|
+
try {
|
|
83
|
+
res = await fetch(url, { headers: { authorization: `Bearer ${options.token}` } });
|
|
84
|
+
} catch (err) {
|
|
85
|
+
throw new Error(`Could not reach the Pro registry at ${base}: ${err.message}`);
|
|
86
|
+
}
|
|
87
|
+
if (res.status === 401) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
"License key rejected (401). Check your --token value (or the LIASSE_TOKEN env var)."
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
if (res.status === 403) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`Your license does not include ${names.length > 1 ? "one of these components" : `"${names[0]}"`} (403).`
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
if (res.status === 404) {
|
|
98
|
+
throw new Error(`Unknown Pro component among: ${names.join(", ")} (404).`);
|
|
99
|
+
}
|
|
100
|
+
if (!res.ok) {
|
|
101
|
+
throw new Error(`Failed to fetch the Pro registry from ${base} (${res.status}).`);
|
|
102
|
+
}
|
|
103
|
+
const data = await res.json();
|
|
104
|
+
if (!data.components || typeof data.components !== "object") {
|
|
105
|
+
throw new Error(`Pro registry from ${base} returned no "components".`);
|
|
106
|
+
}
|
|
107
|
+
return data.components;
|
|
108
|
+
}
|
|
109
|
+
function resolveComponents(registry, names) {
|
|
110
|
+
const ordered = [];
|
|
111
|
+
const seen = /* @__PURE__ */ new Set();
|
|
112
|
+
const visit = (name, trail) => {
|
|
113
|
+
if (seen.has(name)) return;
|
|
114
|
+
const component = registry.components[name];
|
|
115
|
+
if (!component) {
|
|
116
|
+
const available = Object.keys(registry.components).sort().join(", ");
|
|
117
|
+
throw new Error(`Unknown component "${name}". Available: ${available}`);
|
|
118
|
+
}
|
|
119
|
+
if (trail.includes(name)) return;
|
|
120
|
+
for (const dep of component.registryDependencies ?? []) {
|
|
121
|
+
visit(dep, [...trail, name]);
|
|
122
|
+
}
|
|
123
|
+
seen.add(name);
|
|
124
|
+
ordered.push(component);
|
|
125
|
+
};
|
|
126
|
+
for (const name of names) visit(name, []);
|
|
127
|
+
return ordered;
|
|
128
|
+
}
|
|
129
|
+
function collectDependencies(components) {
|
|
130
|
+
const deps = /* @__PURE__ */ new Set();
|
|
131
|
+
for (const c of components) {
|
|
132
|
+
for (const d of c.dependencies ?? []) deps.add(d);
|
|
133
|
+
}
|
|
134
|
+
return [...deps].sort();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/add.ts
|
|
138
|
+
async function addComponents(options) {
|
|
139
|
+
const cwd = options.cwd ? resolve2(options.cwd) : process.cwd();
|
|
140
|
+
const registry = options.registry ?? (await loadRegistry(options.registrySource)).registry;
|
|
141
|
+
const components = resolveComponents(registry, options.components);
|
|
142
|
+
const targetDir = options.targetDir ?? registry.targetDir ?? "src/liasse";
|
|
143
|
+
const proPending = components.filter((c) => c.pro && (!c.files || c.files.length === 0));
|
|
144
|
+
if (proPending.length > 0) {
|
|
145
|
+
if (!options.token) {
|
|
146
|
+
const names = proPending.map((c) => c.name).join(", ");
|
|
147
|
+
throw new Error(
|
|
148
|
+
`${names} ${proPending.length > 1 ? "are Pro components" : "is a Pro component"}. Pass your license key with --token <key> (or set LIASSE_TOKEN).`
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
const fetched = await fetchProComponents(
|
|
152
|
+
proPending.map((c) => c.name),
|
|
153
|
+
{ token: options.token, ...options.proRegistryUrl ? { proRegistryUrl: options.proRegistryUrl } : {} }
|
|
154
|
+
);
|
|
155
|
+
for (const component of proPending) {
|
|
156
|
+
const full = fetched[component.name];
|
|
157
|
+
if (!full || !full.files || full.files.length === 0) {
|
|
158
|
+
throw new Error(`Pro endpoint returned no files for "${component.name}".`);
|
|
159
|
+
}
|
|
160
|
+
component.files = full.files;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const written = [];
|
|
164
|
+
for (const component of components) {
|
|
165
|
+
for (const file of component.files) {
|
|
166
|
+
const relPath = join2(targetDir, file.path);
|
|
167
|
+
const absPath = join2(cwd, relPath);
|
|
168
|
+
const exists = existsSync2(absPath);
|
|
169
|
+
if (exists && !options.force) {
|
|
170
|
+
written.push({ path: relPath, absPath, skipped: true });
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
mkdirSync(dirname2(absPath), { recursive: true });
|
|
174
|
+
writeFileSync(absPath, file.content, "utf8");
|
|
175
|
+
written.push({ path: relPath, absPath, skipped: false });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
components: components.map((c) => c.name),
|
|
180
|
+
written,
|
|
181
|
+
dependencies: collectDependencies(components),
|
|
182
|
+
targetDir
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// src/index.ts
|
|
187
|
+
var VERSION = true ? "0.3.0" : "0.0.0";
|
|
188
|
+
function detectPackageManager(cwd) {
|
|
189
|
+
if (existsSync3(join3(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
190
|
+
if (existsSync3(join3(cwd, "yarn.lock"))) return "yarn";
|
|
191
|
+
if (existsSync3(join3(cwd, "bun.lockb"))) return "bun";
|
|
192
|
+
return "npm";
|
|
193
|
+
}
|
|
194
|
+
function installCommand(pm, deps) {
|
|
195
|
+
if (pm === "npm") return { cmd: "npm", args: ["install", ...deps] };
|
|
196
|
+
if (pm === "yarn") return { cmd: "yarn", args: ["add", ...deps] };
|
|
197
|
+
return { cmd: pm, args: ["add", ...deps] };
|
|
198
|
+
}
|
|
199
|
+
var program = new Command();
|
|
200
|
+
program.name("liasse").description("Office-as-code: copy Liasse components into your repo, shadcn-style.").version(VERSION);
|
|
201
|
+
program.command("add", { isDefault: true }).description("Add one or more components to your project").argument("[components...]", "component names to add").option("-c, --cwd <dir>", "project root", process.cwd()).option("-d, --dir <dir>", "target directory for component files (default: src/liasse)").option("-r, --registry <source>", "registry path, directory or URL").option("-t, --token <key>", "license key for Pro components (or set LIASSE_TOKEN)").option("--pro-registry <source>", "gated Pro registry URL (or set LIASSE_REGISTRY_PRO)").option("-f, --force", "overwrite existing files", false).option("--no-install", "skip installing npm dependencies").action(async (components, opts) => {
|
|
202
|
+
p.intro("liasse");
|
|
203
|
+
let registry;
|
|
204
|
+
try {
|
|
205
|
+
registry = (await loadRegistry(opts.registry)).registry;
|
|
206
|
+
} catch (err) {
|
|
207
|
+
p.cancel(err.message);
|
|
208
|
+
process.exitCode = 1;
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
let selected = components;
|
|
212
|
+
if (!selected || selected.length === 0) {
|
|
213
|
+
const choice = await p.multiselect({
|
|
214
|
+
message: "Which components do you want to add?",
|
|
215
|
+
options: Object.values(registry.components).map((c) => ({
|
|
216
|
+
value: c.name,
|
|
217
|
+
label: c.name,
|
|
218
|
+
hint: c.description
|
|
219
|
+
})),
|
|
220
|
+
required: true
|
|
221
|
+
});
|
|
222
|
+
if (p.isCancel(choice)) {
|
|
223
|
+
p.cancel("Cancelled.");
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
selected = choice;
|
|
227
|
+
}
|
|
228
|
+
const spinner2 = p.spinner();
|
|
229
|
+
spinner2.start("Copying component files");
|
|
230
|
+
const token = opts.token ?? process.env.LIASSE_TOKEN;
|
|
231
|
+
const proSelected = selected.filter((name) => registry.components[name]?.pro);
|
|
232
|
+
if (proSelected.length > 0) {
|
|
233
|
+
p.log.info(
|
|
234
|
+
`Pro component(s): ${proSelected.join(", ")} \u2014 fetched from the gated registry with your license key.`
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
let result;
|
|
238
|
+
try {
|
|
239
|
+
result = await addComponents({
|
|
240
|
+
components: selected,
|
|
241
|
+
cwd: opts.cwd,
|
|
242
|
+
targetDir: opts.dir,
|
|
243
|
+
registry,
|
|
244
|
+
force: opts.force,
|
|
245
|
+
...token ? { token } : {},
|
|
246
|
+
...opts.proRegistry ? { proRegistryUrl: opts.proRegistry } : {}
|
|
247
|
+
});
|
|
248
|
+
} catch (err) {
|
|
249
|
+
spinner2.stop("Failed");
|
|
250
|
+
p.cancel(err.message);
|
|
251
|
+
process.exitCode = 1;
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
const added = result.written.filter((f) => !f.skipped);
|
|
255
|
+
const skipped = result.written.filter((f) => f.skipped);
|
|
256
|
+
spinner2.stop(`Added ${added.length} file(s) under ${result.targetDir}/`);
|
|
257
|
+
for (const f of added) p.log.success(f.path);
|
|
258
|
+
for (const f of skipped) p.log.warn(`${f.path} (exists \u2014 use --force to overwrite)`);
|
|
259
|
+
if (result.dependencies.length > 0) {
|
|
260
|
+
if (opts.install === false) {
|
|
261
|
+
p.log.info(`Dependencies to install: ${result.dependencies.join(", ")}`);
|
|
262
|
+
} else {
|
|
263
|
+
const pm = detectPackageManager(opts.cwd);
|
|
264
|
+
const confirmed = await p.confirm({
|
|
265
|
+
message: `Install ${result.dependencies.join(", ")} with ${pm}?`
|
|
266
|
+
});
|
|
267
|
+
if (!p.isCancel(confirmed) && confirmed) {
|
|
268
|
+
const { cmd, args } = installCommand(pm, result.dependencies);
|
|
269
|
+
const ran = spawnSync(cmd, args, { cwd: opts.cwd, stdio: "inherit" });
|
|
270
|
+
if (ran.status !== 0) {
|
|
271
|
+
p.log.warn(`"${cmd} ${args.join(" ")}" did not complete cleanly.`);
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
p.log.info(`Skipped. Install later: ${result.dependencies.join(", ")}`);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
p.outro(`Done \u2014 ${result.components.join(", ")} now lives in your repo.`);
|
|
279
|
+
});
|
|
280
|
+
program.parseAsync().catch((err) => {
|
|
281
|
+
console.error(err instanceof Error ? err.message : err);
|
|
282
|
+
process.exitCode = 1;
|
|
283
|
+
});
|
|
284
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/add.ts","../src/registry.ts"],"sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { Command } from \"commander\";\nimport { addComponents } from \"./add.js\";\nimport { loadRegistry } from \"./registry.js\";\n\n// Replaced at build time by tsup's `define` with the package.json version.\ndeclare const __CLI_VERSION__: string;\nconst VERSION = typeof __CLI_VERSION__ === \"string\" ? __CLI_VERSION__ : \"0.0.0\";\n\nfunction detectPackageManager(cwd: string): \"pnpm\" | \"yarn\" | \"bun\" | \"npm\" {\n if (existsSync(join(cwd, \"pnpm-lock.yaml\"))) return \"pnpm\";\n if (existsSync(join(cwd, \"yarn.lock\"))) return \"yarn\";\n if (existsSync(join(cwd, \"bun.lockb\"))) return \"bun\";\n return \"npm\";\n}\n\nfunction installCommand(pm: string, deps: string[]): { cmd: string; args: string[] } {\n if (pm === \"npm\") return { cmd: \"npm\", args: [\"install\", ...deps] };\n if (pm === \"yarn\") return { cmd: \"yarn\", args: [\"add\", ...deps] };\n return { cmd: pm, args: [\"add\", ...deps] }; // pnpm, bun\n}\n\nconst program = new Command();\n\nprogram\n .name(\"liasse\")\n .description(\"Office-as-code: copy Liasse components into your repo, shadcn-style.\")\n .version(VERSION);\n\nprogram\n .command(\"add\", { isDefault: true })\n .description(\"Add one or more components to your project\")\n .argument(\"[components...]\", \"component names to add\")\n .option(\"-c, --cwd <dir>\", \"project root\", process.cwd())\n .option(\"-d, --dir <dir>\", \"target directory for component files (default: src/liasse)\")\n .option(\"-r, --registry <source>\", \"registry path, directory or URL\")\n .option(\"-t, --token <key>\", \"license key for Pro components (or set LIASSE_TOKEN)\")\n .option(\"--pro-registry <source>\", \"gated Pro registry URL (or set LIASSE_REGISTRY_PRO)\")\n .option(\"-f, --force\", \"overwrite existing files\", false)\n .option(\"--no-install\", \"skip installing npm dependencies\")\n .action(async (components: string[], opts) => {\n p.intro(\"liasse\");\n\n let registry;\n try {\n registry = (await loadRegistry(opts.registry)).registry;\n } catch (err) {\n p.cancel((err as Error).message);\n process.exitCode = 1;\n return;\n }\n\n let selected = components;\n if (!selected || selected.length === 0) {\n const choice = await p.multiselect({\n message: \"Which components do you want to add?\",\n options: Object.values(registry.components).map((c) => ({\n value: c.name,\n label: c.name,\n hint: c.description,\n })),\n required: true,\n });\n if (p.isCancel(choice)) {\n p.cancel(\"Cancelled.\");\n return;\n }\n selected = choice as string[];\n }\n\n const spinner = p.spinner();\n spinner.start(\"Copying component files\");\n\n const token = opts.token ?? process.env.LIASSE_TOKEN;\n const proSelected = selected.filter((name) => registry.components[name]?.pro);\n if (proSelected.length > 0) {\n p.log.info(\n `Pro component(s): ${proSelected.join(\", \")} — fetched from the gated registry with your license key.`,\n );\n }\n\n let result;\n try {\n result = await addComponents({\n components: selected,\n cwd: opts.cwd,\n targetDir: opts.dir,\n registry,\n force: opts.force,\n ...(token ? { token } : {}),\n ...(opts.proRegistry ? { proRegistryUrl: opts.proRegistry } : {}),\n });\n } catch (err) {\n spinner.stop(\"Failed\");\n p.cancel((err as Error).message);\n process.exitCode = 1;\n return;\n }\n\n const added = result.written.filter((f) => !f.skipped);\n const skipped = result.written.filter((f) => f.skipped);\n spinner.stop(`Added ${added.length} file(s) under ${result.targetDir}/`);\n\n for (const f of added) p.log.success(f.path);\n for (const f of skipped) p.log.warn(`${f.path} (exists — use --force to overwrite)`);\n\n if (result.dependencies.length > 0) {\n if (opts.install === false) {\n p.log.info(`Dependencies to install: ${result.dependencies.join(\", \")}`);\n } else {\n const pm = detectPackageManager(opts.cwd);\n const confirmed = await p.confirm({\n message: `Install ${result.dependencies.join(\", \")} with ${pm}?`,\n });\n if (!p.isCancel(confirmed) && confirmed) {\n const { cmd, args } = installCommand(pm, result.dependencies);\n const ran = spawnSync(cmd, args, { cwd: opts.cwd, stdio: \"inherit\" });\n if (ran.status !== 0) {\n p.log.warn(`\"${cmd} ${args.join(\" \")}\" did not complete cleanly.`);\n }\n } else {\n p.log.info(`Skipped. Install later: ${result.dependencies.join(\", \")}`);\n }\n }\n }\n\n p.outro(`Done — ${result.components.join(\", \")} now lives in your repo.`);\n });\n\nprogram.parseAsync().catch((err: unknown) => {\n console.error(err instanceof Error ? err.message : err);\n process.exitCode = 1;\n});\n","import { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport {\n collectDependencies,\n fetchProComponents,\n loadRegistry,\n resolveComponents,\n type Registry,\n type RegistryComponent,\n} from \"./registry.js\";\n\nexport interface AddOptions {\n components: string[];\n cwd?: string;\n /** Overrides `registry.targetDir`. Defaults to \"src/liasse\". */\n targetDir?: string;\n /** Registry source (path/dir/url). Ignored when `registry` is provided. */\n registrySource?: string;\n /** Pre-loaded registry (used in tests to avoid I/O). */\n registry?: Registry;\n /** License key for Pro components, sent to the gated endpoint. */\n token?: string;\n /** Override the gated Pro endpoint (path/url). Defaults to env or the CDN. */\n proRegistryUrl?: string;\n /** Overwrite files that already exist. */\n force?: boolean;\n}\n\nexport interface WrittenFile {\n /** Path relative to cwd. */\n path: string;\n absPath: string;\n skipped: boolean;\n}\n\nexport interface AddResult {\n components: string[];\n written: WrittenFile[];\n dependencies: string[];\n targetDir: string;\n}\n\n/**\n * Copy the requested components' source files into the user's repo. Pure file\n * I/O — never installs packages (the caller decides) — so it is easy to test.\n */\nexport async function addComponents(options: AddOptions): Promise<AddResult> {\n const cwd = options.cwd ? resolve(options.cwd) : process.cwd();\n\n const registry =\n options.registry ?? (await loadRegistry(options.registrySource)).registry;\n\n const components: RegistryComponent[] = resolveComponents(registry, options.components);\n const targetDir = options.targetDir ?? registry.targetDir ?? \"src/liasse\";\n\n // Pro components are listed in the public index without `files`; fetch their\n // source from the gated endpoint using the license token.\n const proPending = components.filter((c) => c.pro && (!c.files || c.files.length === 0));\n if (proPending.length > 0) {\n if (!options.token) {\n const names = proPending.map((c) => c.name).join(\", \");\n throw new Error(\n `${names} ${proPending.length > 1 ? \"are Pro components\" : \"is a Pro component\"}. ` +\n \"Pass your license key with --token <key> (or set LIASSE_TOKEN).\",\n );\n }\n const fetched = await fetchProComponents(\n proPending.map((c) => c.name),\n { token: options.token, ...(options.proRegistryUrl ? { proRegistryUrl: options.proRegistryUrl } : {}) },\n );\n for (const component of proPending) {\n const full = fetched[component.name];\n if (!full || !full.files || full.files.length === 0) {\n throw new Error(`Pro endpoint returned no files for \"${component.name}\".`);\n }\n component.files = full.files;\n }\n }\n\n const written: WrittenFile[] = [];\n for (const component of components) {\n for (const file of component.files) {\n const relPath = join(targetDir, file.path);\n const absPath = join(cwd, relPath);\n const exists = existsSync(absPath);\n if (exists && !options.force) {\n written.push({ path: relPath, absPath, skipped: true });\n continue;\n }\n mkdirSync(dirname(absPath), { recursive: true });\n writeFileSync(absPath, file.content, \"utf8\");\n written.push({ path: relPath, absPath, skipped: false });\n }\n }\n\n return {\n components: components.map((c) => c.name),\n written,\n dependencies: collectDependencies(components),\n targetDir,\n };\n}\n","import { existsSync, readFileSync, statSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/** A single file shipped by a registry component. */\nexport interface RegistryFile {\n /** Path relative to the target base dir, e.g. `components/financial-table.ts`. */\n path: string;\n content: string;\n}\n\nexport interface RegistryComponent {\n name: string;\n version?: string;\n description?: string;\n /** npm packages this component needs at runtime. */\n dependencies?: string[];\n /** Other registry components this one depends on. */\n registryDependencies?: string[];\n /**\n * Paid component: the public index lists it without `files`; the source is\n * fetched from the gated Pro endpoint with a license token.\n */\n pro?: boolean;\n files: RegistryFile[];\n}\n\nexport interface Registry {\n $schema?: string;\n version?: number;\n /** Default base dir (relative to cwd) where files are written. */\n targetDir?: string;\n components: Record<string, RegistryComponent>;\n}\n\nconst DEFAULT_REGISTRY_URL = \"https://liasse.tnjl.me/registry/registry.json\";\nconst DEFAULT_PRO_REGISTRY_URL = \"https://liasse.tnjl.me/api/registry/pro\";\n\n/** Resolve where to load the registry from, honouring flag → env → discovery. */\nfunction resolveSource(explicit?: string): string {\n if (explicit) return explicit;\n if (process.env.LIASSE_REGISTRY) return process.env.LIASSE_REGISTRY;\n\n // Walk up from this module and from cwd looking for a local registry.\n const here = dirname(fileURLToPath(import.meta.url));\n for (const start of [here, process.cwd()]) {\n let dir = start;\n for (let i = 0; i < 6; i++) {\n for (const candidate of [\n join(dir, \"registry.json\"),\n join(dir, \"registry\", \"registry.json\"),\n join(dir, \"dist\", \"registry.json\"),\n ]) {\n if (existsSync(candidate)) return candidate;\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n }\n return DEFAULT_REGISTRY_URL;\n}\n\nfunction isUrl(source: string): boolean {\n return /^https?:\\/\\//i.test(source);\n}\n\n/** Load and parse the registry from a file path, directory or URL. */\nexport async function loadRegistry(explicit?: string): Promise<{ registry: Registry; source: string }> {\n const source = resolveSource(explicit);\n\n let raw: string;\n if (isUrl(source)) {\n const res = await fetch(source);\n if (!res.ok) {\n throw new Error(`Failed to fetch registry from ${source} (${res.status})`);\n }\n raw = await res.text();\n } else {\n let filePath = isAbsolute(source) ? source : resolve(process.cwd(), source);\n if (existsSync(filePath) && statSync(filePath).isDirectory()) {\n filePath = join(filePath, \"registry.json\");\n }\n if (!existsSync(filePath)) {\n throw new Error(`Registry file not found: ${filePath}`);\n }\n raw = readFileSync(filePath, \"utf8\");\n }\n\n let registry: Registry;\n try {\n registry = JSON.parse(raw) as Registry;\n } catch (err) {\n throw new Error(`Invalid registry JSON from ${source}: ${(err as Error).message}`);\n }\n if (!registry.components || typeof registry.components !== \"object\") {\n throw new Error(`Registry from ${source} has no \"components\" map`);\n }\n return { registry, source };\n}\n\n/** Resolve the gated Pro endpoint, honouring an explicit override → env → default. */\nfunction resolveProSource(explicit?: string): string {\n return explicit ?? process.env.LIASSE_REGISTRY_PRO ?? DEFAULT_PRO_REGISTRY_URL;\n}\n\n/**\n * Fetch the source of the named Pro components from the gated endpoint, sending\n * the license token as `Authorization: Bearer`. Returns each component's full\n * entry (with `files`). Throws with actionable messages on 401/403/404.\n */\nexport async function fetchProComponents(\n names: string[],\n options: { token: string; proRegistryUrl?: string },\n): Promise<Record<string, RegistryComponent>> {\n const base = resolveProSource(options.proRegistryUrl);\n const url = new URL(base);\n url.searchParams.set(\"components\", names.join(\",\"));\n\n let res: Response;\n try {\n res = await fetch(url, { headers: { authorization: `Bearer ${options.token}` } });\n } catch (err) {\n throw new Error(`Could not reach the Pro registry at ${base}: ${(err as Error).message}`);\n }\n\n if (res.status === 401) {\n throw new Error(\n \"License key rejected (401). Check your --token value (or the LIASSE_TOKEN env var).\",\n );\n }\n if (res.status === 403) {\n throw new Error(\n `Your license does not include ${names.length > 1 ? \"one of these components\" : `\"${names[0]}\"`} (403).`,\n );\n }\n if (res.status === 404) {\n throw new Error(`Unknown Pro component among: ${names.join(\", \")} (404).`);\n }\n if (!res.ok) {\n throw new Error(`Failed to fetch the Pro registry from ${base} (${res.status}).`);\n }\n\n const data = (await res.json()) as Registry;\n if (!data.components || typeof data.components !== \"object\") {\n throw new Error(`Pro registry from ${base} returned no \"components\".`);\n }\n return data.components;\n}\n\n/**\n * Expand the requested component names, pulling in `registryDependencies`,\n * and return them de-duplicated with dependencies before dependents.\n */\nexport function resolveComponents(registry: Registry, names: string[]): RegistryComponent[] {\n const ordered: RegistryComponent[] = [];\n const seen = new Set<string>();\n\n const visit = (name: string, trail: string[]): void => {\n if (seen.has(name)) return;\n const component = registry.components[name];\n if (!component) {\n const available = Object.keys(registry.components).sort().join(\", \");\n throw new Error(`Unknown component \"${name}\". Available: ${available}`);\n }\n if (trail.includes(name)) return; // guard against cycles\n for (const dep of component.registryDependencies ?? []) {\n visit(dep, [...trail, name]);\n }\n seen.add(name);\n ordered.push(component);\n };\n\n for (const name of names) visit(name, []);\n return ordered;\n}\n\n/** All npm dependencies needed by a set of components, de-duplicated + sorted. */\nexport function collectDependencies(components: RegistryComponent[]): string[] {\n const deps = new Set<string>();\n for (const c of components) {\n for (const d of c.dependencies ?? []) deps.add(d);\n }\n return [...deps].sort();\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,cAAAA,mBAAkB;AAC3B,SAAS,QAAAC,aAAY;AACrB,YAAY,OAAO;AACnB,SAAS,eAAe;;;ACJxB,SAAS,cAAAC,aAAY,WAAW,qBAAqB;AACrD,SAAS,WAAAC,UAAS,QAAAC,OAAM,WAAAC,gBAAe;;;ACDvC,SAAS,Y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E,MAAM,CAAC,QAAiB;AAC3C,UAAQ,MAAM,eAAe,QAAQ,IAAI,UAAU,GAAG;AACtD,UAAQ,WAAW;AACrB,CAAC;","names":["existsSync","join","existsSync","dirname","join","resolve","resolve","join","existsSync","dirname","existsSync","join","spinner"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "liasse",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Liasse CLI — `liasse add <component>` copies a component's source into your repo from the Liasse registry (shadcn-style).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"liasse": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@clack/prompts": "^0.8.2",
|
|
17
|
+
"commander": "^12.1.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^22.10.2",
|
|
21
|
+
"tsup": "^8.3.5",
|
|
22
|
+
"typescript": "^5.7.2",
|
|
23
|
+
"vitest": "^2.1.8"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"test": "vitest run"
|
|
29
|
+
}
|
|
30
|
+
}
|