zard-cli 1.1.0-alpha.0 → 1.1.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/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
package/commands/init/steps.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { installComponent } from '
|
|
2
|
-
import { installDependencies } from '
|
|
3
|
-
import { bundlerFor, isLibraryKind, projectRootOf, tsconfigFileFor } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { installComponent } from '../add/component-installer.js';
|
|
2
|
+
import { installDependencies } from './dependencies.js';
|
|
3
|
+
import { bundlerFor, indexHtmlFor, isLibraryKind, projectRootOf, tsconfigFileFor, } from './project-kind.js';
|
|
4
|
+
import { setupRtlDirection } from './rtl-setup.js';
|
|
5
|
+
import { applyThemeToStyles, createPostCssConfig } from './tailwind-setup.js';
|
|
6
|
+
import { updateTsConfig } from './tsconfig-updater.js';
|
|
7
|
+
import { updateAngularConfig } from './update-angular-config.js';
|
|
8
|
+
import { setupVitePlugin } from './vite-setup.js';
|
|
9
|
+
import { iconFamily } from '../../core/icons/index.js';
|
|
8
10
|
import { resolveConfigPaths } from '../../utils/config.js';
|
|
11
|
+
import { iconCatalog } from '../../utils/icon-catalog.js';
|
|
9
12
|
import { logger } from '../../utils/logger.js';
|
|
10
13
|
import { existsSync } from 'node:fs';
|
|
11
14
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
@@ -25,16 +28,16 @@ export function buildInitSteps(cwd, config, projectInfo, isReInitializing) {
|
|
|
25
28
|
},
|
|
26
29
|
{
|
|
27
30
|
label: 'dependencies',
|
|
28
|
-
note:
|
|
31
|
+
note: `CDK, CVA, tailwind-merge, ng-icons (${iconFamily(config.icons, iconCatalog())?.label ?? config.icons})`,
|
|
29
32
|
run: () => installDependencies(cwd, config, projectInfo),
|
|
30
33
|
},
|
|
31
34
|
];
|
|
32
|
-
//
|
|
33
|
-
//
|
|
35
|
+
// Application providers do not belong to the library: the app consuming it
|
|
36
|
+
// registers them, and a library has no app.config.ts to write into.
|
|
34
37
|
if (!isLibrary) {
|
|
35
38
|
steps.push({
|
|
36
39
|
label: config.appConfigFile,
|
|
37
|
-
note: '
|
|
40
|
+
note: 'zard/ui providers',
|
|
38
41
|
run: () => updateAngularConfig(cwd, config),
|
|
39
42
|
});
|
|
40
43
|
steps.push(tailwindPipelineStep(cwd, projectRoot, kind, projectInfo, isReInitializing));
|
|
@@ -51,6 +54,18 @@ export function buildInitSteps(cwd, config, projectInfo, isReInitializing) {
|
|
|
51
54
|
run: () => registerStylesAsset(cwd, config),
|
|
52
55
|
});
|
|
53
56
|
}
|
|
57
|
+
// Libraries have no index.html (the consuming app owns it), so there is
|
|
58
|
+
// nothing to set there; `rtl: true` in components.json is still recorded.
|
|
59
|
+
if (config.rtl && !isLibrary) {
|
|
60
|
+
const indexFile = indexHtmlOf(config, projectInfo);
|
|
61
|
+
steps.push({
|
|
62
|
+
label: indexFile,
|
|
63
|
+
note: 'dir="rtl" on <html>',
|
|
64
|
+
run: async () => {
|
|
65
|
+
await setupRtlDirection(cwd, indexFile);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
54
69
|
steps.push({
|
|
55
70
|
label: tsconfigFile,
|
|
56
71
|
note: 'import path aliases',
|
|
@@ -63,13 +78,24 @@ export function buildInitSteps(cwd, config, projectInfo, isReInitializing) {
|
|
|
63
78
|
return steps;
|
|
64
79
|
}
|
|
65
80
|
/**
|
|
66
|
-
*
|
|
81
|
+
* The app's index.html: the one its build target declares, else the layout's default.
|
|
67
82
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
* The declared `index` wins because it is what the build really reads; the default
|
|
84
|
+
* is only a guess from the project type and where app.config lives.
|
|
85
|
+
*/
|
|
86
|
+
function indexHtmlOf(config, projectInfo) {
|
|
87
|
+
const root = projectRootOf(config.baseUrl);
|
|
88
|
+
const declared = projectInfo.projects.find(project => (project.root || '.') === root)?.index;
|
|
89
|
+
return declared ?? indexHtmlFor(config.projectType, config.baseUrl);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* How Tailwind enters the application build.
|
|
93
|
+
*
|
|
94
|
+
* In Analog it is Vite that compiles, and Tailwind is one of its plugins — a
|
|
95
|
+
* `.postcssrc.json` there would be read by nobody. Everywhere else the Angular
|
|
96
|
+
* build loads PostCSS, and the file goes to the project root: in a workspace
|
|
97
|
+
* with several apps, writing it at the repository root would configure all of
|
|
98
|
+
* them at once.
|
|
73
99
|
*/
|
|
74
100
|
function tailwindPipelineStep(cwd, projectRoot, kind, projectInfo, isReInitializing) {
|
|
75
101
|
if (bundlerFor(kind) === 'vite') {
|
|
@@ -83,51 +109,86 @@ function tailwindPipelineStep(cwd, projectRoot, kind, projectInfo, isReInitializ
|
|
|
83
109
|
return {
|
|
84
110
|
label: relative,
|
|
85
111
|
note: 'Tailwind PostCSS plugin',
|
|
86
|
-
//
|
|
87
|
-
// `.postcssrc.json`
|
|
112
|
+
// Re-initializing rewrites the file on purpose: it is the chance to correct a
|
|
113
|
+
// `.postcssrc.json` left over from an earlier setup.
|
|
88
114
|
run: () => !projectInfo.hasTailwind || isReInitializing || !existsSync(path.resolve(cwd, relative))
|
|
89
115
|
? createPostCssConfig(cwd, projectRoot)
|
|
90
116
|
: Promise.resolve(),
|
|
91
117
|
};
|
|
92
118
|
}
|
|
93
119
|
/**
|
|
94
|
-
*
|
|
120
|
+
* Declares the theme CSS as a library asset.
|
|
95
121
|
*
|
|
96
|
-
*
|
|
97
|
-
* `src/`
|
|
98
|
-
*
|
|
99
|
-
*
|
|
122
|
+
* ng-packagr only publishes what the entry point reaches; a loose `.css` in
|
|
123
|
+
* `src/` stays out of the package. Without this entry, the file the previous
|
|
124
|
+
* step wrote would exist only in the repository and never reach whoever
|
|
125
|
+
* installs the library.
|
|
100
126
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
127
|
+
* The asset is declared with `output: '/'` so it lands at the package root.
|
|
128
|
+
* Listing it as a plain path preserves the source folder, and the consumer would
|
|
129
|
+
* end up importing `<lib>/src/styles.css` — a `src/` that is a detail of the
|
|
130
|
+
* library's repository, not something whoever installs it should know.
|
|
105
131
|
*/
|
|
106
132
|
async function registerStylesAsset(cwd, config) {
|
|
107
133
|
const libraryRoot = path.resolve(cwd, projectRootOf(config.baseUrl));
|
|
108
134
|
const ngPackagePath = path.join(libraryRoot, 'ng-package.json');
|
|
109
135
|
if (!existsSync(ngPackagePath)) {
|
|
110
|
-
//
|
|
111
|
-
//
|
|
136
|
+
// An Nx library only gets an ng-package.json when it is publishable; in the
|
|
137
|
+
// others there is no package to assemble and the CSS is consumed straight
|
|
138
|
+
// from the source.
|
|
112
139
|
logger.warn(`ng-package.json not found in ${path.relative(cwd, libraryRoot)}; skipping the theme asset.`);
|
|
113
140
|
return;
|
|
114
141
|
}
|
|
115
142
|
const relative = path.relative(libraryRoot, path.resolve(cwd, config.tailwind.css)).split(path.sep).join('/');
|
|
116
143
|
const input = path.posix.dirname(relative);
|
|
117
|
-
|
|
118
|
-
|
|
144
|
+
// Every stylesheet under the theme's folder, not just the theme: it imports
|
|
145
|
+
// the core's `zard.css` from `lib/shared/core/css`, and `add` writes
|
|
146
|
+
// `typeset.css` and `utilities.css` beside it. Shipping the theme alone left
|
|
147
|
+
// the published package with imports pointing at files it did not contain.
|
|
148
|
+
const entry = { glob: '**/*.css', input, output: '/' };
|
|
119
149
|
const ngPackage = JSON.parse(await readFile(ngPackagePath, 'utf8'));
|
|
120
150
|
const assets = Array.isArray(ngPackage.assets) ? ngPackage.assets : [];
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
|
|
151
|
+
// Old entries pointing at the same files are replaced, not accumulated: a
|
|
152
|
+
// repeated init would otherwise publish the CSS twice, in two places. That
|
|
153
|
+
// includes the entry earlier versions wrote for the theme file alone.
|
|
154
|
+
const legacy = { glob: path.posix.basename(relative), input };
|
|
155
|
+
const others = assets.filter(asset => !describesSameFile(asset, relative, entry) && !describesSameFile(asset, relative, legacy));
|
|
124
156
|
const alreadyCorrect = assets.length === others.length + 1 && hasEntry(assets, entry);
|
|
125
|
-
if (alreadyCorrect)
|
|
157
|
+
if (!alreadyCorrect) {
|
|
158
|
+
ngPackage.assets = [...others, entry];
|
|
159
|
+
await writeFile(ngPackagePath, `${JSON.stringify(ngPackage, null, 2)}\n`, 'utf8');
|
|
160
|
+
}
|
|
161
|
+
await exportStylesheet(libraryRoot, path.posix.basename(relative));
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Lets the consumer import the theme by the package name (`@import 'ui/styles.css'`).
|
|
165
|
+
*
|
|
166
|
+
* ng-packagr writes an `exports` map, and a package with one allows no subpath
|
|
167
|
+
* it does not list — the shipped file existed, but the consumer's build refused
|
|
168
|
+
* to resolve it. Entries declared in the library's `package.json` are merged
|
|
169
|
+
* into that map.
|
|
170
|
+
*/
|
|
171
|
+
async function exportStylesheet(libraryRoot, fileName) {
|
|
172
|
+
const packageJsonPath = path.join(libraryRoot, 'package.json');
|
|
173
|
+
if (!existsSync(packageJsonPath))
|
|
174
|
+
return;
|
|
175
|
+
const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf8'));
|
|
176
|
+
const key = `./${fileName}`;
|
|
177
|
+
// `"exports": "./index.js"` (or an array of fallbacks) is shorthand for the
|
|
178
|
+
// package root; spreading it would turn the string into one key per character.
|
|
179
|
+
const current = packageJson.exports;
|
|
180
|
+
// The same goes for a map of conditions (`{ import, require }`): Node rejects
|
|
181
|
+
// one that mixes condition keys with subpaths, so they move under `.` too.
|
|
182
|
+
const isRootShorthand = typeof current === 'string' ||
|
|
183
|
+
Array.isArray(current) ||
|
|
184
|
+
(current && typeof current === 'object' && Object.keys(current).some(name => !name.startsWith('.')));
|
|
185
|
+
const exportsMap = isRootShorthand ? { '.': current } : { ...(current ?? {}) };
|
|
186
|
+
if (exportsMap[key])
|
|
126
187
|
return;
|
|
127
|
-
|
|
128
|
-
await writeFile(
|
|
188
|
+
packageJson.exports = { ...exportsMap, [key]: { style: key, default: key } };
|
|
189
|
+
await writeFile(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`, 'utf8');
|
|
129
190
|
}
|
|
130
|
-
/**
|
|
191
|
+
/** Whether an already-declared asset publishes exactly the same file. */
|
|
131
192
|
function describesSameFile(asset, relative, entry) {
|
|
132
193
|
if (typeof asset === 'string')
|
|
133
194
|
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,
|
|
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,EACL,UAAU,EACV,YAAY,EACZ,aAAa,EACb,aAAa,EACb,eAAe,GAChB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAe,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAA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KAAK,KAAK,CAAC,KAAK,CAAC;AAC1E,CAAC;AAED,SAAS,QAAQ,CAAC,MAAiB,EAAE,KAAsD;IACzF,OAAO,MAAM,CAAC,IAAI,CAChB,KAAK,CAAC,EAAE,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAiC,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI;QACrD,KAAiC,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK;QACvD,KAAiC,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAC7D,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,uBAAuB,CAAC,GAAW,EAAE,MAAc;IAChE,MAAM,cAAc,GAAG,MAAM,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAE7D,MAAM,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpE,MAAM,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAErE,MAAM,gBAAgB,CAAC,MAAM,EAAE,cAAc,CAAC,aAAa,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAClF,MAAM,gBAAgB,CAAC,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AACtF,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type Config } from '../../utils/config.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Writes `.postcssrc.json` at the root of the project that will use it.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailwind-setup.d.ts","sourceRoot":"","sources":["../../../src/commands/init/tailwind-setup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tailwind-setup.d.ts","sourceRoot":"","sources":["../../../src/commands/init/tailwind-setup.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAYvE;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,SAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKvF;AAkCD,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASnF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isLibraryKind } from './project-kind.js';
|
|
1
2
|
import { resolveAliasToPath } from '../../utils/config.js';
|
|
2
3
|
import { getThemeContent } from '../../utils/theme-selector.js';
|
|
3
4
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
@@ -9,12 +10,12 @@ const POSTCSS_CONFIG = `{
|
|
|
9
10
|
}
|
|
10
11
|
`;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
+
* Writes `.postcssrc.json` at the root of the project that will use it.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* The Angular build looks for the file starting from the CSS it is processing
|
|
16
|
+
* and walks up to the workspace root, so the project is the most specific place
|
|
17
|
+
* that works — and in a monorepo with several apps it is the only one that does
|
|
18
|
+
* not configure all of them at once. `projectRoot` is `.` for a single app.
|
|
18
19
|
*/
|
|
19
20
|
export async function createPostCssConfig(cwd, projectRoot = '.') {
|
|
20
21
|
const targetDir = path.resolve(cwd, projectRoot);
|
|
@@ -22,14 +23,14 @@ export async function createPostCssConfig(cwd, projectRoot = '.') {
|
|
|
22
23
|
await writeFile(path.join(targetDir, '.postcssrc.json'), POSTCSS_CONFIG, 'utf8');
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* The CSS `@import` is resolved by the bundler relative to the file containing
|
|
27
|
+
* it, so it has to be a real relative path — it cannot be assembled by slicing
|
|
28
|
+
* the alias.
|
|
28
29
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* `projects/admin/src/app`
|
|
32
|
-
*
|
|
30
|
+
* The previous version took the second segment of baseUrl and pasted the alias
|
|
31
|
+
* without its first character. It only worked for the `src/app` + `@/...`
|
|
32
|
+
* layout: with baseUrl `projects/admin/src/app` it aimed at `./admin/...`, and
|
|
33
|
+
* with an `@app/core` alias it produced `./appapp/core`.
|
|
33
34
|
*/
|
|
34
35
|
function coreImportPath(cwd, config) {
|
|
35
36
|
const cssDir = path.dirname(path.resolve(cwd, config.tailwind.css));
|
|
@@ -37,11 +38,24 @@ function coreImportPath(cwd, config) {
|
|
|
37
38
|
const relative = path.relative(cssDir, coreDir).split(path.sep).join('/');
|
|
38
39
|
return relative.startsWith('.') ? relative : `./${relative}`;
|
|
39
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Where the consumer's Tailwind finds the classes a library's components use.
|
|
43
|
+
*
|
|
44
|
+
* Tailwind skips `node_modules` when it detects sources, so an app installing
|
|
45
|
+
* the published library generated none of the utilities its components need.
|
|
46
|
+
* `./` is relative to this stylesheet: in the package that is its root, beside
|
|
47
|
+
* the bundled JavaScript; in the workspace, the library's own `src`. It goes
|
|
48
|
+
* after the `@plugin` line so the `@import`s `add` appends stay first.
|
|
49
|
+
*/
|
|
50
|
+
function withLibrarySource(themeContent) {
|
|
51
|
+
return themeContent.replace(/^(@plugin [^\n]*;)$/m, `$1\n@source './';`);
|
|
52
|
+
}
|
|
40
53
|
export async function applyThemeToStyles(cwd, config) {
|
|
41
54
|
const stylesPath = path.join(cwd, config.tailwind.css);
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
//
|
|
55
|
+
const baseTheme = getThemeContent(config.tailwind.baseColor, coreImportPath(cwd, config));
|
|
56
|
+
const themeContent = isLibraryKind(config.projectType) ? withLibrarySource(baseTheme) : baseTheme;
|
|
57
|
+
// In a library that file usually does not exist — init creates it, so the
|
|
58
|
+
// library can expose the tokens to whoever consumes it.
|
|
45
59
|
await mkdir(path.dirname(stylesPath), { recursive: true });
|
|
46
60
|
await writeFile(stylesPath, themeContent, 'utf8');
|
|
47
61
|
}
|
|
@@ -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;IAC5C,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,CAA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AG,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1F,MAAM,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAElG,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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M,CAAC,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC;AACzG,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,YAAoB,EAAE,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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IAAI,OAAO,GAAG,GAAG,GAAG,MAAM,GAAG,eAAe,IAAI,GAAG,GAAG,aAAa,GAAG;QACtE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CACjC,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
1
|
+
import { type PresetAnswers } from './config-prompter.js';
|
|
2
|
+
import { type ProjectKind } from './project-kind.js';
|
|
3
|
+
import { type InitStep } from './steps.js';
|
|
3
4
|
import { type LogRecord } from '../../ui/index.js';
|
|
4
5
|
import { type Config } from '../../utils/config.js';
|
|
5
6
|
import { type ProjectInfo } from '../../utils/get-project-info.js';
|
|
@@ -8,18 +9,20 @@ export interface InitWizardOptions {
|
|
|
8
9
|
readonly projectInfo: ProjectInfo;
|
|
9
10
|
readonly packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
10
11
|
readonly isReInitializing: boolean;
|
|
11
|
-
/**
|
|
12
|
+
/** Skips the final confirmation (`--yes`). */
|
|
12
13
|
readonly skipConfirmation: boolean;
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
+
* The type asked for with `--type`, if any.
|
|
15
16
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
17
|
+
* The question is still asked — the flag only puts the cursor on what the user
|
|
18
|
+
* already said they wanted, instead of making them find it in the list again.
|
|
18
19
|
*/
|
|
19
20
|
readonly presetKind?: ProjectKind;
|
|
20
21
|
/** O projeto pedido em `--project`, pelo mesmo motivo. */
|
|
21
22
|
readonly presetProjectRoot?: string;
|
|
22
|
-
/**
|
|
23
|
+
/** What `--css`, `--app-config`, `--base-color` and the alias flags answered — each question opens filled with it. */
|
|
24
|
+
readonly presetAnswers?: PresetAnswers;
|
|
25
|
+
/** Execution steps, built only once the config is ready. */
|
|
23
26
|
buildSteps(config: Config): InitStep[];
|
|
24
27
|
}
|
|
25
28
|
export interface InitWizardResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../../src/commands/init/wizard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../../src/commands/init/wizard.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EACnB,MAAM,uCAAuC,CAAC;AAC/C,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;AAwNzF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACzD,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,8CAA8C;IAC9C,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC;IAClC,0DAA0D;IAC1D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,sHAAsH;IACtH,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACvC,4DAA4D;IAC5D,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE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