zard-cli 1.0.0-beta.114 → 1.0.0-beta.116
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/commands/add/component-installer.js +3 -3
- package/commands/add/component-installer.js.map +1 -1
- package/commands/add/component-selector.d.ts +3 -3
- package/commands/add/component-selector.js +3 -3
- package/commands/add/dependency-resolver.js +10 -7
- package/commands/add/dependency-resolver.js.map +1 -1
- package/commands/add/index.d.ts.map +1 -1
- package/commands/add/index.js +12 -20
- package/commands/add/index.js.map +1 -1
- package/commands/add/wizard.d.ts +8 -7
- package/commands/add/wizard.d.ts.map +1 -1
- package/commands/add/wizard.js +2 -2
- package/commands/add/wizard.js.map +1 -1
- package/commands/init/config-prompter.d.ts +18 -13
- package/commands/init/config-prompter.d.ts.map +1 -1
- package/commands/init/config-prompter.js +25 -19
- package/commands/init/config-prompter.js.map +1 -1
- package/commands/init/dependencies.d.ts.map +1 -1
- package/commands/init/dependencies.js +21 -24
- package/commands/init/dependencies.js.map +1 -1
- package/commands/init/index.js +20 -20
- package/commands/init/index.js.map +1 -1
- 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 +44 -44
- package/commands/init/project-kind.js.map +1 -1
- package/commands/init/steps.d.ts +3 -4
- package/commands/init/steps.d.ts.map +1 -1
- package/commands/init/steps.js +25 -24
- package/commands/init/steps.js.map +1 -1
- package/commands/init/tailwind-setup.d.ts +5 -5
- package/commands/init/tailwind-setup.js +14 -14
- 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 +5 -5
- package/commands/init/wizard.d.ts.map +1 -1
- package/commands/init/wizard.js +29 -29
- package/commands/init/wizard.js.map +1 -1
- package/core/icons/families.d.ts +20 -20
- package/core/icons/families.d.ts.map +1 -1
- package/core/icons/families.js +11 -11
- package/core/icons/families.js.map +1 -1
- package/core/icons/icon-map.d.ts.map +1 -1
- package/core/icons/icon-map.js +9 -4
- package/core/icons/icon-map.js.map +1 -1
- package/core/icons/index.d.ts +50 -50
- package/core/icons/index.d.ts.map +1 -1
- package/core/icons/index.js +45 -45
- package/core/icons/index.js.map +1 -1
- package/core/registry/registry-data.d.ts.map +1 -1
- package/core/registry/registry-data.js +103 -14
- package/core/registry/registry-data.js.map +1 -1
- package/core/themes/theme-definitions.d.ts.map +1 -1
- package/core/themes/theme-definitions.js +10 -0
- package/core/themes/theme-definitions.js.map +1 -1
- package/index.js +3 -2
- package/index.js.map +1 -1
- package/package.json +6 -8
- 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 +29 -29
- package/ui/engine/terminal/index.d.ts.map +1 -1
- package/ui/engine/terminal/index.js +47 -47
- 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 +25 -25
- package/ui/runner.d.ts.map +1 -1
- package/ui/runner.js +27 -27
- 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 +14 -13
- 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 +6 -6
- package/utils/config.d.ts.map +1 -1
- package/utils/config.js +20 -20
- package/utils/config.js.map +1 -1
- package/utils/errors.d.ts +5 -5
- package/utils/errors.js +5 -5
- 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 +35 -35
- package/utils/get-project-info.js.map +1 -1
- package/utils/http-client.d.ts.map +1 -1
- package/utils/http-client.js +18 -3
- package/utils/http-client.js.map +1 -1
- package/utils/icon-catalog.d.ts +16 -15
- package/utils/icon-catalog.d.ts.map +1 -1
- package/utils/icon-catalog.js +21 -20
- package/utils/icon-catalog.js.map +1 -1
- 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 +48 -48
- package/utils/package-manager.js.map +1 -1
- package/utils/registry.d.ts +14 -14
- package/utils/registry.d.ts.map +1 -1
- package/utils/registry.js +23 -19
- package/utils/registry.js.map +1 -1
- package/utils/schema-version.d.ts +11 -10
- package/utils/schema-version.d.ts.map +1 -1
- package/utils/schema-version.js +11 -10
- package/utils/schema-version.js.map +1 -1
- 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
package/commands/init/steps.js
CHANGED
|
@@ -31,8 +31,8 @@ export function buildInitSteps(cwd, config, projectInfo, isReInitializing) {
|
|
|
31
31
|
run: () => installDependencies(cwd, config, projectInfo),
|
|
32
32
|
},
|
|
33
33
|
];
|
|
34
|
-
//
|
|
35
|
-
//
|
|
34
|
+
// Application providers do not belong to the library: the app consuming it
|
|
35
|
+
// registers them, and a library has no app.config.ts to write into.
|
|
36
36
|
if (!isLibrary) {
|
|
37
37
|
steps.push({
|
|
38
38
|
label: config.appConfigFile,
|
|
@@ -65,13 +65,13 @@ export function buildInitSteps(cwd, config, projectInfo, isReInitializing) {
|
|
|
65
65
|
return steps;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* How Tailwind enters the application build.
|
|
69
69
|
*
|
|
70
|
-
*
|
|
71
|
-
* `.postcssrc.json`
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
70
|
+
* In Analog it is Vite that compiles, and Tailwind is one of its plugins — a
|
|
71
|
+
* `.postcssrc.json` there would be read by nobody. Everywhere else the Angular
|
|
72
|
+
* build loads PostCSS, and the file goes to the project root: in a workspace
|
|
73
|
+
* with several apps, writing it at the repository root would configure all of
|
|
74
|
+
* them at once.
|
|
75
75
|
*/
|
|
76
76
|
function tailwindPipelineStep(cwd, projectRoot, kind, projectInfo, isReInitializing) {
|
|
77
77
|
if (bundlerFor(kind) === 'vite') {
|
|
@@ -85,32 +85,33 @@ function tailwindPipelineStep(cwd, projectRoot, kind, projectInfo, isReInitializ
|
|
|
85
85
|
return {
|
|
86
86
|
label: relative,
|
|
87
87
|
note: 'Tailwind PostCSS plugin',
|
|
88
|
-
//
|
|
89
|
-
// `.postcssrc.json`
|
|
88
|
+
// Re-initializing rewrites the file on purpose: it is the chance to correct a
|
|
89
|
+
// `.postcssrc.json` left over from an earlier setup.
|
|
90
90
|
run: () => !projectInfo.hasTailwind || isReInitializing || !existsSync(path.resolve(cwd, relative))
|
|
91
91
|
? createPostCssConfig(cwd, projectRoot)
|
|
92
92
|
: Promise.resolve(),
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
96
|
+
* Declares the theme CSS as a library asset.
|
|
97
97
|
*
|
|
98
|
-
*
|
|
99
|
-
* `src/`
|
|
100
|
-
*
|
|
101
|
-
*
|
|
98
|
+
* ng-packagr only publishes what the entry point reaches; a loose `.css` in
|
|
99
|
+
* `src/` stays out of the package. Without this entry, the file the previous
|
|
100
|
+
* step wrote would exist only in the repository and never reach whoever
|
|
101
|
+
* installs the library.
|
|
102
102
|
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
103
|
+
* The asset is declared with `output: '/'` so it lands at the package root.
|
|
104
|
+
* Listing it as a plain path preserves the source folder, and the consumer would
|
|
105
|
+
* end up importing `<lib>/src/styles.css` — a `src/` that is a detail of the
|
|
106
|
+
* library's repository, not something whoever installs it should know.
|
|
107
107
|
*/
|
|
108
108
|
async function registerStylesAsset(cwd, config) {
|
|
109
109
|
const libraryRoot = path.resolve(cwd, projectRootOf(config.baseUrl));
|
|
110
110
|
const ngPackagePath = path.join(libraryRoot, 'ng-package.json');
|
|
111
111
|
if (!existsSync(ngPackagePath)) {
|
|
112
|
-
//
|
|
113
|
-
//
|
|
112
|
+
// An Nx library only gets an ng-package.json when it is publishable; in the
|
|
113
|
+
// others there is no package to assemble and the CSS is consumed straight
|
|
114
|
+
// from the source.
|
|
114
115
|
logger.warn(`ng-package.json not found in ${path.relative(cwd, libraryRoot)}; skipping the theme asset.`);
|
|
115
116
|
return;
|
|
116
117
|
}
|
|
@@ -120,8 +121,8 @@ async function registerStylesAsset(cwd, config) {
|
|
|
120
121
|
const entry = { glob, input, output: '/' };
|
|
121
122
|
const ngPackage = JSON.parse(await readFile(ngPackagePath, 'utf8'));
|
|
122
123
|
const assets = Array.isArray(ngPackage.assets) ? ngPackage.assets : [];
|
|
123
|
-
//
|
|
124
|
-
//
|
|
124
|
+
// Old entries pointing at the same file are replaced, not accumulated: a
|
|
125
|
+
// repeated init would otherwise publish the CSS twice, in two places.
|
|
125
126
|
const others = assets.filter(asset => !describesSameFile(asset, relative, entry));
|
|
126
127
|
const alreadyCorrect = assets.length === others.length + 1 && hasEntry(assets, entry);
|
|
127
128
|
if (alreadyCorrect)
|
|
@@ -129,7 +130,7 @@ async function registerStylesAsset(cwd, config) {
|
|
|
129
130
|
ngPackage.assets = [...others, entry];
|
|
130
131
|
await writeFile(ngPackagePath, `${JSON.stringify(ngPackage, null, 2)}\n`, 'utf8');
|
|
131
132
|
}
|
|
132
|
-
/**
|
|
133
|
+
/** Whether an already-declared asset publishes exactly the same file. */
|
|
133
134
|
function describesSameFile(asset, relative, entry) {
|
|
134
135
|
if (typeof asset === 'string')
|
|
135
136
|
return asset.replace(/^\.\//, '') === relative;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../../../src/commands/init/steps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC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7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The Angular build looks for the file starting from the CSS it is processing
|
|
6
|
+
* and walks up to the workspace root, so the project is the most specific place
|
|
7
|
+
* that works — and in a monorepo with several apps it is the only one that does
|
|
8
|
+
* not configure all of them at once. `projectRoot` is `.` for a single app.
|
|
9
9
|
*/
|
|
10
10
|
export declare function createPostCssConfig(cwd: string, projectRoot?: string): Promise<void>;
|
|
11
11
|
export declare function applyThemeToStyles(cwd: string, config: Config): Promise<void>;
|
|
@@ -9,12 +9,12 @@ const POSTCSS_CONFIG = `{
|
|
|
9
9
|
}
|
|
10
10
|
`;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Writes `.postcssrc.json` at the root of the project that will use it.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* The Angular build looks for the file starting from the CSS it is processing
|
|
15
|
+
* and walks up to the workspace root, so the project is the most specific place
|
|
16
|
+
* that works — and in a monorepo with several apps it is the only one that does
|
|
17
|
+
* not configure all of them at once. `projectRoot` is `.` for a single app.
|
|
18
18
|
*/
|
|
19
19
|
export async function createPostCssConfig(cwd, projectRoot = '.') {
|
|
20
20
|
const targetDir = path.resolve(cwd, projectRoot);
|
|
@@ -22,14 +22,14 @@ export async function createPostCssConfig(cwd, projectRoot = '.') {
|
|
|
22
22
|
await writeFile(path.join(targetDir, '.postcssrc.json'), POSTCSS_CONFIG, 'utf8');
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* The CSS `@import` is resolved by the bundler relative to the file containing
|
|
26
|
+
* it, so it has to be a real relative path — it cannot be assembled by slicing
|
|
27
|
+
* the alias.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* `projects/admin/src/app`
|
|
32
|
-
*
|
|
29
|
+
* The previous version took the second segment of baseUrl and pasted the alias
|
|
30
|
+
* without its first character. It only worked for the `src/app` + `@/...`
|
|
31
|
+
* layout: with baseUrl `projects/admin/src/app` it aimed at `./admin/...`, and
|
|
32
|
+
* with an `@app/core` alias it produced `./appapp/core`.
|
|
33
33
|
*/
|
|
34
34
|
function coreImportPath(cwd, config) {
|
|
35
35
|
const cssDir = path.dirname(path.resolve(cwd, config.tailwind.css));
|
|
@@ -40,8 +40,8 @@ function coreImportPath(cwd, config) {
|
|
|
40
40
|
export async function applyThemeToStyles(cwd, config) {
|
|
41
41
|
const stylesPath = path.join(cwd, config.tailwind.css);
|
|
42
42
|
const themeContent = getThemeContent(config.tailwind.baseColor, coreImportPath(cwd, config));
|
|
43
|
-
//
|
|
44
|
-
//
|
|
43
|
+
// In a library that file usually does not exist — init creates it, so the
|
|
44
|
+
// library can expose the tokens to whoever consumes it.
|
|
45
45
|
await mkdir(path.dirname(stylesPath), { recursive: true });
|
|
46
46
|
await writeFile(stylesPath, themeContent, 'utf8');
|
|
47
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind-setup.js","sourceRoot":"","sources":["../../../src/commands/init/tailwind-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAe,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,cAAc,GAAG;;;;;CAKtB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,GAAW,EAAE,WAAW,GAAG,GAAG;IACtE,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAEjD,MAAM,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IA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AU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACvD,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAE7F,0EAA0E;IAC1E,wDAAwD;IACxD,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,MAAM,SAAS,CAAC,UAAU,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type Config } from '../../utils/config.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Writes the alias into the tsconfig the projects actually extend.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* In an Nx workspace that is `tsconfig.base.json`: the root `tsconfig.json` is
|
|
6
|
+
* inherited by no project, and a mapping written there would never reach the
|
|
7
|
+
* compiler — the alias resolved in the editor and broke in the build.
|
|
8
8
|
*/
|
|
9
9
|
export declare function updateTsConfig(cwd: string, config: Config, tsconfigFile?: string): Promise<void>;
|
|
10
10
|
//# sourceMappingURL=tsconfig-updater.d.ts.map
|
|
@@ -5,11 +5,11 @@ import { existsSync } from 'fs';
|
|
|
5
5
|
import { writeFile, readFile } from 'node:fs/promises';
|
|
6
6
|
import * as path from 'path';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Writes the alias into the tsconfig the projects actually extend.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* In an Nx workspace that is `tsconfig.base.json`: the root `tsconfig.json` is
|
|
11
|
+
* inherited by no project, and a mapping written there would never reach the
|
|
12
|
+
* compiler — the alias resolved in the editor and broke in the build.
|
|
13
13
|
*/
|
|
14
14
|
export async function updateTsConfig(cwd, config, tsconfigFile = 'tsconfig.json') {
|
|
15
15
|
const tsconfigPath = path.join(cwd, tsconfigFile);
|
|
@@ -38,9 +38,9 @@ function updatePaths(tsconfig, config) {
|
|
|
38
38
|
if (!tsconfig.compilerOptions.paths) {
|
|
39
39
|
tsconfig.compilerOptions.paths = {};
|
|
40
40
|
}
|
|
41
|
-
//
|
|
42
|
-
// `@app/components`
|
|
43
|
-
//
|
|
41
|
+
// The key comes from the chosen alias, not from a fixed `@/*`: someone who
|
|
42
|
+
// configured `@app/components` generates imports with that prefix, and mapping
|
|
43
|
+
// a different one would leave every import in the project unresolved.
|
|
44
44
|
tsconfig.compilerOptions.paths = {
|
|
45
45
|
...tsconfig.compilerOptions.paths,
|
|
46
46
|
[aliasPattern(config.aliases.components)]: [`${pathMappingBase(tsconfig, config)}/*`],
|
|
@@ -48,12 +48,12 @@ function updatePaths(tsconfig, config) {
|
|
|
48
48
|
return tsconfig;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* Writes the mapping without introducing `baseUrl`.
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
53
|
+
* Declaring `baseUrl` breaks the build on TypeScript 6 — the option became an
|
|
54
|
+
* error and disappears in 7 — and since 4.1 it is no longer necessary: without
|
|
55
|
+
* it, paths are resolved relative to the tsconfig itself. Projects that already
|
|
56
|
+
* declare the option are still honoured, with the mapping written relative to it.
|
|
57
57
|
*/
|
|
58
58
|
function pathMappingBase(tsconfig, config) {
|
|
59
59
|
const baseUrl = tsconfig.compilerOptions.baseUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-updater.js","sourceRoot":"","sources":["../../../src/commands/init/tsconfig-updater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,sBAAsB,CAAC;AACjE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QAAa;IAC9D,MAAM,cAAc,GAAG,WAAW,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAChE,MAAM,SAAS,CAAC,YAAY,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -6,11 +6,11 @@ import * as path from 'path';
|
|
|
6
6
|
const ZARD_PROVIDER_IMPORT = (corePath) => `import { provideZard } from '${corePath}/provider/providezard';`;
|
|
7
7
|
const ZARD_PROVIDER_ENTRY = 'provideZard()';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Appends the provider to the end of the list.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* The `]` stays on its own line: the list is code the user will read and edit
|
|
12
|
+
* later, and welding the closing bracket onto the last provider leaves the file
|
|
13
|
+
* crooked the moment the project's Prettier does not run afterwards.
|
|
14
14
|
*/
|
|
15
15
|
function withProvider(content, providers, eol) {
|
|
16
16
|
const body = providers.body.replace(/\s+$/, '');
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export declare function findViteConfig(cwd: string): string | null;
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Registers Tailwind as a Vite plugin.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* In Analog it is Vite that compiles, not the Angular build — a
|
|
6
|
+
* `.postcssrc.json` there is read by nobody, and without the plugin the
|
|
7
|
+
* `@import 'tailwindcss'` the theme writes into the global CSS emits no
|
|
8
|
+
* utilities at all.
|
|
8
9
|
*/
|
|
9
10
|
export declare function setupVitePlugin(cwd: string): Promise<void>;
|
|
10
11
|
//# sourceMappingURL=vite-setup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-setup.d.ts","sourceRoot":"","sources":["../../../src/commands/init/vite-setup.ts"],"names":[],"mappings":"AAYA,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEzD;AAED
|
|
1
|
+
{"version":3,"file":"vite-setup.d.ts","sourceRoot":"","sources":["../../../src/commands/init/vite-setup.ts"],"names":[],"mappings":"AAYA,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEzD;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBhE"}
|
|
@@ -5,17 +5,18 @@ import { readFile, writeFile } from 'node:fs/promises';
|
|
|
5
5
|
import * as path from 'node:path';
|
|
6
6
|
const TAILWIND_IMPORT = "import tailwindcss from '@tailwindcss/vite';";
|
|
7
7
|
const TAILWIND_PLUGIN = 'tailwindcss()';
|
|
8
|
-
/**
|
|
8
|
+
/** The names Vite accepts, in the order it looks for them. */
|
|
9
9
|
const CONFIG_FILES = ['vite.config.ts', 'vite.config.mts', 'vite.config.js', 'vite.config.mjs'];
|
|
10
10
|
export function findViteConfig(cwd) {
|
|
11
11
|
return CONFIG_FILES.map(name => path.join(cwd, name)).find(existsSync) ?? null;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Registers Tailwind as a Vite plugin.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* In Analog it is Vite that compiles, not the Angular build — a
|
|
17
|
+
* `.postcssrc.json` there is read by nobody, and without the plugin the
|
|
18
|
+
* `@import 'tailwindcss'` the theme writes into the global CSS emits no
|
|
19
|
+
* utilities at all.
|
|
19
20
|
*/
|
|
20
21
|
export async function setupVitePlugin(cwd) {
|
|
21
22
|
const configPath = findViteConfig(cwd);
|
|
@@ -36,10 +37,10 @@ export async function setupVitePlugin(cwd) {
|
|
|
36
37
|
await writeFile(configPath, withPlugin, 'utf8');
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
|
-
*
|
|
40
|
+
* Appends `tailwindcss()` to the plugin list.
|
|
40
41
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
42
|
+
* It goes at the end: order matters to Vite, and Analog's plugin has to process
|
|
43
|
+
* the Angular files before Tailwind scans them for classes.
|
|
43
44
|
*/
|
|
44
45
|
function registerPlugin(content, eol) {
|
|
45
46
|
const plugins = arrayRange(content, 'plugins');
|
|
@@ -47,8 +48,8 @@ function registerPlugin(content, eol) {
|
|
|
47
48
|
return null;
|
|
48
49
|
if (plugins.body.includes(TAILWIND_PLUGIN))
|
|
49
50
|
return content;
|
|
50
|
-
//
|
|
51
|
-
//
|
|
51
|
+
// The existing items' indentation is whatever the file already uses; matching
|
|
52
|
+
// it keeps the new line from standing out when no Prettier runs afterwards.
|
|
52
53
|
const indent = /\n([ \t]+)\S/.exec(plugins.body)?.[1] ?? ' ';
|
|
53
54
|
const closingIndent = indent.slice(0, Math.max(0, indent.length - 2));
|
|
54
55
|
const trimmed = plugins.body.replace(/\s+$/, '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-setup.js","sourceRoot":"","sources":["../../../src/commands/init/vite-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,eAAe,GAAG,8CAA8C,CAAC;AACvE,MAAM,eAAe,GAAG,eAAe,CAAC;AAExC,
|
|
1
|
+
{"version":3,"file":"vite-setup.js","sourceRoot":"","sources":["../../../src/commands/init/vite-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAs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AK,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CACjC,CAAC;AACJ,CAAC"}
|
|
@@ -8,18 +8,18 @@ export interface InitWizardOptions {
|
|
|
8
8
|
readonly projectInfo: ProjectInfo;
|
|
9
9
|
readonly packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
10
10
|
readonly isReInitializing: boolean;
|
|
11
|
-
/**
|
|
11
|
+
/** Skips the final confirmation (`--yes`). */
|
|
12
12
|
readonly skipConfirmation: boolean;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* The type asked for with `--type`, if any.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* The question is still asked — the flag only puts the cursor on what the user
|
|
17
|
+
* already said they wanted, instead of making them find it in the list again.
|
|
18
18
|
*/
|
|
19
19
|
readonly presetKind?: ProjectKind;
|
|
20
20
|
/** O projeto pedido em `--project`, pelo mesmo motivo. */
|
|
21
21
|
readonly presetProjectRoot?: string;
|
|
22
|
-
/**
|
|
22
|
+
/** Execution steps, built only once the config is ready. */
|
|
23
23
|
buildSteps(config: Config): InitStep[];
|
|
24
24
|
}
|
|
25
25
|
export interface InitWizardResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../../src/commands/init/wizard.ts"],"names":[],"mappings":"AACA,OAAO,EAAmD,KAAK,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACvH,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAwBL,KAAK,SAAS,EAKf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gCAAgC,CAAC;AAuMzF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAA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,OAAO,CAAC,gBAAgB,CAAC,CAqVzF"}
|
package/commands/init/wizard.js
CHANGED
|
@@ -24,12 +24,12 @@ function themeStep() {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* The header line, saying where the install will land.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* Before the first answer there is no target to announce — the type is the
|
|
30
|
+
* user's choice, and pre-empting it here would suggest the CLI already decided.
|
|
31
|
+
* With a single compatible project the wizard does not ask which one either, so
|
|
32
|
+
* this is where its name appears, to keep the choice from being implicit.
|
|
33
33
|
*/
|
|
34
34
|
function targetDescription(state, options) {
|
|
35
35
|
if (!state.kindChosen)
|
|
@@ -41,11 +41,11 @@ function targetDescription(state, options) {
|
|
|
41
41
|
return `Setting up zard/ui in your ${label} project…`;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* The first question, always.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* The user decides the type: the list opens in full, in menu order, with no
|
|
47
|
+
* preselection derived from what is in the directory. Everything that comes
|
|
48
|
+
* after — the suggested paths, the steps that run — follows from this answer.
|
|
49
49
|
*/
|
|
50
50
|
function kindStep() {
|
|
51
51
|
return {
|
|
@@ -59,10 +59,10 @@ function kindStep() {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* Project choice, only when more than one is compatible.
|
|
63
63
|
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* With a single candidate the question would have no alternative answer; the
|
|
65
|
+
* name appears in the header and the user goes straight to the next step.
|
|
66
66
|
*/
|
|
67
67
|
function projectStep(projects, kind) {
|
|
68
68
|
const library = isLibraryKind(kind);
|
|
@@ -144,14 +144,14 @@ function baseSteps(projectInfo, kind) {
|
|
|
144
144
|
];
|
|
145
145
|
}
|
|
146
146
|
export async function runInitWizard(options) {
|
|
147
|
-
//
|
|
148
|
-
//
|
|
149
|
-
//
|
|
147
|
+
// The menu opens on the first type in the list, not on what the directory
|
|
148
|
+
// suggests: the choice is the user's, and a cursor already parked on another
|
|
149
|
+
// item would turn a CLI guess into the answer they confirm without reading.
|
|
150
150
|
const firstKind = options.presetKind ?? PROJECT_KINDS[0].value;
|
|
151
151
|
const answers = defaultAnswers(options.projectInfo, firstKind, options.presetProjectRoot);
|
|
152
152
|
const state = {
|
|
153
|
-
//
|
|
154
|
-
//
|
|
153
|
+
// Re-initializing overwrites existing configuration: the confirmation comes
|
|
154
|
+
// before any question and is not skipped by --yes.
|
|
155
155
|
phase: options.isReInitializing ? 'reinit' : 'prompting',
|
|
156
156
|
steps: baseSteps(options.projectInfo, firstKind),
|
|
157
157
|
stepIndex: 0,
|
|
@@ -174,7 +174,7 @@ export async function runInitWizard(options) {
|
|
|
174
174
|
return 'yes';
|
|
175
175
|
return state.answers[step.id];
|
|
176
176
|
};
|
|
177
|
-
/**
|
|
177
|
+
/** Prepares the input fields for the step that has just become active. */
|
|
178
178
|
const enterStep = () => {
|
|
179
179
|
const step = currentStep();
|
|
180
180
|
state.error = null;
|
|
@@ -189,8 +189,8 @@ export async function runInitWizard(options) {
|
|
|
189
189
|
state.confirmValue = step.confirmDefault ?? true;
|
|
190
190
|
}
|
|
191
191
|
};
|
|
192
|
-
//
|
|
193
|
-
//
|
|
192
|
+
// The first step needs its fields prepared too: without this the menu opens
|
|
193
|
+
// with the cursor at the top instead of on the type detection suggested.
|
|
194
194
|
enterStep();
|
|
195
195
|
const startExecution = (ctx) => {
|
|
196
196
|
const resolved = buildConfig(state.answers, options.packageManager);
|
|
@@ -266,9 +266,9 @@ export async function runInitWizard(options) {
|
|
|
266
266
|
advance(ctx);
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
|
-
//
|
|
270
|
-
//
|
|
271
|
-
//
|
|
269
|
+
// Changing the project type changes the following questions and the defaults
|
|
270
|
+
// that depend on it — the CSS path, for one, stops being the app's. The theme
|
|
271
|
+
// is preserved because it does not depend on the type.
|
|
272
272
|
if (step.id === 'kind') {
|
|
273
273
|
const kind = value;
|
|
274
274
|
state.answers = { ...defaultAnswers(options.projectInfo, kind), theme: state.answers.theme };
|
|
@@ -277,9 +277,9 @@ export async function runInitWizard(options) {
|
|
|
277
277
|
advance(ctx);
|
|
278
278
|
return;
|
|
279
279
|
}
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
// init
|
|
280
|
+
// Changing the target project moves app.config and the global CSS with it:
|
|
281
|
+
// those are that project's paths, and leaving them pointing at the previous
|
|
282
|
+
// one would make init write into the wrong app.
|
|
283
283
|
if (step.id === 'projectRoot') {
|
|
284
284
|
state.answers = {
|
|
285
285
|
...defaultAnswers(options.projectInfo, state.answers.kind, value),
|
|
@@ -293,9 +293,9 @@ export async function runInitWizard(options) {
|
|
|
293
293
|
advance(ctx);
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
//
|
|
296
|
+
// The CSS path is the only one that has to exist before going on: it is what
|
|
297
|
+
// receives the theme tokens. A library has no pre-existing global CSS — init
|
|
298
|
+
// creates the file, so "does not exist" is the expected case.
|
|
299
299
|
state.checking = true;
|
|
300
300
|
ctx.refresh();
|
|
301
301
|
void inspectCssFile(options.cwd, value).then(result => {
|