@nx/vite 18.1.0-beta.0 → 18.1.0-beta.2
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/package.json +4 -4
- package/src/executors/test/lib/utils.js +39 -1
- package/src/executors/test/lib/utils.js.map +1 -1
- package/src/generators/configuration/configuration.js +6 -68
- package/src/generators/configuration/configuration.js.map +1 -1
- package/src/generators/configuration/lib/convert-non-vite.d.ts +5 -0
- package/src/generators/configuration/lib/convert-non-vite.js +62 -0
- package/src/generators/configuration/lib/convert-non-vite.js.map +1 -0
- package/src/generators/configuration/schema.d.ts +0 -3
- package/src/generators/configuration/schema.json +0 -12
- package/src/generators/vitest/vitest-generator.js +2 -2
- package/src/generators/vitest/vitest-generator.js.map +1 -1
- package/src/migrations/update-16-6-0-change-ts-paths-plugin/change-ts-paths-plugin.js +2 -16
- package/src/migrations/update-16-6-0-change-ts-paths-plugin/change-ts-paths-plugin.js.map +1 -1
- package/src/migrations/update-17-2-0/update-vite-config.js +2 -16
- package/src/migrations/update-17-2-0/update-vite-config.js.map +1 -1
- package/src/{migrations/update-17-2-0/lib → utils}/find-vite-config.d.ts +1 -0
- package/src/utils/find-vite-config.js +46 -0
- package/src/utils/find-vite-config.js.map +1 -0
- package/src/utils/generator-utils.d.ts +8 -11
- package/src/utils/generator-utils.js +71 -186
- package/src/utils/generator-utils.js.map +1 -1
- package/src/utils/test-utils.js +8 -16
- package/src/utils/test-utils.js.map +1 -1
- package/src/migrations/update-17-2-0/lib/find-vite-config.js +0 -25
- package/src/migrations/update-17-2-0/lib/find-vite-config.js.map +0 -1
- package/src/utils/test-files/react-project.config.json +0 -82
- package/src/utils/test-files/web-project.config.json +0 -69
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _export(target, all) {
|
|
3
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
get: all[name]
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
_export(exports, {
|
|
9
|
+
findViteConfig: function() {
|
|
10
|
+
return findViteConfig;
|
|
11
|
+
},
|
|
12
|
+
findWebpackConfig: function() {
|
|
13
|
+
return findWebpackConfig;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const _devkit = require("@nx/devkit");
|
|
17
|
+
function findViteConfig(tree, searchRoot) {
|
|
18
|
+
const allowsExt = [
|
|
19
|
+
'js',
|
|
20
|
+
'mjs',
|
|
21
|
+
'ts',
|
|
22
|
+
'cjs',
|
|
23
|
+
'mts',
|
|
24
|
+
'cts'
|
|
25
|
+
];
|
|
26
|
+
for (const ext of allowsExt){
|
|
27
|
+
if (tree.exists((0, _devkit.joinPathFragments)(searchRoot, `vite.config.${ext}`))) {
|
|
28
|
+
return (0, _devkit.joinPathFragments)(searchRoot, `vite.config.${ext}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function findWebpackConfig(tree, searchRoot) {
|
|
33
|
+
const allowsExt = [
|
|
34
|
+
'js',
|
|
35
|
+
'ts',
|
|
36
|
+
'mjs',
|
|
37
|
+
'cjs'
|
|
38
|
+
];
|
|
39
|
+
for (const ext of allowsExt){
|
|
40
|
+
if (tree.exists((0, _devkit.joinPathFragments)(searchRoot, `webpack.config.${ext}`))) {
|
|
41
|
+
return (0, _devkit.joinPathFragments)(searchRoot, `webpack.config.${ext}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=find-vite-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/vite/src/utils/find-vite-config.ts"],"sourcesContent":["import { Tree, joinPathFragments } from '@nx/devkit';\n\nexport function findViteConfig(tree: Tree, searchRoot: string) {\n const allowsExt = ['js', 'mjs', 'ts', 'cjs', 'mts', 'cts'];\n\n for (const ext of allowsExt) {\n if (tree.exists(joinPathFragments(searchRoot, `vite.config.${ext}`))) {\n return joinPathFragments(searchRoot, `vite.config.${ext}`);\n }\n }\n}\n\nexport function findWebpackConfig(tree: Tree, searchRoot: string) {\n const allowsExt = ['js', 'ts', 'mjs', 'cjs'];\n\n for (const ext of allowsExt) {\n if (tree.exists(joinPathFragments(searchRoot, `webpack.config.${ext}`))) {\n return joinPathFragments(searchRoot, `webpack.config.${ext}`);\n }\n }\n}\n"],"names":["findViteConfig","findWebpackConfig","tree","searchRoot","allowsExt","ext","exists","joinPathFragments"],"mappings":";;;;;;;;IAEgBA,cAAc;eAAdA;;IAUAC,iBAAiB;eAAjBA;;;wBAZwB;AAEjC,SAASD,eAAeE,IAAU,EAAEC,UAAkB;IAC3D,MAAMC,YAAY;QAAC;QAAM;QAAO;QAAM;QAAO;QAAO;KAAM;IAE1D,KAAK,MAAMC,OAAOD,UAAW;QAC3B,IAAIF,KAAKI,MAAM,CAACC,IAAAA,yBAAiB,EAACJ,YAAY,CAAC,YAAY,EAAEE,IAAI,CAAC,IAAI;YACpE,OAAOE,IAAAA,yBAAiB,EAACJ,YAAY,CAAC,YAAY,EAAEE,IAAI,CAAC;QAC3D;IACF;AACF;AAEO,SAASJ,kBAAkBC,IAAU,EAAEC,UAAkB;IAC9D,MAAMC,YAAY;QAAC;QAAM;QAAM;QAAO;KAAM;IAE5C,KAAK,MAAMC,OAAOD,UAAW;QAC3B,IAAIF,KAAKI,MAAM,CAACC,IAAAA,yBAAiB,EAACJ,YAAY,CAAC,eAAe,EAAEE,IAAI,CAAC,IAAI;YACvE,OAAOE,IAAAA,yBAAiB,EAACJ,YAAY,CAAC,eAAe,EAAEE,IAAI,CAAC;QAC9D;IACF;AACF"}
|
|
@@ -4,29 +4,26 @@ export type Target = 'build' | 'serve' | 'test' | 'preview';
|
|
|
4
4
|
export type TargetFlags = Partial<Record<Target, boolean>>;
|
|
5
5
|
export type UserProvidedTargetName = Partial<Record<Target, string>>;
|
|
6
6
|
export type ValidFoundTargetName = Partial<Record<Target, string>>;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function findExistingJsBuildTargetInProject(targets: {
|
|
8
8
|
[targetName: string]: TargetConfiguration;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
userProvidedTargetIsUnsupported: TargetFlags;
|
|
13
|
-
alreadyHasNxViteTargets: TargetFlags;
|
|
9
|
+
}): {
|
|
10
|
+
supported?: string;
|
|
11
|
+
unsupported?: string;
|
|
14
12
|
};
|
|
15
13
|
export declare function addOrChangeTestTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
14
|
+
export declare function addBuildTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
|
|
15
|
+
export declare function addServeTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, target: string): void;
|
|
18
16
|
/**
|
|
19
17
|
* Adds a target for the preview server.
|
|
20
18
|
*
|
|
21
19
|
* @param tree
|
|
22
20
|
* @param options
|
|
23
21
|
* @param serveTarget An existing serve target.
|
|
24
|
-
* @param previewTarget The preview target to create.
|
|
25
22
|
*/
|
|
26
23
|
export declare function addPreviewTarget(tree: Tree, options: ViteConfigurationGeneratorSchema, serveTarget: string): void;
|
|
27
24
|
export declare function editTsConfig(tree: Tree, options: ViteConfigurationGeneratorSchema): void;
|
|
28
25
|
export declare function deleteWebpackConfig(tree: Tree, projectRoot: string, webpackConfigFilePath?: string): void;
|
|
29
|
-
export declare function moveAndEditIndexHtml(tree: Tree, options: ViteConfigurationGeneratorSchema
|
|
26
|
+
export declare function moveAndEditIndexHtml(tree: Tree, options: ViteConfigurationGeneratorSchema): void;
|
|
30
27
|
export interface ViteConfigFileOptions {
|
|
31
28
|
project: string;
|
|
32
29
|
includeLib?: boolean;
|
|
@@ -42,4 +39,4 @@ export declare function createOrEditViteConfig(tree: Tree, options: ViteConfigFi
|
|
|
42
39
|
export declare function normalizeViteConfigFilePathWithTree(tree: Tree, projectRoot: string, configFile?: string): string;
|
|
43
40
|
export declare function getViteConfigPathForProject(tree: Tree, projectName: string, target?: string): string;
|
|
44
41
|
export declare function handleUnsupportedUserProvidedTargets(userProvidedTargetIsUnsupported: TargetFlags, userProvidedTargetName: UserProvidedTargetName, validFoundTargetName: ValidFoundTargetName): Promise<void>;
|
|
45
|
-
export declare function
|
|
42
|
+
export declare function handleUnknownConfiguration(projectName: string): Promise<void>;
|
|
@@ -6,17 +6,17 @@ function _export(target, all) {
|
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
8
|
_export(exports, {
|
|
9
|
-
|
|
10
|
-
return
|
|
9
|
+
findExistingJsBuildTargetInProject: function() {
|
|
10
|
+
return findExistingJsBuildTargetInProject;
|
|
11
11
|
},
|
|
12
12
|
addOrChangeTestTarget: function() {
|
|
13
13
|
return addOrChangeTestTarget;
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
return
|
|
15
|
+
addBuildTarget: function() {
|
|
16
|
+
return addBuildTarget;
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
return
|
|
18
|
+
addServeTarget: function() {
|
|
19
|
+
return addServeTarget;
|
|
20
20
|
},
|
|
21
21
|
addPreviewTarget: function() {
|
|
22
22
|
return addPreviewTarget;
|
|
@@ -42,43 +42,20 @@ _export(exports, {
|
|
|
42
42
|
handleUnsupportedUserProvidedTargets: function() {
|
|
43
43
|
return handleUnsupportedUserProvidedTargets;
|
|
44
44
|
},
|
|
45
|
-
|
|
46
|
-
return
|
|
45
|
+
handleUnknownConfiguration: function() {
|
|
46
|
+
return handleUnknownConfiguration;
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
const _extends = require("@swc/helpers/_/_extends");
|
|
50
49
|
const _devkit = require("@nx/devkit");
|
|
51
50
|
const _viteconfigeditutils = require("./vite-config-edit-utils");
|
|
52
51
|
const _addbuildtargetdefaults = require("@nx/devkit/src/generators/add-build-target-defaults");
|
|
53
|
-
function
|
|
54
|
-
const output = {
|
|
55
|
-
validFoundTargetName: {},
|
|
56
|
-
projectContainsUnsupportedExecutor: false,
|
|
57
|
-
userProvidedTargetIsUnsupported: {},
|
|
58
|
-
alreadyHasNxViteTargets: {}
|
|
59
|
-
};
|
|
52
|
+
function findExistingJsBuildTargetInProject(targets) {
|
|
53
|
+
const output = {};
|
|
60
54
|
const supportedExecutors = {
|
|
61
55
|
build: [
|
|
62
|
-
'@nxext/vite:build',
|
|
63
56
|
'@nx/js:babel',
|
|
64
57
|
'@nx/js:swc',
|
|
65
|
-
'@nx/
|
|
66
|
-
'@nx/rollup:rollup',
|
|
67
|
-
'@nrwl/js:babel',
|
|
68
|
-
'@nrwl/js:swc',
|
|
69
|
-
'@nrwl/webpack:webpack',
|
|
70
|
-
'@nrwl/rollup:rollup',
|
|
71
|
-
'@nrwl/web:rollup'
|
|
72
|
-
],
|
|
73
|
-
serve: [
|
|
74
|
-
'@nxext/vite:dev',
|
|
75
|
-
'@nx/webpack:dev-server',
|
|
76
|
-
'@nrwl/webpack:dev-server'
|
|
77
|
-
],
|
|
78
|
-
test: [
|
|
79
|
-
'@nx/jest:jest',
|
|
80
|
-
'@nrwl/jest:jest',
|
|
81
|
-
'@nxext/vitest:vitest'
|
|
58
|
+
'@nx/rollup:rollup'
|
|
82
59
|
]
|
|
83
60
|
};
|
|
84
61
|
const unsupportedExecutors = [
|
|
@@ -93,7 +70,6 @@ function findExistingTargetsInProject(targets, userProvidedTargets) {
|
|
|
93
70
|
'@nx/react-native:build-android',
|
|
94
71
|
'@nx/react-native:bundle',
|
|
95
72
|
'@nx/next:build',
|
|
96
|
-
'@nx/next:server',
|
|
97
73
|
'@nx/js:tsc',
|
|
98
74
|
'@nrwl/angular:ng-packagr-lite',
|
|
99
75
|
'@nrwl/angular:package',
|
|
@@ -106,52 +82,20 @@ function findExistingTargetsInProject(targets, userProvidedTargets) {
|
|
|
106
82
|
'@nrwl/react-native:build-android',
|
|
107
83
|
'@nrwl/react-native:bundle',
|
|
108
84
|
'@nrwl/next:build',
|
|
109
|
-
'@nrwl/next:server',
|
|
110
85
|
'@nrwl/js:tsc',
|
|
111
86
|
'@angular-devkit/build-angular:browser',
|
|
112
|
-
'@angular-devkit/build-angular:
|
|
87
|
+
'@angular-devkit/build-angular:browser-esbuild',
|
|
88
|
+
'@angular-devkit/build-angular:application'
|
|
113
89
|
];
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
// If it's not supported, then we set the unsupported flag to true for that target
|
|
117
|
-
function checkUserProvidedTarget(target) {
|
|
118
|
-
if (userProvidedTargets == null ? void 0 : userProvidedTargets[target]) {
|
|
119
|
-
var _targets_userProvidedTargets_target;
|
|
120
|
-
if (supportedExecutors[target].includes((_targets_userProvidedTargets_target = targets[userProvidedTargets[target]]) == null ? void 0 : _targets_userProvidedTargets_target.executor)) {
|
|
121
|
-
output.validFoundTargetName[target] = userProvidedTargets[target];
|
|
122
|
-
} else {
|
|
123
|
-
output.userProvidedTargetIsUnsupported[target] = true;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
checkUserProvidedTarget('build');
|
|
128
|
-
checkUserProvidedTarget('serve');
|
|
129
|
-
checkUserProvidedTarget('test');
|
|
130
|
-
// Returns early when we have a build, serve, and test targets.
|
|
131
|
-
if (output.validFoundTargetName.build && output.validFoundTargetName.serve && output.validFoundTargetName.test) {
|
|
132
|
-
return output;
|
|
133
|
-
}
|
|
134
|
-
// We try to find the targets that are using the supported executors
|
|
135
|
-
// for build, serve and test, since these are the ones we will be converting
|
|
90
|
+
// We try to find the target that is using the supported executors
|
|
91
|
+
// for build since this is the one we will be converting
|
|
136
92
|
for(const target in targets){
|
|
137
|
-
var _hasViteTargets, _hasViteTargets1, _hasViteTargets2, _hasViteTargets3, _output;
|
|
138
93
|
const executorName = targets[target].executor;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
(_hasViteTargets3 = hasViteTargets).preview || (_hasViteTargets3.preview = executorName === '@nx/vite:preview-server' || executorName === '@nrwl/vite:preview-server');
|
|
144
|
-
const foundTargets = output.validFoundTargetName;
|
|
145
|
-
if (!foundTargets.build && supportedExecutors.build.includes(executorName)) {
|
|
146
|
-
foundTargets.build = target;
|
|
147
|
-
}
|
|
148
|
-
if (!foundTargets.serve && supportedExecutors.serve.includes(executorName)) {
|
|
149
|
-
foundTargets.serve = target;
|
|
150
|
-
}
|
|
151
|
-
if (!foundTargets.test && supportedExecutors.test.includes(executorName)) {
|
|
152
|
-
foundTargets.test = target;
|
|
94
|
+
if (supportedExecutors.build.includes(executorName)) {
|
|
95
|
+
output.supported = target;
|
|
96
|
+
} else if (unsupportedExecutors.includes(executorName)) {
|
|
97
|
+
output.unsupported = target;
|
|
153
98
|
}
|
|
154
|
-
(_output = output).projectContainsUnsupportedExecutor || (_output.projectContainsUnsupportedExecutor = unsupportedExecutors.includes(executorName));
|
|
155
99
|
}
|
|
156
100
|
return output;
|
|
157
101
|
}
|
|
@@ -179,7 +123,7 @@ function addOrChangeTestTarget(tree, options, target) {
|
|
|
179
123
|
}
|
|
180
124
|
(0, _devkit.updateProjectConfiguration)(tree, options.project, project);
|
|
181
125
|
}
|
|
182
|
-
function
|
|
126
|
+
function addBuildTarget(tree, options, target) {
|
|
183
127
|
var _project;
|
|
184
128
|
(0, _addbuildtargetdefaults.addBuildTargetDefaults)(tree, '@nx/vite:build');
|
|
185
129
|
const project = (0, _devkit.readProjectConfiguration)(tree, options.project);
|
|
@@ -188,68 +132,46 @@ function addOrChangeBuildTarget(tree, options, target) {
|
|
|
188
132
|
};
|
|
189
133
|
var _targets;
|
|
190
134
|
(_targets = (_project = project).targets) != null ? _targets : _project.targets = {};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
'
|
|
204
|
-
],
|
|
205
|
-
defaultConfiguration: 'production',
|
|
206
|
-
options: buildOptions,
|
|
207
|
-
configurations: {
|
|
208
|
-
development: {
|
|
209
|
-
mode: 'development'
|
|
210
|
-
},
|
|
211
|
-
production: {
|
|
212
|
-
mode: 'production'
|
|
213
|
-
}
|
|
135
|
+
project.targets[target] = {
|
|
136
|
+
executor: '@nx/vite:build',
|
|
137
|
+
outputs: [
|
|
138
|
+
'{options.outputPath}'
|
|
139
|
+
],
|
|
140
|
+
defaultConfiguration: 'production',
|
|
141
|
+
options: buildOptions,
|
|
142
|
+
configurations: {
|
|
143
|
+
development: {
|
|
144
|
+
mode: 'development'
|
|
145
|
+
},
|
|
146
|
+
production: {
|
|
147
|
+
mode: 'production'
|
|
214
148
|
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
217
151
|
(0, _devkit.updateProjectConfiguration)(tree, options.project, project);
|
|
218
152
|
}
|
|
219
|
-
function
|
|
153
|
+
function addServeTarget(tree, options, target) {
|
|
220
154
|
var _project;
|
|
221
155
|
const project = (0, _devkit.readProjectConfiguration)(tree, options.project);
|
|
222
156
|
var _targets;
|
|
223
157
|
(_targets = (_project = project).targets) != null ? _targets : _project.targets = {};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
158
|
+
project.targets[target] = {
|
|
159
|
+
executor: '@nx/vite:dev-server',
|
|
160
|
+
defaultConfiguration: 'development',
|
|
161
|
+
options: {
|
|
227
162
|
buildTarget: `${options.project}:build`
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
serveTarget.options = serveOptions;
|
|
234
|
-
} else {
|
|
235
|
-
project.targets[target] = {
|
|
236
|
-
executor: '@nx/vite:dev-server',
|
|
237
|
-
defaultConfiguration: 'development',
|
|
238
|
-
options: {
|
|
239
|
-
buildTarget: `${options.project}:build`
|
|
163
|
+
},
|
|
164
|
+
configurations: {
|
|
165
|
+
development: {
|
|
166
|
+
buildTarget: `${options.project}:build:development`,
|
|
167
|
+
hmr: true
|
|
240
168
|
},
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
hmr: true
|
|
245
|
-
},
|
|
246
|
-
production: {
|
|
247
|
-
buildTarget: `${options.project}:build:production`,
|
|
248
|
-
hmr: false
|
|
249
|
-
}
|
|
169
|
+
production: {
|
|
170
|
+
buildTarget: `${options.project}:build:production`,
|
|
171
|
+
hmr: false
|
|
250
172
|
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
253
175
|
(0, _devkit.updateProjectConfiguration)(tree, options.project, project);
|
|
254
176
|
}
|
|
255
177
|
function addPreviewTarget(tree, options, serveTarget) {
|
|
@@ -289,56 +211,26 @@ function addPreviewTarget(tree, options, serveTarget) {
|
|
|
289
211
|
function editTsConfig(tree, options) {
|
|
290
212
|
const projectConfig = (0, _devkit.readProjectConfiguration)(tree, options.project);
|
|
291
213
|
const config = (0, _devkit.readJson)(tree, `${projectConfig.root}/tsconfig.json`);
|
|
292
|
-
const commonCompilerOptions = {
|
|
293
|
-
target: 'ESNext',
|
|
294
|
-
useDefineForClassFields: true,
|
|
295
|
-
module: 'ESNext',
|
|
296
|
-
strict: true,
|
|
297
|
-
moduleResolution: 'Node',
|
|
298
|
-
resolveJsonModule: true,
|
|
299
|
-
isolatedModules: true,
|
|
300
|
-
types: [
|
|
301
|
-
'vite/client'
|
|
302
|
-
],
|
|
303
|
-
noEmit: true
|
|
304
|
-
};
|
|
305
214
|
switch(options.uiFramework){
|
|
306
215
|
case 'react':
|
|
307
|
-
config.compilerOptions =
|
|
308
|
-
|
|
309
|
-
'DOM',
|
|
310
|
-
'DOM.Iterable',
|
|
311
|
-
'ESNext'
|
|
312
|
-
],
|
|
216
|
+
config.compilerOptions = {
|
|
217
|
+
jsx: 'react-jsx',
|
|
313
218
|
allowJs: false,
|
|
314
219
|
esModuleInterop: false,
|
|
315
|
-
skipLibCheck: true,
|
|
316
220
|
allowSyntheticDefaultImports: true,
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
});
|
|
320
|
-
config.include = [
|
|
321
|
-
...config.include,
|
|
322
|
-
'src'
|
|
323
|
-
];
|
|
221
|
+
strict: true
|
|
222
|
+
};
|
|
324
223
|
break;
|
|
325
224
|
case 'none':
|
|
326
|
-
config.compilerOptions =
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
'DOM'
|
|
330
|
-
],
|
|
331
|
-
skipLibCheck: true,
|
|
332
|
-
esModuleInterop: true,
|
|
225
|
+
config.compilerOptions = {
|
|
226
|
+
module: 'commonjs',
|
|
227
|
+
forceConsistentCasingInFileNames: true,
|
|
333
228
|
strict: true,
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
noImplicitReturns: true
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
...config.include,
|
|
340
|
-
'src'
|
|
341
|
-
];
|
|
229
|
+
noImplicitOverride: true,
|
|
230
|
+
noPropertyAccessFromIndexSignature: true,
|
|
231
|
+
noImplicitReturns: true,
|
|
232
|
+
noFallthroughCasesInSwitch: true
|
|
233
|
+
};
|
|
342
234
|
break;
|
|
343
235
|
default:
|
|
344
236
|
break;
|
|
@@ -351,13 +243,10 @@ function deleteWebpackConfig(tree, projectRoot, webpackConfigFilePath) {
|
|
|
351
243
|
tree.delete(webpackConfigPath);
|
|
352
244
|
}
|
|
353
245
|
}
|
|
354
|
-
function moveAndEditIndexHtml(tree, options
|
|
355
|
-
var _projectConfig_targets_buildTarget_options, _projectConfig_targets_buildTarget, _projectConfig_targets, _projectConfig_targets_buildTarget_options1, _projectConfig_targets_buildTarget1, _projectConfig_targets1;
|
|
246
|
+
function moveAndEditIndexHtml(tree, options) {
|
|
356
247
|
const projectConfig = (0, _devkit.readProjectConfiguration)(tree, options.project);
|
|
357
|
-
|
|
358
|
-
let
|
|
359
|
-
var _projectConfig_targets_buildTarget_options_main;
|
|
360
|
-
let mainPath = (_projectConfig_targets_buildTarget_options_main = (_projectConfig_targets1 = projectConfig.targets) == null ? void 0 : (_projectConfig_targets_buildTarget1 = _projectConfig_targets1[buildTarget]) == null ? void 0 : (_projectConfig_targets_buildTarget_options1 = _projectConfig_targets_buildTarget1.options) == null ? void 0 : _projectConfig_targets_buildTarget_options1.main) != null ? _projectConfig_targets_buildTarget_options_main : `${projectConfig.root}/src/main.ts${options.uiFramework === 'react' ? 'x' : ''}`;
|
|
248
|
+
let indexHtmlPath = `${projectConfig.root}/src/index.html`;
|
|
249
|
+
let mainPath = `${projectConfig.root}/src/main.ts${options.uiFramework === 'react' ? 'x' : ''}`;
|
|
361
250
|
if (projectConfig.root !== '.') {
|
|
362
251
|
mainPath = mainPath.replace(projectConfig.root, '');
|
|
363
252
|
}
|
|
@@ -549,31 +438,27 @@ async function handleUnsupportedUserProvidedTargetsErrors(userProvidedTargetName
|
|
|
549
438
|
`);
|
|
550
439
|
}
|
|
551
440
|
}
|
|
552
|
-
async function
|
|
441
|
+
async function handleUnknownConfiguration(projectName) {
|
|
553
442
|
if (process.env.NX_INTERACTIVE === 'false') {
|
|
554
443
|
return;
|
|
555
444
|
}
|
|
556
445
|
_devkit.logger.warn(`
|
|
557
|
-
We could not find any
|
|
558
|
-
can
|
|
559
|
-
|
|
560
|
-
This either means that your project may not have a target
|
|
561
|
-
for building, serving, or testing at all, or that your targets are
|
|
562
|
-
using executors that are not known to Nx.
|
|
446
|
+
We could not find any configuration in project ${projectName} that
|
|
447
|
+
indicates whether we can definitely convert to Vite.
|
|
563
448
|
|
|
564
|
-
If you still want to convert your project to use
|
|
449
|
+
If you still want to convert your project to use Vite,
|
|
565
450
|
please make sure to commit your changes before running this generator.
|
|
566
451
|
`);
|
|
567
452
|
const { Confirm } = require('enquirer');
|
|
568
453
|
const prompt = new Confirm({
|
|
569
454
|
name: 'question',
|
|
570
|
-
message: `Should Nx convert your project to use
|
|
455
|
+
message: `Should Nx convert your project to use Vite?`,
|
|
571
456
|
initial: true
|
|
572
457
|
});
|
|
573
458
|
const shouldConvert = await prompt.run();
|
|
574
459
|
if (!shouldConvert) {
|
|
575
460
|
throw new Error(`
|
|
576
|
-
Nx could not verify that
|
|
461
|
+
Nx could not verify that your project can be converted to use Vite.
|
|
577
462
|
Please try again with a different project.
|
|
578
463
|
`);
|
|
579
464
|
}
|