zard-cli 1.1.0-alpha.0 → 1.1.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/README.md +122 -60
- package/commands/add/component-installer.d.ts +2 -1
- package/commands/add/component-installer.d.ts.map +1 -1
- package/commands/add/component-installer.js +25 -7
- package/commands/add/component-installer.js.map +1 -1
- package/commands/add/component-selector.d.ts +3 -3
- package/commands/add/component-selector.js +4 -4
- package/commands/add/dark-mode-setup.d.ts +2 -0
- package/commands/add/dark-mode-setup.d.ts.map +1 -1
- package/commands/add/dark-mode-setup.js +15 -1
- package/commands/add/dark-mode-setup.js.map +1 -1
- package/commands/add/dependency-resolver.d.ts +8 -1
- package/commands/add/dependency-resolver.d.ts.map +1 -1
- package/commands/add/dependency-resolver.js +87 -16
- package/commands/add/dependency-resolver.js.map +1 -1
- package/commands/add/index.d.ts.map +1 -1
- package/commands/add/index.js +55 -29
- package/commands/add/index.js.map +1 -1
- package/commands/add/stylesheet-setup.d.ts +3 -0
- package/commands/add/stylesheet-setup.d.ts.map +1 -0
- package/commands/add/stylesheet-setup.js +92 -0
- package/commands/add/stylesheet-setup.js.map +1 -0
- package/commands/add/wizard.d.ts +12 -8
- package/commands/add/wizard.d.ts.map +1 -1
- package/commands/add/wizard.js +12 -2
- package/commands/add/wizard.js.map +1 -1
- package/commands/init/config-prompter.d.ts +36 -16
- package/commands/init/config-prompter.d.ts.map +1 -1
- package/commands/init/config-prompter.js +37 -17
- package/commands/init/config-prompter.js.map +1 -1
- package/commands/init/dependencies.d.ts.map +1 -1
- package/commands/init/dependencies.js +35 -23
- package/commands/init/dependencies.js.map +1 -1
- package/commands/init/index.d.ts.map +1 -1
- package/commands/init/index.js +74 -23
- package/commands/init/index.js.map +1 -1
- package/commands/init/library-peers.d.ts +28 -0
- package/commands/init/library-peers.d.ts.map +1 -0
- package/commands/init/library-peers.js +61 -0
- package/commands/init/library-peers.js.map +1 -0
- package/commands/init/project-kind.d.ts +39 -39
- package/commands/init/project-kind.d.ts.map +1 -1
- package/commands/init/project-kind.js +45 -45
- package/commands/init/project-kind.js.map +1 -1
- package/commands/init/rtl-setup.d.ts +12 -0
- package/commands/init/rtl-setup.d.ts.map +1 -0
- package/commands/init/rtl-setup.js +42 -0
- package/commands/init/rtl-setup.js.map +1 -0
- package/commands/init/steps.d.ts +3 -4
- package/commands/init/steps.d.ts.map +1 -1
- package/commands/init/steps.js +100 -39
- package/commands/init/steps.js.map +1 -1
- package/commands/init/tailwind-setup.d.ts +5 -5
- package/commands/init/tailwind-setup.d.ts.map +1 -1
- package/commands/init/tailwind-setup.js +29 -15
- package/commands/init/tailwind-setup.js.map +1 -1
- package/commands/init/tsconfig-updater.d.ts +4 -4
- package/commands/init/tsconfig-updater.js +12 -12
- package/commands/init/tsconfig-updater.js.map +1 -1
- package/commands/init/update-angular-config.js +4 -4
- package/commands/init/vite-setup.d.ts +5 -4
- package/commands/init/vite-setup.d.ts.map +1 -1
- package/commands/init/vite-setup.js +11 -10
- package/commands/init/vite-setup.js.map +1 -1
- package/commands/init/wizard.d.ts +10 -7
- package/commands/init/wizard.d.ts.map +1 -1
- package/commands/init/wizard.js +73 -46
- package/commands/init/wizard.js.map +1 -1
- package/constants/app.constants.d.ts +17 -0
- package/constants/app.constants.d.ts.map +1 -1
- package/constants/app.constants.js +39 -16
- package/constants/app.constants.js.map +1 -1
- package/core/icons/families.d.ts +38 -0
- package/core/icons/families.d.ts.map +1 -0
- package/core/icons/families.js +26 -0
- package/core/icons/families.js.map +1 -0
- package/core/icons/icon-map.d.ts +24 -0
- package/core/icons/icon-map.d.ts.map +1 -0
- package/core/icons/icon-map.js +150 -0
- package/core/icons/icon-map.js.map +1 -0
- package/core/icons/index.d.ts +107 -0
- package/core/icons/index.d.ts.map +1 -0
- package/core/icons/index.js +183 -0
- package/core/icons/index.js.map +1 -0
- package/core/registry/registry-data.d.ts.map +1 -1
- package/core/registry/registry-data.js +545 -63
- package/core/registry/registry-data.js.map +1 -1
- package/core/themes/index.d.ts +1 -1
- package/core/themes/index.js +1 -1
- package/core/themes/theme-definitions.d.ts.map +1 -1
- package/core/themes/theme-definitions.js +61 -72
- package/core/themes/theme-definitions.js.map +1 -1
- package/index.js +3 -2
- package/index.js.map +1 -1
- package/package.json +56 -58
- package/ui/blocks.d.ts +29 -28
- package/ui/blocks.d.ts.map +1 -1
- package/ui/blocks.js +27 -27
- package/ui/blocks.js.map +1 -1
- package/ui/brand.d.ts +5 -5
- package/ui/brand.d.ts.map +1 -1
- package/ui/brand.js +6 -6
- package/ui/brand.js.map +1 -1
- package/ui/engine/animation/index.d.ts +2 -3
- package/ui/engine/animation/index.d.ts.map +1 -1
- package/ui/engine/animation/index.js +2 -3
- package/ui/engine/animation/index.js.map +1 -1
- package/ui/engine/ansi/index.d.ts +10 -11
- package/ui/engine/ansi/index.d.ts.map +1 -1
- package/ui/engine/ansi/index.js +6 -7
- package/ui/engine/ansi/index.js.map +1 -1
- package/ui/engine/components/index.d.ts +3 -3
- package/ui/engine/components/index.js +4 -4
- package/ui/engine/cursor/index.d.ts +3 -4
- package/ui/engine/cursor/index.d.ts.map +1 -1
- package/ui/engine/cursor/index.js +2 -3
- package/ui/engine/cursor/index.js.map +1 -1
- package/ui/engine/diff/index.d.ts +2 -3
- package/ui/engine/diff/index.d.ts.map +1 -1
- package/ui/engine/diff/index.js +5 -6
- package/ui/engine/diff/index.js.map +1 -1
- package/ui/engine/events/index.d.ts +2 -2
- package/ui/engine/events/index.js +3 -3
- package/ui/engine/events/index.js.map +1 -1
- package/ui/engine/focus/index.d.ts +2 -2
- package/ui/engine/focus/index.js +2 -2
- package/ui/engine/frame/index.d.ts +4 -4
- package/ui/engine/frame/index.js +0 -0
- package/ui/engine/index.d.ts +7 -7
- package/ui/engine/index.js +7 -7
- package/ui/engine/input/index.d.ts +2 -2
- package/ui/engine/input/index.js +11 -11
- package/ui/engine/input/index.js.map +1 -1
- package/ui/engine/layout/index.d.ts +3 -3
- package/ui/engine/layout/index.js +7 -7
- package/ui/engine/layout/index.js.map +1 -1
- package/ui/engine/renderer/index.d.ts +4 -4
- package/ui/engine/renderer/index.d.ts.map +1 -1
- package/ui/engine/renderer/index.js +3 -3
- package/ui/engine/scheduler/index.d.ts +3 -3
- package/ui/engine/scheduler/index.js +5 -5
- package/ui/engine/scheduler/index.js.map +1 -1
- package/ui/engine/screen/index.d.ts +5 -5
- package/ui/engine/screen/index.d.ts.map +1 -1
- package/ui/engine/screen/index.js +7 -7
- package/ui/engine/screen/index.js.map +1 -1
- package/ui/engine/terminal/index.d.ts +49 -3
- package/ui/engine/terminal/index.d.ts.map +1 -1
- package/ui/engine/terminal/index.js +149 -18
- package/ui/engine/terminal/index.js.map +1 -1
- package/ui/engine/testing/index.d.ts +4 -4
- package/ui/engine/testing/index.d.ts.map +1 -1
- package/ui/engine/testing/index.js +2 -2
- package/ui/engine/theme/index.d.ts +2 -3
- package/ui/engine/theme/index.d.ts.map +1 -1
- package/ui/engine/theme/index.js +3 -4
- package/ui/engine/theme/index.js.map +1 -1
- package/ui/engine/utils/index.d.ts +2 -2
- package/ui/engine/utils/index.js +4 -4
- package/ui/engine/utils/index.js.map +1 -1
- package/ui/gate.d.ts +7 -7
- package/ui/gate.d.ts.map +1 -1
- package/ui/gate.js +5 -5
- package/ui/index.d.ts +3 -3
- package/ui/index.js +3 -3
- package/ui/log-sink.d.ts +9 -9
- package/ui/log-sink.d.ts.map +1 -1
- package/ui/log-sink.js +9 -9
- package/ui/log-sink.js.map +1 -1
- package/ui/output.d.ts +6 -6
- package/ui/output.d.ts.map +1 -1
- package/ui/output.js +6 -6
- package/ui/output.js.map +1 -1
- package/ui/report.d.ts +8 -8
- package/ui/report.d.ts.map +1 -1
- package/ui/report.js +7 -7
- package/ui/report.js.map +1 -1
- package/ui/runner.d.ts +31 -22
- package/ui/runner.d.ts.map +1 -1
- package/ui/runner.js +41 -25
- package/ui/runner.js.map +1 -1
- package/ui/style.d.ts +7 -7
- package/ui/style.d.ts.map +1 -1
- package/ui/style.js +8 -8
- package/ui/style.js.map +1 -1
- package/ui/testing/fake-tty.d.ts +4 -4
- package/ui/testing/fake-tty.js +4 -4
- package/ui/text-input.d.ts +15 -14
- package/ui/text-input.d.ts.map +1 -1
- package/ui/text-input.js +15 -13
- package/ui/text-input.js.map +1 -1
- package/ui/theme.d.ts +4 -4
- package/ui/theme.js +4 -4
- package/utils/angular-compat.d.ts +21 -0
- package/utils/angular-compat.d.ts.map +1 -0
- package/utils/angular-compat.js +52 -0
- package/utils/angular-compat.js.map +1 -0
- package/utils/config.d.ts +16 -9
- package/utils/config.d.ts.map +1 -1
- package/utils/config.js +35 -13
- package/utils/config.js.map +1 -1
- package/utils/errors.d.ts +11 -0
- package/utils/errors.d.ts.map +1 -1
- package/utils/errors.js +14 -0
- package/utils/errors.js.map +1 -1
- package/utils/get-project-info.d.ts +6 -6
- package/utils/get-project-info.d.ts.map +1 -1
- package/utils/get-project-info.js +106 -36
- package/utils/get-project-info.js.map +1 -1
- package/utils/http-client.d.ts.map +1 -1
- package/utils/http-client.js +20 -5
- package/utils/http-client.js.map +1 -1
- package/utils/icon-catalog.d.ts +34 -0
- package/utils/icon-catalog.d.ts.map +1 -0
- package/utils/icon-catalog.js +63 -0
- package/utils/icon-catalog.js.map +1 -0
- package/utils/logger.d.ts +3 -3
- package/utils/logger.js +9 -9
- package/utils/logger.js.map +1 -1
- package/utils/package-manager.d.ts +25 -25
- package/utils/package-manager.js +50 -50
- package/utils/package-manager.js.map +1 -1
- package/utils/registry.d.ts +100 -6
- package/utils/registry.d.ts.map +1 -1
- package/utils/registry.js +141 -22
- package/utils/registry.js.map +1 -1
- package/utils/schema-version.d.ts +21 -0
- package/utils/schema-version.d.ts.map +1 -0
- package/utils/schema-version.js +28 -0
- package/utils/schema-version.js.map +1 -0
- package/utils/source-file.d.ts +21 -21
- package/utils/source-file.d.ts.map +1 -1
- package/utils/source-file.js +24 -24
- package/utils/source-file.js.map +1 -1
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Which manager the *project* uses.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* (`npx`
|
|
7
|
-
*
|
|
8
|
-
* package-lock.json
|
|
9
|
-
*
|
|
5
|
+
* Order matters. `npm_config_user_agent` describes how the CLI was invoked
|
|
6
|
+
* (`npx` always says npm), not what the project uses — trusting it first gave a
|
|
7
|
+
* bun project `packageManager: "npm"` in its components.json and a
|
|
8
|
+
* package-lock.json next to its bun.lock. The project answers for itself: the
|
|
9
|
+
* package.json `packageManager` field first, then the lockfiles.
|
|
10
10
|
*/
|
|
11
11
|
export declare function detectPackageManager(cwd?: string): Promise<PackageManager>;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* How to suggest running the CLI again.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* A different question: not which manager the project installs dependencies
|
|
16
|
+
* with, but how the CLI was just invoked. Someone who ran `npx zard-cli init`
|
|
17
|
+
* in a bun project does not expect to finish reading `bunx` — and the `npx`
|
|
18
|
+
* they already used works. Only when that cannot be known does the project's
|
|
19
|
+
* manager answer.
|
|
20
20
|
*/
|
|
21
21
|
export declare function suggestedRunner(packageManager: PackageManager): string;
|
|
22
22
|
export declare function getPackageManager(cwd?: string): Promise<'npm' | 'yarn' | 'pnpm' | 'bun'>;
|
|
23
23
|
export declare function getInstallCommand(packageManager: string, isDev?: boolean): Promise<string[]>;
|
|
24
24
|
export declare function installPackages(packages: string[], cwd: string, packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun', isDev?: boolean, legacyPeerDeps?: boolean): Promise<void>;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Installs the batch and, if the manager rejects the tree over a peer conflict,
|
|
27
|
+
* retries with the check relaxed.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* The fallback is remembered for the rest of the run: once the first batch
|
|
30
|
+
* needed it, the following ones will need it for the same reason, and an
|
|
31
|
+
* attempt already known to be doomed costs a full tree resolution.
|
|
32
32
|
*/
|
|
33
33
|
export declare function installPackagesWithRetry(packages: string[], cwd: string, packageManager: PackageManager, isDev?: boolean): Promise<void>;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Drops from the batch the packages the project already declares and resolves.
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* The manager charges a lot per invocation — it revalidates the whole tree even
|
|
38
|
+
* when there is nothing to do — so the win is not in making the install faster
|
|
39
|
+
* but in not calling it. An `add` in an already-initialized project asks for
|
|
40
|
+
* exactly the dependencies `init` put there.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* The filter is deliberately conservative: when in doubt the package stays in
|
|
43
|
+
* the batch and the manager decides. Comparing only the major is enough because
|
|
44
|
+
* the versions the CLI asks for are always of the form `^N`.
|
|
45
45
|
*/
|
|
46
46
|
export declare function filterInstalledPackages(packages: string[], cwd: string): Promise<string[]>;
|
|
47
47
|
export {};
|
package/utils/package-manager.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { detect } from '@antfu/ni';
|
|
2
2
|
import { isCapturing } from '../ui/log-sink.js';
|
|
3
|
-
import { getConfig } from '
|
|
4
|
-
import { logger } from '
|
|
3
|
+
import { getConfig } from './config.js';
|
|
4
|
+
import { logger } from './logger.js';
|
|
5
5
|
import { existsSync } from 'node:fs';
|
|
6
6
|
import { readFile } from 'node:fs/promises';
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
let cachedPackageManager = null;
|
|
9
9
|
const SUPPORTED = ['npm', 'yarn', 'pnpm', 'bun'];
|
|
10
10
|
function asPackageManager(value) {
|
|
11
|
-
// `yarn@berry`, `pnpm@6`, `bun@1.3.14` —
|
|
11
|
+
// `yarn@berry`, `pnpm@6`, `bun@1.3.14` — only the family matters.
|
|
12
12
|
const name = value?.split('@')[0];
|
|
13
13
|
return SUPPORTED.includes(name) ? name : null;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Which manager the *project* uses.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
* (`npx`
|
|
20
|
-
*
|
|
21
|
-
* package-lock.json
|
|
22
|
-
*
|
|
18
|
+
* Order matters. `npm_config_user_agent` describes how the CLI was invoked
|
|
19
|
+
* (`npx` always says npm), not what the project uses — trusting it first gave a
|
|
20
|
+
* bun project `packageManager: "npm"` in its components.json and a
|
|
21
|
+
* package-lock.json next to its bun.lock. The project answers for itself: the
|
|
22
|
+
* package.json `packageManager` field first, then the lockfiles.
|
|
23
23
|
*/
|
|
24
24
|
export async function detectPackageManager(cwd = process.cwd()) {
|
|
25
25
|
if (cachedPackageManager)
|
|
@@ -46,13 +46,13 @@ const RUNNER = {
|
|
|
46
46
|
bun: 'bunx',
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* How to suggest running the CLI again.
|
|
50
50
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
51
|
+
* A different question: not which manager the project installs dependencies
|
|
52
|
+
* with, but how the CLI was just invoked. Someone who ran `npx zard-cli init`
|
|
53
|
+
* in a bun project does not expect to finish reading `bunx` — and the `npx`
|
|
54
|
+
* they already used works. Only when that cannot be known does the project's
|
|
55
|
+
* manager answer.
|
|
56
56
|
*/
|
|
57
57
|
export function suggestedRunner(packageManager) {
|
|
58
58
|
const userAgent = process.env.npm_config_user_agent || '';
|
|
@@ -66,7 +66,7 @@ export function suggestedRunner(packageManager) {
|
|
|
66
66
|
return RUNNER.npm;
|
|
67
67
|
return RUNNER[packageManager];
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
69
|
+
/** The package.json `packageManager` field — the Corepack standard, an explicit declaration. */
|
|
70
70
|
async function readPackageManagerField(cwd) {
|
|
71
71
|
try {
|
|
72
72
|
const manifest = JSON.parse(await readFile(path.join(cwd, 'package.json'), 'utf8'));
|
|
@@ -94,11 +94,11 @@ export async function getInstallCommand(packageManager, isDev = false) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
97
|
+
* Work the manager does out of habit that the install itself does not need.
|
|
98
98
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
99
|
+
* The vulnerability audit sends the whole tree to the registry and waits for an
|
|
100
|
+
* answer; in an Angular project, with over a thousand packages, that alone
|
|
101
|
+
* accounts for several seconds of a call that installs half a dozen.
|
|
102
102
|
*/
|
|
103
103
|
function speedFlags(packageManager) {
|
|
104
104
|
return packageManager === 'npm' ? ['--no-audit', '--no-fund'] : [];
|
|
@@ -113,17 +113,16 @@ export async function installPackages(packages, cwd, packageManager, isDev = fal
|
|
|
113
113
|
if (legacyPeerDeps && packageManager === 'pnpm') {
|
|
114
114
|
args.push('--no-strict-peer-dependencies');
|
|
115
115
|
}
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
116
|
+
// With the interactive screen mounted, inheriting stdio would let the package
|
|
117
|
+
// manager write over the frame. In that case the output is captured and only
|
|
118
|
+
// shows up in debug mode; outside it, the behaviour stays "pass the output
|
|
119
|
+
// through live".
|
|
120
120
|
if (isCapturing()) {
|
|
121
121
|
const command = `${packageManager} ${args.join(' ')}`;
|
|
122
122
|
try {
|
|
123
|
-
// stdin
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
// invisível atrás da tela cheia.
|
|
123
|
+
// stdin ignored, not piped: an open input pipe never sees EOF and the
|
|
124
|
+
// package manager waits on it forever. Closing stdin also guarantees it
|
|
125
|
+
// never opens a prompt, which would be invisible behind the full screen.
|
|
127
126
|
const result = await execa(packageManager, args, {
|
|
128
127
|
cwd,
|
|
129
128
|
stdin: 'ignore',
|
|
@@ -133,35 +132,36 @@ export async function installPackages(packages, cwd, packageManager, isDev = fal
|
|
|
133
132
|
logger.debug(`${command}\n${result.stdout}`);
|
|
134
133
|
}
|
|
135
134
|
catch (error) {
|
|
136
|
-
//
|
|
137
|
-
//
|
|
135
|
+
// Without this the failure reaches the user as one generic line: the
|
|
136
|
+
// package manager's real output stays in the sink and is printed with the
|
|
137
|
+
// summary.
|
|
138
138
|
logger.error(`${command} failed:\n${outputOf(error)}`);
|
|
139
139
|
throw error;
|
|
140
140
|
}
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
// stdin
|
|
144
|
-
//
|
|
145
|
-
// background)
|
|
146
|
-
//
|
|
143
|
+
// stdin ignored here too. The install takes its packages as arguments and has
|
|
144
|
+
// nothing to ask; inheriting a stdin that never closes (a pipe, CI, a
|
|
145
|
+
// background job) leaves the manager waiting for an EOF that never comes —
|
|
146
|
+
// output stays live because stdout and stderr are still inherited.
|
|
147
147
|
await execa(packageManager, args, { cwd, stdin: 'ignore', stdout: 'inherit', stderr: 'inherit' });
|
|
148
148
|
}
|
|
149
149
|
function outputOf(error) {
|
|
150
150
|
const { stderr, stdout, message } = (error ?? {});
|
|
151
151
|
return (stderr?.trim() || stdout?.trim() || message || String(error)).trim();
|
|
152
152
|
}
|
|
153
|
-
/**
|
|
153
|
+
/** Only npm and pnpm can relax peer checking; elsewhere, retrying repeats the same failure. */
|
|
154
154
|
function canRelaxPeers(packageManager) {
|
|
155
155
|
return packageManager === 'npm' || packageManager === 'pnpm';
|
|
156
156
|
}
|
|
157
157
|
let peerRelaxationEngaged = false;
|
|
158
158
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
159
|
+
* Installs the batch and, if the manager rejects the tree over a peer conflict,
|
|
160
|
+
* retries with the check relaxed.
|
|
161
161
|
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
162
|
+
* The fallback is remembered for the rest of the run: once the first batch
|
|
163
|
+
* needed it, the following ones will need it for the same reason, and an
|
|
164
|
+
* attempt already known to be doomed costs a full tree resolution.
|
|
165
165
|
*/
|
|
166
166
|
export async function installPackagesWithRetry(packages, cwd, packageManager, isDev = false) {
|
|
167
167
|
if (packages.length === 0)
|
|
@@ -182,16 +182,16 @@ export async function installPackagesWithRetry(packages, cwd, packageManager, is
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
|
-
*
|
|
185
|
+
* Drops from the batch the packages the project already declares and resolves.
|
|
186
186
|
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
187
|
+
* The manager charges a lot per invocation — it revalidates the whole tree even
|
|
188
|
+
* when there is nothing to do — so the win is not in making the install faster
|
|
189
|
+
* but in not calling it. An `add` in an already-initialized project asks for
|
|
190
|
+
* exactly the dependencies `init` put there.
|
|
191
191
|
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
192
|
+
* The filter is deliberately conservative: when in doubt the package stays in
|
|
193
|
+
* the batch and the manager decides. Comparing only the major is enough because
|
|
194
|
+
* the versions the CLI asks for are always of the form `^N`.
|
|
195
195
|
*/
|
|
196
196
|
export async function filterInstalledPackages(packages, cwd) {
|
|
197
197
|
const declared = await readDeclaredDependencies(cwd);
|
|
@@ -210,7 +210,7 @@ export async function filterInstalledPackages(packages, cwd) {
|
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
function parseSpec(spec) {
|
|
213
|
-
//
|
|
213
|
+
// The `@` in `@ng-icons/core` opens the scope, not the version — hence the last one.
|
|
214
214
|
const separator = spec.lastIndexOf('@');
|
|
215
215
|
if (separator <= 0)
|
|
216
216
|
return { name: spec, range: null };
|
|
@@ -228,7 +228,7 @@ async function readDeclaredDependencies(cwd) {
|
|
|
228
228
|
return null;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
/** node_modules
|
|
231
|
+
/** node_modules can sit above the project — workspaces hoist everything to the root. */
|
|
232
232
|
function isResolvable(name, cwd) {
|
|
233
233
|
let dir = path.resolve(cwd);
|
|
234
234
|
for (;;) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager.js","sourceRoot":"","sources":["../../src/utils/package-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,IAAI,oBAAoB,GAA0B,IAAI,CAAC;AAEvD,MAAM,SAAS,GAA8B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAE5E,SAAS,gBAAgB,CAAC,KAAgC;IACxD,
|
|
1
|
+
{"version":3,"file":"package-manager.js","sourceRoot":"","sources":["../../src/utils/package-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC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KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;QACpF,OAAO,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,wFAAwF;AACxF,SAAS,YAAY,CAAC,IAAY,EAAE,GAAW;IAC7C,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAE5B,SAAS,CAAC;QACR,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QAElE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QACjC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/utils/registry.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IconFamily } from '../core/icons/index.js';
|
|
2
|
+
import type { Config } from './config.js';
|
|
2
3
|
export declare const DEFAULT_REGISTRY_URL: string;
|
|
4
|
+
/**
|
|
5
|
+
* The icons a component draws, as the registry publishes them.
|
|
6
|
+
*
|
|
7
|
+
* `family` is the family the files are written in — anyone installing with a
|
|
8
|
+
* different family in `components.json` learns from this field that they need
|
|
9
|
+
* rewriting. Absent from items published before this property existed.
|
|
10
|
+
*/
|
|
11
|
+
export interface RegistryIcons {
|
|
12
|
+
family: string;
|
|
13
|
+
symbols: string[];
|
|
14
|
+
tokens: string[];
|
|
15
|
+
/** The icons that only appear in the demos. Absent from the index, which does not carry them. */
|
|
16
|
+
demos?: {
|
|
17
|
+
symbols: string[];
|
|
18
|
+
tokens: string[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
3
21
|
export interface RegistryItem {
|
|
4
22
|
name: string;
|
|
5
23
|
type: 'registry:component';
|
|
@@ -11,9 +29,43 @@ export interface RegistryItem {
|
|
|
11
29
|
dependencies?: string[];
|
|
12
30
|
devDependencies?: string[];
|
|
13
31
|
registryDependencies?: string[];
|
|
32
|
+
icons?: RegistryIcons;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A block, as the registry publishes it.
|
|
36
|
+
*
|
|
37
|
+
* Blocks live under `/blocks/` in their own index, and their file entries carry
|
|
38
|
+
* a `path` the components' do not — so they get their own type instead of being
|
|
39
|
+
* bent into `RegistryItem`.
|
|
40
|
+
*/
|
|
41
|
+
export interface BlockItem {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
description: string;
|
|
45
|
+
category: string;
|
|
46
|
+
registryDependencies?: string[];
|
|
47
|
+
dependencies?: string[];
|
|
48
|
+
files: Array<{
|
|
49
|
+
name: string;
|
|
50
|
+
path: string;
|
|
51
|
+
content: string;
|
|
52
|
+
language: string;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
export interface BlocksIndex {
|
|
56
|
+
blocks: Array<{
|
|
57
|
+
id: string;
|
|
58
|
+
title: string;
|
|
59
|
+
description: string;
|
|
60
|
+
category: string;
|
|
61
|
+
registryDependencies?: string[];
|
|
62
|
+
dependencies?: string[];
|
|
63
|
+
}>;
|
|
14
64
|
}
|
|
15
65
|
export interface RegistryIndex {
|
|
16
66
|
$schema: string;
|
|
67
|
+
/** The file's shape. Absent from registries older than the field. */
|
|
68
|
+
schemaVersion?: number;
|
|
17
69
|
name: string;
|
|
18
70
|
homepage: string;
|
|
19
71
|
version: string;
|
|
@@ -24,25 +76,67 @@ export interface RegistryIndex {
|
|
|
24
76
|
dependencies?: string[];
|
|
25
77
|
devDependencies?: string[];
|
|
26
78
|
registryDependencies?: string[];
|
|
79
|
+
icons?: RegistryIcons;
|
|
27
80
|
files: string[];
|
|
28
81
|
}>;
|
|
29
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* The family the item's files are written in.
|
|
85
|
+
*
|
|
86
|
+
* An item with no `icons` — published before the property existed — is in
|
|
87
|
+
* lucide, which was the only possibility. So is an unknown value: better the
|
|
88
|
+
* right guess than refusing to install over an unfamiliar field.
|
|
89
|
+
*/
|
|
90
|
+
export declare function sourceFamilyOf(item: Pick<RegistryItem, 'icons'>): IconFamily;
|
|
30
91
|
export declare function getRegistryUrl(config?: Config): string;
|
|
31
92
|
export declare function validateRegistryUrl(url: string): void;
|
|
32
93
|
export declare function fetchRegistryIndex(registryUrl?: string): Promise<RegistryIndex>;
|
|
33
94
|
export declare function invalidateRegistryCache(): void;
|
|
34
95
|
export declare function fetchComponentFromRegistry(componentName: string, registryUrl?: string): Promise<RegistryItem>;
|
|
96
|
+
/**
|
|
97
|
+
* The block index, cached like the component one.
|
|
98
|
+
*
|
|
99
|
+
* A registry that predates blocks has no `blocks-registry.json`; that is not an
|
|
100
|
+
* error, it just means this registry publishes none.
|
|
101
|
+
*/
|
|
102
|
+
export declare function fetchBlocksIndex(registryUrl?: string): Promise<BlocksIndex>;
|
|
103
|
+
export declare function fetchBlockFromRegistry(blockId: string, registryUrl?: string): Promise<BlockItem>;
|
|
104
|
+
export declare function getAvailableBlocks(registryUrl?: string): Promise<string[]>;
|
|
35
105
|
export declare function getAvailableComponents(registryUrl?: string): Promise<string[]>;
|
|
36
106
|
export interface TransformOptions {
|
|
37
107
|
/**
|
|
38
|
-
*
|
|
108
|
+
* The destination came from `--path`, outside the configured alias.
|
|
39
109
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* `utils`
|
|
110
|
+
* In that case the batch's components become neighbours on disk, and the
|
|
111
|
+
* relative path is what resolves — the alias would point at the folder they are
|
|
112
|
+
* not in. `utils` and `core` stay on the alias, because `init` installed them.
|
|
43
113
|
*/
|
|
44
114
|
readonly siblingComponents?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Where the file sits inside its registry item (`i18n/locales/en-us.ts`).
|
|
117
|
+
*
|
|
118
|
+
* A `../` only points at another component when it climbs out of the item.
|
|
119
|
+
* From a nested file it can stay inside — `core/i18n/locales/en-us.ts`
|
|
120
|
+
* importing `../i18n.types` — and turning that into the components alias made
|
|
121
|
+
* every fresh `init` ship imports that do not resolve.
|
|
122
|
+
*/
|
|
123
|
+
readonly fileName?: string;
|
|
45
124
|
}
|
|
46
125
|
export declare function transformContent(content: string, config: Config, options?: TransformOptions): string;
|
|
47
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Rewrites aliased imports as paths relative to the file that holds them.
|
|
128
|
+
*
|
|
129
|
+
* A library cannot ship `@/shared/...`: ng-packagr leaves non-relative imports
|
|
130
|
+
* external, so the published bundle kept importing a path that only the
|
|
131
|
+
* library's own workspace maps — and every app installing it from npm failed to
|
|
132
|
+
* resolve them. Relative imports get bundled, and keep working inside the
|
|
133
|
+
* workspace too.
|
|
134
|
+
*
|
|
135
|
+
* `targets` pairs each alias with the directory it stands for. The longest
|
|
136
|
+
* alias goes first, so `@/shared/components` is not taken for a shorter prefix.
|
|
137
|
+
*/
|
|
138
|
+
export declare function relativizeImports(content: string, filePath: string, targets: Record<string, string>): string;
|
|
139
|
+
export declare function fetchComponent(componentName: string, config: Config, registryUrl?: string, options?: TransformOptions & {
|
|
140
|
+
isBlock?: boolean;
|
|
141
|
+
}): Promise<RegistryItem>;
|
|
48
142
|
//# sourceMappingURL=registry.d.ts.map
|
package/utils/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AACA,O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