@nx/vite 22.7.0-beta.1 → 22.7.0-beta.11
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 +10 -11
- package/plugins/nx-vite-build-coordination.plugin.js +1 -1
- package/src/executors/build/build.impl.d.ts.map +1 -1
- package/src/executors/build/build.impl.js +40 -3
- package/src/executors/build/compat.js +2 -1
- package/src/executors/build/schema.json +75 -75
- package/src/executors/dev-server/compat.js +2 -1
- package/src/executors/dev-server/dev-server.impl.js +34 -1
- package/src/executors/dev-server/schema.json +36 -36
- package/src/executors/preview-server/compat.js +2 -1
- package/src/executors/preview-server/preview-server.impl.js +34 -1
- package/src/executors/preview-server/schema.json +40 -40
- package/src/executors/test/compat.js +2 -1
- package/src/executors/test/schema.json +33 -33
- package/src/executors/test/vitest.impl.js +34 -1
- package/src/generators/configuration/configuration.js +3 -2
- package/src/generators/configuration/schema.d.ts +1 -0
- package/src/generators/configuration/schema.json +62 -62
- package/src/generators/convert-to-inferred/schema.json +16 -16
- package/src/generators/init/lib/utils.d.ts.map +1 -1
- package/src/generators/init/lib/utils.js +51 -9
- package/src/generators/init/schema.d.ts +1 -0
- package/src/generators/init/schema.json +54 -47
- package/src/generators/setup-paths-plugin/schema.json +11 -11
- package/src/generators/vitest/schema.json +62 -62
- package/src/generators/vitest/vitest-generator.js +34 -1
- package/src/migrations/update-20-5-0/eslint-ignore-vite-temp-files.js +35 -2
- package/src/plugins/plugin.d.ts.map +1 -1
- package/src/plugins/plugin.js +56 -17
- package/src/utils/ensure-dependencies.d.ts.map +1 -1
- package/src/utils/ensure-dependencies.js +9 -1
- package/src/utils/executor-utils.js +1 -1
- package/src/utils/ignore-vite-temp-files.js +35 -2
- package/src/utils/version-utils.d.ts +2 -0
- package/src/utils/version-utils.d.ts.map +1 -1
- package/src/utils/version-utils.js +22 -0
- package/src/utils/versions.d.ts +11 -9
- package/src/utils/versions.d.ts.map +1 -1
- package/src/utils/versions.js +9 -7
- package/project.json +0 -52
- package/src/utils/test-files/angular-project.config.json +0 -89
- package/src/utils/test-files/react-lib-non-buildable-jest.json +0 -22
- package/src/utils/test-files/react-lib-non-buildable-vitest.json +0 -22
- package/src/utils/test-files/react-mixed-project.config.json +0 -47
- package/src/utils/test-files/react-vite-project.config.json +0 -54
- package/src/utils/test-files/unknown-project.config.json +0 -69
- package/src/utils/test-utils.d.ts +0 -10
- package/src/utils/test-utils.d.ts.map +0 -1
- package/src/utils/test-utils.js +0 -563
package/src/utils/test-utils.js
DELETED
|
@@ -1,563 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mockViteReactAppGenerator = mockViteReactAppGenerator;
|
|
4
|
-
exports.mockReactAppGenerator = mockReactAppGenerator;
|
|
5
|
-
exports.mockReactMixedAppGenerator = mockReactMixedAppGenerator;
|
|
6
|
-
exports.mockWebAppGenerator = mockWebAppGenerator;
|
|
7
|
-
exports.mockAngularAppGenerator = mockAngularAppGenerator;
|
|
8
|
-
exports.mockUnknownAppGenerator = mockUnknownAppGenerator;
|
|
9
|
-
exports.mockReactLibNonBuildableJestTestRunnerGenerator = mockReactLibNonBuildableJestTestRunnerGenerator;
|
|
10
|
-
exports.mockReactLibNonBuildableVitestRunnerGenerator = mockReactLibNonBuildableVitestRunnerGenerator;
|
|
11
|
-
const devkit_1 = require("@nx/devkit");
|
|
12
|
-
const reactViteConfig = require("./test-files/react-vite-project.config.json");
|
|
13
|
-
const angularAppConfig = require("./test-files/angular-project.config.json");
|
|
14
|
-
const randomAppConfig = require("./test-files/unknown-project.config.json");
|
|
15
|
-
const mixedAppConfig = require("./test-files/react-mixed-project.config.json");
|
|
16
|
-
const reactLibNBJest = require("./test-files/react-lib-non-buildable-jest.json");
|
|
17
|
-
const reactLibNBVitest = require("./test-files/react-lib-non-buildable-vitest.json");
|
|
18
|
-
function mockViteReactAppGenerator(tree) {
|
|
19
|
-
const appName = 'my-test-react-vite-app';
|
|
20
|
-
tree.write(`apps/${appName}/src/main.tsx`, `import ReactDOM from 'react-dom';\n`);
|
|
21
|
-
tree.write(`apps/${appName}/tsconfig.json`, `{
|
|
22
|
-
"compilerOptions": {
|
|
23
|
-
"jsx": "react-jsx",
|
|
24
|
-
"allowJs": false,
|
|
25
|
-
"esModuleInterop": false,
|
|
26
|
-
"allowSyntheticDefaultImports": true,
|
|
27
|
-
"strict": true,
|
|
28
|
-
"types": ["vite/client"]
|
|
29
|
-
},
|
|
30
|
-
"files": [],
|
|
31
|
-
"include": [],
|
|
32
|
-
"references": [
|
|
33
|
-
{
|
|
34
|
-
"path": "./tsconfig.app.json"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"path": "./tsconfig.spec.json"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"extends": "../../tsconfig.base.json"
|
|
41
|
-
}
|
|
42
|
-
`);
|
|
43
|
-
tree.write(`apps/${appName}/tsconfig.app.json`, `{
|
|
44
|
-
"extends": "./tsconfig.json",
|
|
45
|
-
"compilerOptions": {
|
|
46
|
-
"outDir": "../../dist/out-tsc",
|
|
47
|
-
"types": ["node"]
|
|
48
|
-
},
|
|
49
|
-
"files": [
|
|
50
|
-
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
51
|
-
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
52
|
-
],
|
|
53
|
-
"exclude": [
|
|
54
|
-
"src/**/*.spec.ts",
|
|
55
|
-
"src/**/*.test.ts",
|
|
56
|
-
"src/**/*.spec.tsx",
|
|
57
|
-
"src/**/*.test.tsx",
|
|
58
|
-
"src/**/*.spec.js",
|
|
59
|
-
"src/**/*.test.js",
|
|
60
|
-
"src/**/*.spec.jsx",
|
|
61
|
-
"src/**/*.test.jsx"
|
|
62
|
-
],
|
|
63
|
-
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
64
|
-
}
|
|
65
|
-
`);
|
|
66
|
-
tree.write(`apps/${appName}/index.html`, `<!DOCTYPE html>
|
|
67
|
-
<html lang="en">
|
|
68
|
-
<head>
|
|
69
|
-
<meta charset="utf-8" />
|
|
70
|
-
<title>Rv1</title>
|
|
71
|
-
<base href="/" />
|
|
72
|
-
|
|
73
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
74
|
-
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
75
|
-
<link rel="stylesheet" href="/src/styles.css" />
|
|
76
|
-
</head>
|
|
77
|
-
<body>
|
|
78
|
-
<div id="root"></div>
|
|
79
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
80
|
-
</body>
|
|
81
|
-
</html>`);
|
|
82
|
-
tree.write(`apps/${appName}/vite.config.ts`, ` /// <reference types="vitest" />
|
|
83
|
-
import { defineConfig } from 'vite';
|
|
84
|
-
import react from '@vitejs/plugin-react';
|
|
85
|
-
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
86
|
-
|
|
87
|
-
export default defineConfig({
|
|
88
|
-
|
|
89
|
-
cacheDir: '../../node_modules/.vitest',
|
|
90
|
-
server: {
|
|
91
|
-
port: 4200,
|
|
92
|
-
host: 'localhost',
|
|
93
|
-
},
|
|
94
|
-
plugins: [
|
|
95
|
-
react(),
|
|
96
|
-
tsconfigPaths({
|
|
97
|
-
root: '../../',
|
|
98
|
-
projects: ['tsconfig.base.json'],
|
|
99
|
-
}),
|
|
100
|
-
],
|
|
101
|
-
|
|
102
|
-
test: {
|
|
103
|
-
globals: true,
|
|
104
|
-
environment: 'jsdom',
|
|
105
|
-
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
`);
|
|
109
|
-
(0, devkit_1.writeJson)(tree, 'workspace.json', {
|
|
110
|
-
projects: {
|
|
111
|
-
'my-test-react-vite-app': {
|
|
112
|
-
...reactViteConfig,
|
|
113
|
-
root: `apps/${appName}`,
|
|
114
|
-
projectType: 'application',
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
(0, devkit_1.writeJson)(tree, `apps/${appName}/project.json`, {
|
|
119
|
-
...reactViteConfig,
|
|
120
|
-
root: `apps/${appName}`,
|
|
121
|
-
projectType: 'application',
|
|
122
|
-
});
|
|
123
|
-
return tree;
|
|
124
|
-
}
|
|
125
|
-
function mockReactAppGenerator(tree, userAppName) {
|
|
126
|
-
const appName = userAppName ?? 'my-test-react-app';
|
|
127
|
-
tree.write(`apps/${appName}/src/main.tsx`, `import ReactDOM from 'react-dom';\n`);
|
|
128
|
-
tree.write(`apps/${appName}/webpack.config.ts`, ``);
|
|
129
|
-
tree.write(`apps/${appName}/tsconfig.json`, `{
|
|
130
|
-
"extends": "../../tsconfig.base.json",
|
|
131
|
-
"compilerOptions": {
|
|
132
|
-
"jsx": "react-jsx",
|
|
133
|
-
"allowJs": true,
|
|
134
|
-
"esModuleInterop": true,
|
|
135
|
-
"allowSyntheticDefaultImports": true,
|
|
136
|
-
"forceConsistentCasingInFileNames": true,
|
|
137
|
-
"strict": true,
|
|
138
|
-
"noImplicitOverride": true,
|
|
139
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
140
|
-
"noImplicitReturns": true,
|
|
141
|
-
"noFallthroughCasesInSwitch": true
|
|
142
|
-
},
|
|
143
|
-
"files": [],
|
|
144
|
-
"include": [],
|
|
145
|
-
"references": [
|
|
146
|
-
{
|
|
147
|
-
"path": "./tsconfig.app.json"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
"path": "./tsconfig.spec.json"
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
`);
|
|
155
|
-
tree.write(`apps/${appName}/tsconfig.app.json`, `{
|
|
156
|
-
"extends": "./tsconfig.json",
|
|
157
|
-
"compilerOptions": {
|
|
158
|
-
"outDir": "../../dist/out-tsc"
|
|
159
|
-
},
|
|
160
|
-
"files": [
|
|
161
|
-
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
162
|
-
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
163
|
-
],
|
|
164
|
-
"exclude": [
|
|
165
|
-
"jest.config.cts",
|
|
166
|
-
"**/*.spec.ts",
|
|
167
|
-
"**/*.test.ts",
|
|
168
|
-
"**/*.spec.tsx",
|
|
169
|
-
"**/*.test.tsx",
|
|
170
|
-
"**/*.spec.js",
|
|
171
|
-
"**/*.test.js",
|
|
172
|
-
"**/*.spec.jsx",
|
|
173
|
-
"**/*.test.jsx"
|
|
174
|
-
],
|
|
175
|
-
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
|
176
|
-
}
|
|
177
|
-
`);
|
|
178
|
-
tree.write(`apps/${appName}/src/index.html`, `<!DOCTYPE html>
|
|
179
|
-
<html lang="en">
|
|
180
|
-
<head>
|
|
181
|
-
<meta charset="utf-8" />
|
|
182
|
-
<title>My Test React App</title>
|
|
183
|
-
<base href="/" />
|
|
184
|
-
|
|
185
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
186
|
-
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
187
|
-
</head>
|
|
188
|
-
<body>
|
|
189
|
-
<div id="root"></div>
|
|
190
|
-
</body>
|
|
191
|
-
</html>`);
|
|
192
|
-
(0, devkit_1.writeJson)(tree, `apps/${appName}/project.json`, {
|
|
193
|
-
root: `apps/${appName}`,
|
|
194
|
-
projectType: 'application',
|
|
195
|
-
});
|
|
196
|
-
return tree;
|
|
197
|
-
}
|
|
198
|
-
function mockReactMixedAppGenerator(tree) {
|
|
199
|
-
const appName = 'my-test-mixed-react-app';
|
|
200
|
-
tree.write(`apps/${appName}/src/main.tsx`, `import ReactDOM from 'react-dom';\n`);
|
|
201
|
-
tree.write(`apps/${appName}/tsconfig.json`, `{
|
|
202
|
-
"extends": "../../tsconfig.base.json",
|
|
203
|
-
"compilerOptions": {
|
|
204
|
-
"jsx": "react-jsx",
|
|
205
|
-
"allowJs": true,
|
|
206
|
-
"esModuleInterop": true,
|
|
207
|
-
"allowSyntheticDefaultImports": true,
|
|
208
|
-
"forceConsistentCasingInFileNames": true,
|
|
209
|
-
"strict": true,
|
|
210
|
-
"noImplicitOverride": true,
|
|
211
|
-
"noPropertyAccessFromIndexSignature": true,
|
|
212
|
-
"noImplicitReturns": true,
|
|
213
|
-
"noFallthroughCasesInSwitch": true
|
|
214
|
-
},
|
|
215
|
-
"files": [],
|
|
216
|
-
"include": [],
|
|
217
|
-
"references": [
|
|
218
|
-
{
|
|
219
|
-
"path": "./tsconfig.app.json"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
"path": "./tsconfig.spec.json"
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
`);
|
|
227
|
-
tree.write(`apps/${appName}/tsconfig.app.json`, `{
|
|
228
|
-
"extends": "./tsconfig.json",
|
|
229
|
-
"compilerOptions": {
|
|
230
|
-
"outDir": "../../dist/out-tsc"
|
|
231
|
-
},
|
|
232
|
-
"files": [
|
|
233
|
-
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
234
|
-
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
235
|
-
],
|
|
236
|
-
"exclude": [
|
|
237
|
-
"jest.config.cts",
|
|
238
|
-
"**/*.spec.ts",
|
|
239
|
-
"**/*.test.ts",
|
|
240
|
-
"**/*.spec.tsx",
|
|
241
|
-
"**/*.test.tsx",
|
|
242
|
-
"**/*.spec.js",
|
|
243
|
-
"**/*.test.js",
|
|
244
|
-
"**/*.spec.jsx",
|
|
245
|
-
"**/*.test.jsx"
|
|
246
|
-
],
|
|
247
|
-
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
|
248
|
-
}
|
|
249
|
-
`);
|
|
250
|
-
tree.write(`apps/${appName}/src/index.html`, `<!DOCTYPE html>
|
|
251
|
-
<html lang="en">
|
|
252
|
-
<head>
|
|
253
|
-
<meta charset="utf-8" />
|
|
254
|
-
<title>My Test React App</title>
|
|
255
|
-
<base href="/" />
|
|
256
|
-
|
|
257
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
258
|
-
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
259
|
-
</head>
|
|
260
|
-
<body>
|
|
261
|
-
<div id="root"></div>
|
|
262
|
-
</body>
|
|
263
|
-
</html>`);
|
|
264
|
-
(0, devkit_1.writeJson)(tree, 'workspace.json', {
|
|
265
|
-
projects: {
|
|
266
|
-
'my-test-mixed-react-app': {
|
|
267
|
-
...mixedAppConfig,
|
|
268
|
-
root: `apps/${appName}`,
|
|
269
|
-
projectType: 'application',
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
});
|
|
273
|
-
(0, devkit_1.writeJson)(tree, `apps/${appName}/project.json`, {
|
|
274
|
-
...mixedAppConfig,
|
|
275
|
-
root: `apps/${appName}`,
|
|
276
|
-
projectType: 'application',
|
|
277
|
-
});
|
|
278
|
-
return tree;
|
|
279
|
-
}
|
|
280
|
-
function mockWebAppGenerator(tree) {
|
|
281
|
-
const appName = 'my-test-web-app';
|
|
282
|
-
tree.write(`apps/${appName}/src/main.ts`, `import './app/app.element.ts';`);
|
|
283
|
-
tree.write(`apps/${appName}/tsconfig.json`, `{
|
|
284
|
-
"extends": "../../tsconfig.base.json",
|
|
285
|
-
"files": [],
|
|
286
|
-
"include": [],
|
|
287
|
-
"references": [
|
|
288
|
-
{
|
|
289
|
-
"path": "./tsconfig.app.json"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
"path": "./tsconfig.spec.json"
|
|
293
|
-
}
|
|
294
|
-
]
|
|
295
|
-
}
|
|
296
|
-
`);
|
|
297
|
-
tree.write(`apps/${appName}/webpack.config.ts`, ``);
|
|
298
|
-
tree.write(`apps/${appName}/src/index.html`, `<!DOCTYPE html>
|
|
299
|
-
<html lang="en">
|
|
300
|
-
<head>
|
|
301
|
-
<meta charset="utf-8" />
|
|
302
|
-
<title>WebappPure</title>
|
|
303
|
-
<base href="/" />
|
|
304
|
-
|
|
305
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
306
|
-
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
307
|
-
</head>
|
|
308
|
-
<body>
|
|
309
|
-
<workspace-root></workspace-root>
|
|
310
|
-
</body>
|
|
311
|
-
</html>
|
|
312
|
-
`);
|
|
313
|
-
(0, devkit_1.writeJson)(tree, 'workspace.json', {
|
|
314
|
-
projects: {
|
|
315
|
-
'my-test-web-app': {
|
|
316
|
-
root: `apps/${appName}`,
|
|
317
|
-
projectType: 'application',
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
|
-
});
|
|
321
|
-
(0, devkit_1.writeJson)(tree, `apps/${appName}/project.json`, {
|
|
322
|
-
root: `apps/${appName}`,
|
|
323
|
-
projectType: 'application',
|
|
324
|
-
});
|
|
325
|
-
return tree;
|
|
326
|
-
}
|
|
327
|
-
function mockAngularAppGenerator(tree) {
|
|
328
|
-
const appName = 'my-test-angular-app';
|
|
329
|
-
(0, devkit_1.writeJson)(tree, 'workspace.json', {
|
|
330
|
-
projects: {
|
|
331
|
-
'my-test-angular-app': {
|
|
332
|
-
...angularAppConfig,
|
|
333
|
-
root: `apps/${appName}`,
|
|
334
|
-
projectType: 'application',
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
});
|
|
338
|
-
(0, devkit_1.writeJson)(tree, `apps/${appName}/project.json`, {
|
|
339
|
-
...angularAppConfig,
|
|
340
|
-
root: `apps/${appName}`,
|
|
341
|
-
projectType: 'application',
|
|
342
|
-
});
|
|
343
|
-
(0, devkit_1.writeJson)(tree, `apps/${appName}/tsconfig.json`, {
|
|
344
|
-
compilerOptions: {
|
|
345
|
-
target: 'es2022',
|
|
346
|
-
esModuleInterop: true,
|
|
347
|
-
forceConsistentCasingInFileNames: true,
|
|
348
|
-
strict: true,
|
|
349
|
-
noImplicitOverride: true,
|
|
350
|
-
noPropertyAccessFromIndexSignature: true,
|
|
351
|
-
noImplicitReturns: true,
|
|
352
|
-
noFallthroughCasesInSwitch: true,
|
|
353
|
-
},
|
|
354
|
-
files: [],
|
|
355
|
-
include: [],
|
|
356
|
-
references: [
|
|
357
|
-
{
|
|
358
|
-
path: './tsconfig.editor.json',
|
|
359
|
-
},
|
|
360
|
-
{
|
|
361
|
-
path: './tsconfig.app.json',
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
path: './tsconfig.spec.json',
|
|
365
|
-
},
|
|
366
|
-
],
|
|
367
|
-
extends: '../../tsconfig.base.json',
|
|
368
|
-
angularCompilerOptions: {
|
|
369
|
-
enableI18nLegacyMessageIdFormat: false,
|
|
370
|
-
strictInjectionParameters: true,
|
|
371
|
-
strictInputAccessModifiers: true,
|
|
372
|
-
strictTemplates: true,
|
|
373
|
-
},
|
|
374
|
-
});
|
|
375
|
-
(0, devkit_1.writeJson)(tree, `apps/${appName}/tsconfig.app.json`, {
|
|
376
|
-
extends: './tsconfig.json',
|
|
377
|
-
compilerOptions: {
|
|
378
|
-
outDir: '../../dist/out-tsc',
|
|
379
|
-
types: [],
|
|
380
|
-
},
|
|
381
|
-
files: ['src/main.ts'],
|
|
382
|
-
include: ['src/**/*.d.ts'],
|
|
383
|
-
exclude: ['jest.config.ts', 'src/**/*.test.ts', 'src/**/*.spec.ts'],
|
|
384
|
-
});
|
|
385
|
-
(0, devkit_1.writeJson)(tree, `apps/${appName}/tsconfig.spec.json`, {
|
|
386
|
-
extends: './tsconfig.json',
|
|
387
|
-
compilerOptions: {
|
|
388
|
-
outDir: '../../dist/out-tsc',
|
|
389
|
-
module: 'commonjs',
|
|
390
|
-
target: 'es2016',
|
|
391
|
-
types: ['jest', 'node'],
|
|
392
|
-
},
|
|
393
|
-
files: ['src/test-setup.ts'],
|
|
394
|
-
include: [
|
|
395
|
-
'jest.config.ts',
|
|
396
|
-
'src/**/*.test.ts',
|
|
397
|
-
'src/**/*.spec.ts',
|
|
398
|
-
'src/**/*.d.ts',
|
|
399
|
-
],
|
|
400
|
-
});
|
|
401
|
-
return tree;
|
|
402
|
-
}
|
|
403
|
-
function mockUnknownAppGenerator(tree) {
|
|
404
|
-
const appName = 'my-test-random-app';
|
|
405
|
-
(0, devkit_1.writeJson)(tree, 'workspace.json', {
|
|
406
|
-
projects: {
|
|
407
|
-
'my-test-random-app': {
|
|
408
|
-
...randomAppConfig,
|
|
409
|
-
root: `apps/${appName}`,
|
|
410
|
-
projectType: 'application',
|
|
411
|
-
},
|
|
412
|
-
},
|
|
413
|
-
});
|
|
414
|
-
(0, devkit_1.writeJson)(tree, `apps/${appName}/project.json`, {
|
|
415
|
-
...randomAppConfig,
|
|
416
|
-
root: `apps/${appName}`,
|
|
417
|
-
projectType: 'application',
|
|
418
|
-
});
|
|
419
|
-
return tree;
|
|
420
|
-
}
|
|
421
|
-
function mockReactLibNonBuildableJestTestRunnerGenerator(tree) {
|
|
422
|
-
const libName = 'react-lib-nonb-jest';
|
|
423
|
-
tree.write(`libs/${libName}/src/index.ts`, ``);
|
|
424
|
-
tree.write(`libs/${libName}/tsconfig.json`, `{
|
|
425
|
-
"compilerOptions": {
|
|
426
|
-
"jsx": "react-jsx",
|
|
427
|
-
"allowJs": false,
|
|
428
|
-
"esModuleInterop": false,
|
|
429
|
-
"allowSyntheticDefaultImports": true,
|
|
430
|
-
"strict": true
|
|
431
|
-
},
|
|
432
|
-
"files": [],
|
|
433
|
-
"include": [],
|
|
434
|
-
"references": [
|
|
435
|
-
{
|
|
436
|
-
"path": "./tsconfig.lib.json"
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
"path": "./tsconfig.spec.json"
|
|
440
|
-
}
|
|
441
|
-
],
|
|
442
|
-
"extends": "../../tsconfig.base.json"
|
|
443
|
-
}`);
|
|
444
|
-
tree.write(`libs/${libName}/tsconfig.lib.json`, `{
|
|
445
|
-
"extends": "./tsconfig.json",
|
|
446
|
-
"compilerOptions": {
|
|
447
|
-
"outDir": "../../dist/out-tsc",
|
|
448
|
-
"types": ["node"]
|
|
449
|
-
},
|
|
450
|
-
"files": [
|
|
451
|
-
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
452
|
-
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
453
|
-
],
|
|
454
|
-
"exclude": [
|
|
455
|
-
"jest.config.cts",
|
|
456
|
-
"src/**/*.spec.ts",
|
|
457
|
-
"src/**/*.test.ts",
|
|
458
|
-
"src/**/*.spec.tsx",
|
|
459
|
-
"src/**/*.test.tsx",
|
|
460
|
-
"src/**/*.spec.js",
|
|
461
|
-
"src/**/*.test.js",
|
|
462
|
-
"src/**/*.spec.jsx",
|
|
463
|
-
"src/**/*.test.jsx"
|
|
464
|
-
],
|
|
465
|
-
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
466
|
-
}`);
|
|
467
|
-
(0, devkit_1.writeJson)(tree, 'workspace.json', {
|
|
468
|
-
projects: {
|
|
469
|
-
[`${libName}`]: {
|
|
470
|
-
...reactLibNBJest,
|
|
471
|
-
root: `libs/${libName}`,
|
|
472
|
-
projectType: 'library',
|
|
473
|
-
},
|
|
474
|
-
},
|
|
475
|
-
});
|
|
476
|
-
(0, devkit_1.writeJson)(tree, `libs/${libName}/project.json`, {
|
|
477
|
-
...reactLibNBJest,
|
|
478
|
-
root: `libs/${libName}`,
|
|
479
|
-
projectType: 'library',
|
|
480
|
-
});
|
|
481
|
-
return tree;
|
|
482
|
-
}
|
|
483
|
-
function mockReactLibNonBuildableVitestRunnerGenerator(tree) {
|
|
484
|
-
const libName = 'react-lib-nonb-vitest';
|
|
485
|
-
tree.write(`libs/${libName}/src/index.ts`, ``);
|
|
486
|
-
tree.write(`libs/${libName}/vite.config.ts`, `/// <reference types="vitest" />
|
|
487
|
-
import { defineConfig } from 'vite';
|
|
488
|
-
import react from '@vitejs/plugin-react';
|
|
489
|
-
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
490
|
-
|
|
491
|
-
export default defineConfig({
|
|
492
|
-
|
|
493
|
-
cacheDir: '../../node_modules/.vitest',
|
|
494
|
-
plugins: [
|
|
495
|
-
nxViteTsPaths(),
|
|
496
|
-
react(),
|
|
497
|
-
],
|
|
498
|
-
|
|
499
|
-
test: {
|
|
500
|
-
globals: true,
|
|
501
|
-
environment: 'jsdom',
|
|
502
|
-
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
503
|
-
},
|
|
504
|
-
});
|
|
505
|
-
`);
|
|
506
|
-
tree.write(`libs/${libName}/tsconfig.json`, `{
|
|
507
|
-
"compilerOptions": {
|
|
508
|
-
"jsx": "react-jsx",
|
|
509
|
-
"allowJs": false,
|
|
510
|
-
"esModuleInterop": false,
|
|
511
|
-
"allowSyntheticDefaultImports": true,
|
|
512
|
-
"strict": true
|
|
513
|
-
},
|
|
514
|
-
"files": [],
|
|
515
|
-
"include": [],
|
|
516
|
-
"references": [
|
|
517
|
-
{
|
|
518
|
-
"path": "./tsconfig.lib.json"
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
"path": "./tsconfig.spec.json"
|
|
522
|
-
}
|
|
523
|
-
],
|
|
524
|
-
"extends": "../../tsconfig.base.json"
|
|
525
|
-
}`);
|
|
526
|
-
tree.write(`libs/${libName}/tsconfig.lib.json`, `{
|
|
527
|
-
"extends": "./tsconfig.json",
|
|
528
|
-
"compilerOptions": {
|
|
529
|
-
"outDir": "../../dist/out-tsc",
|
|
530
|
-
"types": ["node"]
|
|
531
|
-
},
|
|
532
|
-
"files": [
|
|
533
|
-
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
534
|
-
"../../node_modules/@nx/react/typings/image.d.ts"
|
|
535
|
-
],
|
|
536
|
-
"exclude": [
|
|
537
|
-
"**/*.spec.ts",
|
|
538
|
-
"**/*.test.ts",
|
|
539
|
-
"**/*.spec.tsx",
|
|
540
|
-
"**/*.test.tsx",
|
|
541
|
-
"**/*.spec.js",
|
|
542
|
-
"**/*.test.js",
|
|
543
|
-
"**/*.spec.jsx",
|
|
544
|
-
"**/*.test.jsx"
|
|
545
|
-
],
|
|
546
|
-
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
|
547
|
-
}`);
|
|
548
|
-
(0, devkit_1.writeJson)(tree, 'workspace.json', {
|
|
549
|
-
projects: {
|
|
550
|
-
[`${libName}`]: {
|
|
551
|
-
...reactLibNBVitest,
|
|
552
|
-
root: `libs/${libName}`,
|
|
553
|
-
projectType: 'library',
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
});
|
|
557
|
-
(0, devkit_1.writeJson)(tree, `libs/${libName}/project.json`, {
|
|
558
|
-
...reactLibNBVitest,
|
|
559
|
-
root: `libs/${libName}`,
|
|
560
|
-
projectType: 'library',
|
|
561
|
-
});
|
|
562
|
-
return tree;
|
|
563
|
-
}
|