@modularcore/cli 0.2.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/commands/add.d.ts +15 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +66 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/diff.d.ts +14 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +40 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/init.d.ts +13 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +48 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +5 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +11 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/search.d.ts +4 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +9 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/update.d.ts +19 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +56 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +53 -0
- package/dist/config.js.map +1 -0
- package/dist/deps.d.ts +36 -0
- package/dist/deps.d.ts.map +1 -0
- package/dist/deps.js +93 -0
- package/dist/deps.js.map +1 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +31 -0
- package/dist/errors.js.map +1 -0
- package/dist/files.d.ts +23 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +124 -0
- package/dist/files.js.map +1 -0
- package/dist/format-error.d.ts +11 -0
- package/dist/format-error.d.ts.map +1 -0
- package/dist/format-error.js +18 -0
- package/dist/format-error.js.map +1 -0
- package/dist/framework-detect.d.ts +23 -0
- package/dist/framework-detect.d.ts.map +1 -0
- package/dist/framework-detect.js +70 -0
- package/dist/framework-detect.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +116 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +10 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +38 -0
- package/dist/install.js.map +1 -0
- package/dist/prompts.d.ts +19 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +39 -0
- package/dist/prompts.js.map +1 -0
- package/dist/registry-client.d.ts +8 -0
- package/dist/registry-client.d.ts.map +1 -0
- package/dist/registry-client.js +68 -0
- package/dist/registry-client.js.map +1 -0
- package/package.json +37 -0
package/dist/errors.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base for every error the CLI raises deliberately (validation gates, network,
|
|
3
|
+
* config). Kept distinct from unexpected exceptions so `index.ts` can print a
|
|
4
|
+
* clean message instead of a stack trace for known failure modes.
|
|
5
|
+
*/
|
|
6
|
+
export class CliError extends Error {
|
|
7
|
+
constructor(message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'CliError';
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class CompatibilityError extends CliError {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'CompatibilityError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class DependencyCycleError extends CliError {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = 'DependencyCycleError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Raised when a Clack prompt is cancelled (Ctrl+C / Esc) so callers can abort cleanly. */
|
|
25
|
+
export class PromptCancelledError extends CliError {
|
|
26
|
+
constructor() {
|
|
27
|
+
super('Operation cancelled.');
|
|
28
|
+
this.name = 'PromptCancelledError';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,QAAQ;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,MAAM,OAAO,oBAAqB,SAAQ,QAAQ;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED,2FAA2F;AAC3F,MAAM,OAAO,oBAAqB,SAAQ,QAAQ;IAChD;QACE,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF"}
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EnvVariableDescriptor, RegistryFileWithContent } from '@modularcore/registry';
|
|
2
|
+
export { remapTarget } from '@modularcore/registry-client';
|
|
3
|
+
export declare function decodeFileContent(file: RegistryFileWithContent): Buffer;
|
|
4
|
+
/** Idempotent by key: re-running `add`/`update` never duplicates an existing `.env.example` entry. */
|
|
5
|
+
export declare function appendEnvExample(projectRoot: string, envVariables: EnvVariableDescriptor[]): Promise<{
|
|
6
|
+
added: string[];
|
|
7
|
+
}>;
|
|
8
|
+
export declare function readLocalFile(path: string): Promise<string | undefined>;
|
|
9
|
+
/** Raw-byte read used for equality checks (`base64`-encoded/binary files must never be compared as decoded utf8 text). */
|
|
10
|
+
export declare function readLocalFileBuffer(path: string): Promise<Buffer | undefined>;
|
|
11
|
+
/** `update` backs up the pre-overwrite content so a bad update can be manually recovered. */
|
|
12
|
+
export declare function backupExisting(path: string): Promise<boolean>;
|
|
13
|
+
export interface DiffLine {
|
|
14
|
+
kind: 'same' | 'added' | 'removed';
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Minimal LCS-based line diff. Deliberately hand-rolled instead of adding a `diff`
|
|
19
|
+
* dependency — the CLI only needs a readable +/- listing for `diff`/`update`, not a
|
|
20
|
+
* general-purpose diff algorithm.
|
|
21
|
+
*/
|
|
22
|
+
export declare function diffLines(oldContent: string, newContent: string): DiffLine[];
|
|
23
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAK5F,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,uBAAuB,GAAG,MAAM,CAIvE;AAWD,sGAAsG;AACtG,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,qBAAqB,EAAE,GACpC,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAwB9B;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAM7E;AAED,0HAA0H;AAC1H,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAMnF;AAED,6FAA6F;AAC7F,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQnE;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACnC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,QAAQ,EAAE,CAqC5E"}
|
package/dist/files.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { copyFile, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { CliError } from './errors.js';
|
|
3
|
+
// `remapTarget` now lives in `@modularcore/registry-client` (shared by the CLI and the MCP
|
|
4
|
+
// server's `install_component`, which previously skipped it entirely — Code Review Finding,
|
|
5
|
+
// Critical) — re-exported here so `add.ts`/`diff.ts`/`update.ts` don't need an import-path change.
|
|
6
|
+
export { remapTarget } from '@modularcore/registry-client';
|
|
7
|
+
export function decodeFileContent(file) {
|
|
8
|
+
return file.encoding === 'base64'
|
|
9
|
+
? Buffer.from(file.content, 'base64')
|
|
10
|
+
: Buffer.from(file.content, 'utf8');
|
|
11
|
+
}
|
|
12
|
+
function parseEnvExampleKeys(content) {
|
|
13
|
+
const keys = new Set();
|
|
14
|
+
for (const line of content.split('\n')) {
|
|
15
|
+
const match = /^([A-Za-z_][A-Za-z0-9_]*)=/.exec(line.trim());
|
|
16
|
+
if (match?.[1])
|
|
17
|
+
keys.add(match[1]);
|
|
18
|
+
}
|
|
19
|
+
return keys;
|
|
20
|
+
}
|
|
21
|
+
/** Idempotent by key: re-running `add`/`update` never duplicates an existing `.env.example` entry. */
|
|
22
|
+
export async function appendEnvExample(projectRoot, envVariables) {
|
|
23
|
+
if (envVariables.length === 0)
|
|
24
|
+
return { added: [] };
|
|
25
|
+
const path = `${projectRoot}/.env.example`;
|
|
26
|
+
let existing = '';
|
|
27
|
+
try {
|
|
28
|
+
existing = await readFile(path, 'utf8');
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
existing = '';
|
|
32
|
+
}
|
|
33
|
+
const existingKeys = parseEnvExampleKeys(existing);
|
|
34
|
+
const additions = [];
|
|
35
|
+
const added = [];
|
|
36
|
+
for (const variable of envVariables) {
|
|
37
|
+
if (existingKeys.has(variable.key))
|
|
38
|
+
continue;
|
|
39
|
+
const requiredNote = variable.required ? 'required' : 'optional';
|
|
40
|
+
additions.push(`# ${variable.description} (${requiredNote})\n${variable.key}=`);
|
|
41
|
+
added.push(variable.key);
|
|
42
|
+
}
|
|
43
|
+
if (additions.length === 0)
|
|
44
|
+
return { added: [] };
|
|
45
|
+
const normalizedExisting = existing.length > 0 && !existing.endsWith('\n') ? `${existing}\n` : existing;
|
|
46
|
+
const next = `${normalizedExisting}${normalizedExisting.length > 0 ? '\n' : ''}${additions.join('\n\n')}\n`;
|
|
47
|
+
await writeFile(path, next, 'utf8');
|
|
48
|
+
return { added };
|
|
49
|
+
}
|
|
50
|
+
export async function readLocalFile(path) {
|
|
51
|
+
try {
|
|
52
|
+
return await readFile(path, 'utf8');
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** Raw-byte read used for equality checks (`base64`-encoded/binary files must never be compared as decoded utf8 text). */
|
|
59
|
+
export async function readLocalFileBuffer(path) {
|
|
60
|
+
try {
|
|
61
|
+
return await readFile(path);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** `update` backs up the pre-overwrite content so a bad update can be manually recovered. */
|
|
68
|
+
export async function backupExisting(path) {
|
|
69
|
+
try {
|
|
70
|
+
await copyFile(path, `${path}.orig`);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error.code === 'ENOENT')
|
|
75
|
+
return false;
|
|
76
|
+
throw new CliError(`No se pudo crear backup ".orig" de "${path}": ${error.message}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Minimal LCS-based line diff. Deliberately hand-rolled instead of adding a `diff`
|
|
81
|
+
* dependency — the CLI only needs a readable +/- listing for `diff`/`update`, not a
|
|
82
|
+
* general-purpose diff algorithm.
|
|
83
|
+
*/
|
|
84
|
+
export function diffLines(oldContent, newContent) {
|
|
85
|
+
const a = oldContent.split('\n');
|
|
86
|
+
const b = newContent.split('\n');
|
|
87
|
+
const m = a.length;
|
|
88
|
+
const n = b.length;
|
|
89
|
+
const lcs = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
|
|
90
|
+
for (let i = m - 1; i >= 0; i--) {
|
|
91
|
+
for (let j = n - 1; j >= 0; j--) {
|
|
92
|
+
lcs[i][j] =
|
|
93
|
+
a[i] === b[j] ? lcs[i + 1][j + 1] + 1 : Math.max(lcs[i + 1][j], lcs[i][j + 1]);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const result = [];
|
|
97
|
+
let i = 0;
|
|
98
|
+
let j = 0;
|
|
99
|
+
while (i < m && j < n) {
|
|
100
|
+
if (a[i] === b[j]) {
|
|
101
|
+
result.push({ kind: 'same', text: a[i] });
|
|
102
|
+
i++;
|
|
103
|
+
j++;
|
|
104
|
+
}
|
|
105
|
+
else if (lcs[i + 1][j] >= lcs[i][j + 1]) {
|
|
106
|
+
result.push({ kind: 'removed', text: a[i] });
|
|
107
|
+
i++;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
result.push({ kind: 'added', text: b[j] });
|
|
111
|
+
j++;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
while (i < m) {
|
|
115
|
+
result.push({ kind: 'removed', text: a[i] });
|
|
116
|
+
i++;
|
|
117
|
+
}
|
|
118
|
+
while (j < n) {
|
|
119
|
+
result.push({ kind: 'added', text: b[j] });
|
|
120
|
+
j++;
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.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AI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC;YAC9C,CAAC,EAAE,CAAC;QACN,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC;YAC5C,CAAC,EAAE,CAAC;QACN,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC;QAC9C,CAAC,EAAE,CAAC;IACN,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,CAAC;QAC5C,CAAC,EAAE,CAAC;IACN,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single-line clean message for every deliberate error the CLI raises (`CliError` and its
|
|
3
|
+
* subclasses) or that `@modularcore/registry-client` raises (network error, 404, invalid
|
|
4
|
+
* JSON, schema mismatch) — `undefined` for anything else, so the top-level catch in
|
|
5
|
+
* `index.ts` rethrows unexpected errors instead of hiding a real bug behind a fake "clean"
|
|
6
|
+
* message. Kept in its own module (instead of inline in `index.ts`, which runs `main()` as
|
|
7
|
+
* a side effect on import) so the 404-produces-a-clean-message contract has direct unit
|
|
8
|
+
* test coverage without spawning the CLI process.
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatCliTopLevelError(error: unknown): string | undefined;
|
|
11
|
+
//# sourceMappingURL=format-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-error.d.ts","sourceRoot":"","sources":["../src/format-error.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAKzE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RegistryClientError } from '@modularcore/registry-client';
|
|
2
|
+
import { CliError } from './errors.js';
|
|
3
|
+
/**
|
|
4
|
+
* Single-line clean message for every deliberate error the CLI raises (`CliError` and its
|
|
5
|
+
* subclasses) or that `@modularcore/registry-client` raises (network error, 404, invalid
|
|
6
|
+
* JSON, schema mismatch) — `undefined` for anything else, so the top-level catch in
|
|
7
|
+
* `index.ts` rethrows unexpected errors instead of hiding a real bug behind a fake "clean"
|
|
8
|
+
* message. Kept in its own module (instead of inline in `index.ts`, which runs `main()` as
|
|
9
|
+
* a side effect on import) so the 404-produces-a-clean-message contract has direct unit
|
|
10
|
+
* test coverage without spawning the CLI process.
|
|
11
|
+
*/
|
|
12
|
+
export function formatCliTopLevelError(error) {
|
|
13
|
+
if (error instanceof CliError || error instanceof RegistryClientError) {
|
|
14
|
+
return `[modularcore] ${error.message}`;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=format-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-error.js","sourceRoot":"","sources":["../src/format-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,IAAI,KAAK,YAAY,QAAQ,IAAI,KAAK,YAAY,mBAAmB,EAAE,CAAC;QACtE,OAAO,iBAAiB,KAAK,CAAC,OAAO,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type DetectedFramework = 'react' | 'svelte' | 'vue' | 'angular';
|
|
2
|
+
export type PackageManager = 'pnpm' | 'yarn' | 'bun' | 'npm';
|
|
3
|
+
export interface PackageJsonShape {
|
|
4
|
+
dependencies?: Record<string, string>;
|
|
5
|
+
devDependencies?: Record<string, string>;
|
|
6
|
+
peerDependencies?: Record<string, string>;
|
|
7
|
+
workspaces?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare function readPackageJson(cwd: string): Promise<PackageJsonShape | undefined>;
|
|
10
|
+
export interface FrameworkDetectionResult {
|
|
11
|
+
frameworks: DetectedFramework[];
|
|
12
|
+
packageJson: PackageJsonShape | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare function detectFrameworks(cwd: string): Promise<FrameworkDetectionResult>;
|
|
15
|
+
/**
|
|
16
|
+
* AD2: a bare `package.json` with a `workspaces` field (npm/yarn workspaces) is a
|
|
17
|
+
* monorepo root, not a single-framework app — detection from its own deps is
|
|
18
|
+
* meaningless there, so `init` must prompt instead of guessing.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isWorkspaceRoot(cwd: string): Promise<boolean>;
|
|
21
|
+
export declare function detectPackageManager(cwd: string): Promise<PackageManager>;
|
|
22
|
+
export declare function installedPeerVersion(pkg: PackageJsonShape | undefined, peerName: string): string | undefined;
|
|
23
|
+
//# sourceMappingURL=framework-detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-detect.d.ts","sourceRoot":"","sources":["../src/framework-detect.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AACvE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AASD,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAOxF;AAOD,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,WAAW,EAAE,gBAAgB,GAAG,SAAS,CAAC;CAC3C;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAQrF;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASnE;AASD,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAU/E;AAED,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,gBAAgB,GAAG,SAAS,EACjC,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,SAAS,CAGpB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const FRAMEWORK_MARKERS = {
|
|
4
|
+
react: 'react',
|
|
5
|
+
svelte: 'svelte',
|
|
6
|
+
vue: 'vue',
|
|
7
|
+
angular: '@angular/core',
|
|
8
|
+
};
|
|
9
|
+
export async function readPackageJson(cwd) {
|
|
10
|
+
try {
|
|
11
|
+
const raw = await readFile(join(cwd, 'package.json'), 'utf8');
|
|
12
|
+
return JSON.parse(raw);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Merges dependencies + devDependencies: a framework used only in dev (e.g. via a meta-framework) still counts as detected. */
|
|
19
|
+
function allDeclaredDeps(pkg) {
|
|
20
|
+
return { ...pkg.dependencies, ...pkg.devDependencies };
|
|
21
|
+
}
|
|
22
|
+
export async function detectFrameworks(cwd) {
|
|
23
|
+
const pkg = await readPackageJson(cwd);
|
|
24
|
+
if (!pkg)
|
|
25
|
+
return { frameworks: [], packageJson: undefined };
|
|
26
|
+
const deps = allDeclaredDeps(pkg);
|
|
27
|
+
const frameworks = Object.keys(FRAMEWORK_MARKERS).filter((framework) => FRAMEWORK_MARKERS[framework] in deps);
|
|
28
|
+
return { frameworks, packageJson: pkg };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* AD2: a bare `package.json` with a `workspaces` field (npm/yarn workspaces) is a
|
|
32
|
+
* monorepo root, not a single-framework app — detection from its own deps is
|
|
33
|
+
* meaningless there, so `init` must prompt instead of guessing.
|
|
34
|
+
*/
|
|
35
|
+
export async function isWorkspaceRoot(cwd) {
|
|
36
|
+
const pkg = await readPackageJson(cwd);
|
|
37
|
+
if (pkg?.workspaces !== undefined)
|
|
38
|
+
return true;
|
|
39
|
+
try {
|
|
40
|
+
await readFile(join(cwd, 'pnpm-workspace.yaml'), 'utf8');
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const LOCKFILE_BY_MANAGER = [
|
|
48
|
+
['pnpm-lock.yaml', 'pnpm'],
|
|
49
|
+
['yarn.lock', 'yarn'],
|
|
50
|
+
['bun.lockb', 'bun'],
|
|
51
|
+
['package-lock.json', 'npm'],
|
|
52
|
+
];
|
|
53
|
+
export async function detectPackageManager(cwd) {
|
|
54
|
+
for (const [lockfile, manager] of LOCKFILE_BY_MANAGER) {
|
|
55
|
+
try {
|
|
56
|
+
await readFile(join(cwd, lockfile), 'utf8');
|
|
57
|
+
return manager;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// try next lockfile
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return 'npm';
|
|
64
|
+
}
|
|
65
|
+
export function installedPeerVersion(pkg, peerName) {
|
|
66
|
+
if (!pkg)
|
|
67
|
+
return undefined;
|
|
68
|
+
return allDeclaredDeps(pkg)[peerName];
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=framework-detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-detect.js","sourceRoot":"","sources":["../src/framework-detect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAYjC,MAAM,iBAAiB,GAAsC;IAC3D,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,eAAe;CACzB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW;IAC/C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAqB,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,gIAAgI;AAChI,SAAS,eAAe,CAAC,GAAqB;IAC5C,OAAO,EAAE,GAAG,GAAG,CAAC,YAAY,EAAE,GAAG,GAAG,CAAC,eAAe,EAAE,CAAC;AACzD,CAAC;AAOD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAW;IAChD,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,UAAU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C;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,GAAiC,EACjC,QAAgB;IAEhB,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;AACxC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import { runAdd } from './commands/add.js';
|
|
7
|
+
import { runDiff, formatDiffLines } from './commands/diff.js';
|
|
8
|
+
import { runInit } from './commands/init.js';
|
|
9
|
+
import { formatIndexEntries, runList } from './commands/list.js';
|
|
10
|
+
import { runSearch } from './commands/search.js';
|
|
11
|
+
import { runUpdate } from './commands/update.js';
|
|
12
|
+
import { readProjectConfig } from './config.js';
|
|
13
|
+
import { formatCliTopLevelError } from './format-error.js';
|
|
14
|
+
import { clackPromptAdapter } from './prompts.js';
|
|
15
|
+
import { createRegistryClient } from '@modularcore/registry-client';
|
|
16
|
+
/**
|
|
17
|
+
* AD7: Node < 18 has no global `fetch`; fail fast with an actionable message instead of
|
|
18
|
+
* an opaque `fetch is not defined` deep inside `@modularcore/registry-client`.
|
|
19
|
+
*/
|
|
20
|
+
if (typeof fetch !== 'function') {
|
|
21
|
+
console.error('[modularcore] Este CLI requiere Node.js >=18 (con `fetch` global). Actualiza tu versión de Node.');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
async function readCliVersion() {
|
|
25
|
+
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const raw = await readFile(join(scriptDir, '..', 'package.json'), 'utf8');
|
|
27
|
+
return JSON.parse(raw).version;
|
|
28
|
+
}
|
|
29
|
+
async function clientForCwd(cwd) {
|
|
30
|
+
const config = await readProjectConfig(cwd);
|
|
31
|
+
return { client: createRegistryClient(config.registryUrl), config };
|
|
32
|
+
}
|
|
33
|
+
async function main() {
|
|
34
|
+
const program = new Command();
|
|
35
|
+
program
|
|
36
|
+
.name('modularcore')
|
|
37
|
+
.description('CLI thin client for the ModularCore component registry')
|
|
38
|
+
.version(await readCliVersion());
|
|
39
|
+
program
|
|
40
|
+
.command('init')
|
|
41
|
+
.description('Detect framework/package manager and write modularcore.json')
|
|
42
|
+
.action(async () => {
|
|
43
|
+
await runInit({ cwd: process.cwd(), prompts: clackPromptAdapter });
|
|
44
|
+
});
|
|
45
|
+
program
|
|
46
|
+
.command('add <name>')
|
|
47
|
+
.description('Fetch a component, resolve its dependencies, and write its files')
|
|
48
|
+
.action(async (name) => {
|
|
49
|
+
const cwd = process.cwd();
|
|
50
|
+
const { client } = await clientForCwd(cwd);
|
|
51
|
+
const result = await runAdd(name, { cwd, client, prompts: clackPromptAdapter });
|
|
52
|
+
console.log(`Instalado: ${result.installedComponents.join(', ')}\n` +
|
|
53
|
+
`Archivos escritos: ${result.filesWritten.length}\n` +
|
|
54
|
+
(result.envKeysAdded.length > 0
|
|
55
|
+
? `.env.example: agregadas ${result.envKeysAdded.join(', ')}`
|
|
56
|
+
: '.env.example: sin cambios'));
|
|
57
|
+
});
|
|
58
|
+
program
|
|
59
|
+
.command('list')
|
|
60
|
+
.description('List public components in the registry')
|
|
61
|
+
.action(async () => {
|
|
62
|
+
const cwd = process.cwd();
|
|
63
|
+
const { client } = await clientForCwd(cwd);
|
|
64
|
+
console.log(formatIndexEntries(await runList(client)));
|
|
65
|
+
});
|
|
66
|
+
program
|
|
67
|
+
.command('search <query>')
|
|
68
|
+
.description('Search public components by name/title/category/description')
|
|
69
|
+
.action(async (query) => {
|
|
70
|
+
const cwd = process.cwd();
|
|
71
|
+
const { client } = await clientForCwd(cwd);
|
|
72
|
+
console.log(formatIndexEntries(await runSearch(client, query)));
|
|
73
|
+
});
|
|
74
|
+
program
|
|
75
|
+
.command('diff <name>')
|
|
76
|
+
.description('Show differences between the local files and the registry version')
|
|
77
|
+
.action(async (name) => {
|
|
78
|
+
const cwd = process.cwd();
|
|
79
|
+
const { client } = await clientForCwd(cwd);
|
|
80
|
+
const result = await runDiff(client, name, cwd);
|
|
81
|
+
for (const file of result.files) {
|
|
82
|
+
console.log(`--- ${file.target} (${file.status})`);
|
|
83
|
+
if (file.lines)
|
|
84
|
+
console.log(formatDiffLines(file.lines));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
program
|
|
88
|
+
.command('update [name]')
|
|
89
|
+
.description('Re-inject files with per-file confirmation and .orig backups')
|
|
90
|
+
.action(async (name) => {
|
|
91
|
+
const cwd = process.cwd();
|
|
92
|
+
const { client } = await clientForCwd(cwd);
|
|
93
|
+
const results = await runUpdate(name, { cwd, client, prompts: clackPromptAdapter });
|
|
94
|
+
for (const result of results) {
|
|
95
|
+
for (const file of result.files) {
|
|
96
|
+
console.log(`${file.action}${file.backedUp ? ' (backup .orig creado)' : ''}: ${file.target}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
try {
|
|
101
|
+
await program.parseAsync(process.argv);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const formatted = formatCliTopLevelError(error);
|
|
105
|
+
if (formatted !== undefined) {
|
|
106
|
+
console.error(formatted);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
main().catch((error) => {
|
|
113
|
+
console.error('[modularcore] Unexpected error:', error);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@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AG,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PackageManager } from './framework-detect.js';
|
|
2
|
+
import type { NpmDependencySpec } from './deps.js';
|
|
3
|
+
/**
|
|
4
|
+
* SA2: every package manager invocation runs with `--ignore-scripts` by default. A
|
|
5
|
+
* malicious/compromised npm package's `postinstall` is a common RCE vector; the CLI never
|
|
6
|
+
* needs build scripts to run for a component's plain `dependencies`, so this is disabled
|
|
7
|
+
* unconditionally rather than exposed as an opt-out flag.
|
|
8
|
+
*/
|
|
9
|
+
export declare function installNpmDependencies(cwd: string, manager: PackageManager, specs: NpmDependencySpec[]): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AASnD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,iBAAiB,EAAE,GACzB,OAAO,CAAC,IAAI,CAAC,CAoBf"}
|
package/dist/install.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { CliError } from './errors.js';
|
|
3
|
+
const ADD_COMMAND = {
|
|
4
|
+
pnpm: 'add',
|
|
5
|
+
npm: 'install',
|
|
6
|
+
yarn: 'add',
|
|
7
|
+
bun: 'add',
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* SA2: every package manager invocation runs with `--ignore-scripts` by default. A
|
|
11
|
+
* malicious/compromised npm package's `postinstall` is a common RCE vector; the CLI never
|
|
12
|
+
* needs build scripts to run for a component's plain `dependencies`, so this is disabled
|
|
13
|
+
* unconditionally rather than exposed as an opt-out flag.
|
|
14
|
+
*/
|
|
15
|
+
export async function installNpmDependencies(cwd, manager, specs) {
|
|
16
|
+
if (specs.length === 0)
|
|
17
|
+
return;
|
|
18
|
+
const args = [
|
|
19
|
+
ADD_COMMAND[manager],
|
|
20
|
+
...specs.map((spec) => `${spec.name}@${spec.version}`),
|
|
21
|
+
'--ignore-scripts',
|
|
22
|
+
];
|
|
23
|
+
await new Promise((resolvePromise, reject) => {
|
|
24
|
+
const child = spawn(manager, args, { cwd, stdio: 'inherit' });
|
|
25
|
+
child.on('error', (error) => {
|
|
26
|
+
reject(new CliError(`No se pudo ejecutar "${manager} ${args.join(' ')}": ${error.message}`));
|
|
27
|
+
});
|
|
28
|
+
child.on('exit', (code) => {
|
|
29
|
+
if (code === 0) {
|
|
30
|
+
resolvePromise();
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
reject(new CliError(`"${manager} ${args.join(' ')}" terminó con código ${code}.`));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB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CAAC,CAAC;YACrF,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface SelectOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
hint?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Thin wrapper over `@clack/prompts` behind an interface, so commands can be tested with
|
|
8
|
+
* a scripted fake adapter instead of driving a real (non-interactive-hostile) TTY prompt.
|
|
9
|
+
*/
|
|
10
|
+
export interface PromptAdapter {
|
|
11
|
+
intro(message: string): void;
|
|
12
|
+
outro(message: string): void;
|
|
13
|
+
note(message: string, title?: string): void;
|
|
14
|
+
confirm(message: string, initialValue?: boolean): Promise<boolean>;
|
|
15
|
+
text(message: string, defaultValue?: string): Promise<string>;
|
|
16
|
+
select(message: string, options: SelectOption[]): Promise<string>;
|
|
17
|
+
}
|
|
18
|
+
export declare const clackPromptAdapter: PromptAdapter;
|
|
19
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACnE;AAED,eAAO,MAAM,kBAAkB,EAAE,aAgChC,CAAC"}
|
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as clack from '@clack/prompts';
|
|
2
|
+
import { PromptCancelledError } from './errors.js';
|
|
3
|
+
export const clackPromptAdapter = {
|
|
4
|
+
intro(message) {
|
|
5
|
+
clack.intro(message);
|
|
6
|
+
},
|
|
7
|
+
outro(message) {
|
|
8
|
+
clack.outro(message);
|
|
9
|
+
},
|
|
10
|
+
note(message, title) {
|
|
11
|
+
clack.note(message, title);
|
|
12
|
+
},
|
|
13
|
+
async confirm(message, initialValue = true) {
|
|
14
|
+
const result = await clack.confirm({ message, initialValue });
|
|
15
|
+
if (clack.isCancel(result))
|
|
16
|
+
throw new PromptCancelledError();
|
|
17
|
+
return result;
|
|
18
|
+
},
|
|
19
|
+
async text(message, defaultValue) {
|
|
20
|
+
const result = await clack.text({ message, placeholder: defaultValue, defaultValue });
|
|
21
|
+
if (clack.isCancel(result))
|
|
22
|
+
throw new PromptCancelledError();
|
|
23
|
+
return result ?? defaultValue ?? '';
|
|
24
|
+
},
|
|
25
|
+
async select(message, options) {
|
|
26
|
+
const result = await clack.select({
|
|
27
|
+
message,
|
|
28
|
+
options: options.map((option) => ({
|
|
29
|
+
value: option.value,
|
|
30
|
+
label: option.label,
|
|
31
|
+
hint: option.hint,
|
|
32
|
+
})),
|
|
33
|
+
});
|
|
34
|
+
if (clack.isCancel(result))
|
|
35
|
+
throw new PromptCancelledError();
|
|
36
|
+
return result;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0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CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBAChC,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB,CAAC,CAAC;SACJ,CAAC,CAAC;QACH,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,oBAAoB,EAAE,CAAC;QAC7D,OAAO,MAAgB,CAAC;IAC1B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RegistryEntry, RegistryIndexEntry } from '@modularcore/registry';
|
|
2
|
+
export interface RegistryClient {
|
|
3
|
+
getIndex(): Promise<RegistryIndexEntry[]>;
|
|
4
|
+
getDescriptor(name: string): Promise<RegistryEntry>;
|
|
5
|
+
getTarball(name: string): Promise<Buffer>;
|
|
6
|
+
}
|
|
7
|
+
export declare function createRegistryClient(registryUrl: string): RegistryClient;
|
|
8
|
+
//# sourceMappingURL=registry-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-client.d.ts","sourceRoot":"","sources":["../src/registry-client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAuC/E,MAAM,WAAW,cAAc;IAC7B,QAAQ,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAC1C,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACpD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CA0CxE"}
|