@nx/vite 16.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +63 -0
- package/executors.d.ts +8 -0
- package/executors.js +19 -0
- package/executors.js.map +1 -0
- package/executors.json +46 -0
- package/generators.json +46 -0
- package/index.d.ts +8 -0
- package/index.js +20 -0
- package/index.js.map +1 -0
- package/migrations.json +80 -0
- package/package.json +60 -0
- package/plugins/rollup-replace-files.plugin.d.ts +16 -0
- package/plugins/rollup-replace-files.plugin.js +49 -0
- package/plugins/rollup-replace-files.plugin.js.map +1 -0
- package/src/executors/build/build.impl.d.ts +10 -0
- package/src/executors/build/build.impl.js +91 -0
- package/src/executors/build/build.impl.js.map +1 -0
- package/src/executors/build/compat.d.ts +2 -0
- package/src/executors/build/compat.js +10 -0
- package/src/executors/build/compat.js.map +1 -0
- package/src/executors/build/schema.d.js +3 -0
- package/src/executors/build/schema.d.js.map +1 -0
- package/src/executors/build/schema.d.ts +17 -0
- package/src/executors/build/schema.json +143 -0
- package/src/executors/dev-server/compat.d.ts +2 -0
- package/src/executors/dev-server/compat.js +10 -0
- package/src/executors/dev-server/compat.js.map +1 -0
- package/src/executors/dev-server/dev-server.impl.d.ts +8 -0
- package/src/executors/dev-server/dev-server.impl.js +68 -0
- package/src/executors/dev-server/dev-server.impl.js.map +1 -0
- package/src/executors/dev-server/schema.d.js +3 -0
- package/src/executors/dev-server/schema.d.js.map +1 -0
- package/src/executors/dev-server/schema.d.ts +14 -0
- package/src/executors/dev-server/schema.json +89 -0
- package/src/executors/preview-server/compat.d.ts +2 -0
- package/src/executors/preview-server/compat.js +10 -0
- package/src/executors/preview-server/compat.js.map +1 -0
- package/src/executors/preview-server/preview-server.impl.d.ts +7 -0
- package/src/executors/preview-server/preview-server.impl.js +107 -0
- package/src/executors/preview-server/preview-server.impl.js.map +1 -0
- package/src/executors/preview-server/schema.d.js +3 -0
- package/src/executors/preview-server/schema.d.js.map +1 -0
- package/src/executors/preview-server/schema.d.ts +12 -0
- package/src/executors/preview-server/schema.json +80 -0
- package/src/executors/test/compat.d.ts +2 -0
- package/src/executors/test/compat.js +10 -0
- package/src/executors/test/compat.js.map +1 -0
- package/src/executors/test/schema.d.js +3 -0
- package/src/executors/test/schema.d.js.map +1 -0
- package/src/executors/test/schema.d.ts +11 -0
- package/src/executors/test/schema.json +63 -0
- package/src/executors/test/vitest.impl.d.ts +6 -0
- package/src/executors/test/vitest.impl.js +130 -0
- package/src/executors/test/vitest.impl.js.map +1 -0
- package/src/generators/configuration/configuration.d.ts +5 -0
- package/src/generators/configuration/configuration.js +130 -0
- package/src/generators/configuration/configuration.js.map +1 -0
- package/src/generators/configuration/schema.d.js +3 -0
- package/src/generators/configuration/schema.d.js.map +1 -0
- package/src/generators/configuration/schema.d.ts +12 -0
- package/src/generators/configuration/schema.json +61 -0
- package/src/generators/init/init.d.ts +6 -0
- package/src/generators/init/init.js +84 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.js +3 -0
- package/src/generators/init/schema.d.js.map +1 -0
- package/src/generators/init/schema.d.ts +4 -0
- package/src/generators/init/schema.json +22 -0
- package/src/generators/vitest/files/tsconfig.spec.json__tmpl__ +19 -0
- package/src/generators/vitest/schema.d.js +3 -0
- package/src/generators/vitest/schema.d.js.map +1 -0
- package/src/generators/vitest/schema.d.ts +9 -0
- package/src/generators/vitest/schema.json +49 -0
- package/src/generators/vitest/vitest-generator.d.ts +5 -0
- package/src/generators/vitest/vitest-generator.js +99 -0
- package/src/generators/vitest/vitest-generator.js.map +1 -0
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.d.ts +3 -0
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js +63 -0
- package/src/migrations/update-15-3-1/update-vite-tsconfig-paths.js.map +1 -0
- package/src/migrations/update-15-3-4/set-mode-in-configuration.d.ts +3 -0
- package/src/migrations/update-15-3-4/set-mode-in-configuration.js +33 -0
- package/src/migrations/update-15-3-4/set-mode-in-configuration.js.map +1 -0
- package/src/migrations/update-15-4-3/update-report-directory.d.ts +3 -0
- package/src/migrations/update-15-4-3/update-report-directory.js +35 -0
- package/src/migrations/update-15-4-3/update-report-directory.js.map +1 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/utils/generator-utils.d.ts +34 -0
- package/src/utils/generator-utils.js +567 -0
- package/src/utils/generator-utils.js.map +1 -0
- package/src/utils/options-utils.d.ts +32 -0
- package/src/utils/options-utils.js +113 -0
- package/src/utils/options-utils.js.map +1 -0
- package/src/utils/test-files/angular-project.config.json +89 -0
- package/src/utils/test-files/react-lib-non-buildable-jest.json +25 -0
- package/src/utils/test-files/react-lib-non-buildable-vitest.json +25 -0
- package/src/utils/test-files/react-mixed-project.config.json +52 -0
- package/src/utils/test-files/react-project.config.json +85 -0
- package/src/utils/test-files/react-vite-project.config.json +57 -0
- package/src/utils/test-files/test-vite-configs.d.ts +32 -0
- package/src/utils/test-files/test-vite-configs.js +285 -0
- package/src/utils/test-files/test-vite-configs.js.map +1 -0
- package/src/utils/test-files/unknown-project.config.json +72 -0
- package/src/utils/test-files/web-project.config.json +72 -0
- package/src/utils/test-utils.d.ts +9 -0
- package/src/utils/test-utils.js +516 -0
- package/src/utils/test-utils.js.map +1 -0
- package/src/utils/versions.d.ts +13 -0
- package/src/utils/versions.js +37 -0
- package/src/utils/versions.js.map +1 -0
- package/src/utils/vite-config-edit-utils.d.ts +3 -0
- package/src/utils/vite-config-edit-utils.js +286 -0
- package/src/utils/vite-config-edit-utils.js.map +1 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface VitestExecutorOptions {
|
|
2
|
+
config?: string;
|
|
3
|
+
passWithNoTests?: boolean;
|
|
4
|
+
testNamePattern?: string;
|
|
5
|
+
mode?: 'test' | 'benchmark' | 'typecheck';
|
|
6
|
+
reporters?: string[];
|
|
7
|
+
watch?: boolean;
|
|
8
|
+
update?: boolean;
|
|
9
|
+
reportsDirectory?: string;
|
|
10
|
+
coverage?: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"version": 2,
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Vitest executor",
|
|
6
|
+
"description": "Test using Vitest.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"config": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "The path to the local vitest config",
|
|
12
|
+
"x-completion-type": "file",
|
|
13
|
+
"x-completion-glob": "@(vitest|vite).config@(.js|.ts)"
|
|
14
|
+
},
|
|
15
|
+
"passWithNoTests": {
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"default": true,
|
|
18
|
+
"description": "Pass the test even if no tests are found"
|
|
19
|
+
},
|
|
20
|
+
"testNamePattern": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"description": "Run tests with full names matching the pattern"
|
|
23
|
+
},
|
|
24
|
+
"mode": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": ["test", "benchmark", "typecheck"],
|
|
27
|
+
"default": "test",
|
|
28
|
+
"description": "The mode that vitest will run on",
|
|
29
|
+
"x-priority": "important"
|
|
30
|
+
},
|
|
31
|
+
"watch": {
|
|
32
|
+
"type": "boolean",
|
|
33
|
+
"default": false,
|
|
34
|
+
"description": "Enable watch mode"
|
|
35
|
+
},
|
|
36
|
+
"reporters": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"description": "An array of reporters to pass to vitest"
|
|
42
|
+
},
|
|
43
|
+
"update": {
|
|
44
|
+
"type": "boolean",
|
|
45
|
+
"default": false,
|
|
46
|
+
"alias": "u",
|
|
47
|
+
"description": "Update snapshots",
|
|
48
|
+
"x-priority": "important"
|
|
49
|
+
},
|
|
50
|
+
"coverage": {
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"default": false,
|
|
53
|
+
"description": "Enable coverage report",
|
|
54
|
+
"x-priority": "important"
|
|
55
|
+
},
|
|
56
|
+
"reportsDirectory": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "Directory to write coverage report to."
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"required": [],
|
|
62
|
+
"examplesFile": "../../../docs/test-examples.md"
|
|
63
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { VitestExecutorOptions } from './schema';
|
|
3
|
+
export declare function vitestExecutor(options: VitestExecutorOptions, context: ExecutorContext): AsyncGenerator<never, {
|
|
4
|
+
success: boolean;
|
|
5
|
+
}, unknown>;
|
|
6
|
+
export default vitestExecutor;
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
vitestExecutor: ()=>vitestExecutor,
|
|
10
|
+
default: ()=>_default
|
|
11
|
+
});
|
|
12
|
+
const _extends = require("@swc/helpers/lib/_extends.js").default;
|
|
13
|
+
const _devkit = require("@nx/devkit");
|
|
14
|
+
const _vite = require("vite");
|
|
15
|
+
const _path = require("path");
|
|
16
|
+
const _fs = require("fs");
|
|
17
|
+
let NxReporter = class NxReporter {
|
|
18
|
+
async *[Symbol.asyncIterator]() {
|
|
19
|
+
do {
|
|
20
|
+
const hasErrors = await this.deferred.promise;
|
|
21
|
+
yield {
|
|
22
|
+
hasErrors
|
|
23
|
+
};
|
|
24
|
+
this.setupDeferred();
|
|
25
|
+
}while (this.watch)
|
|
26
|
+
}
|
|
27
|
+
setupDeferred() {
|
|
28
|
+
let resolve;
|
|
29
|
+
this.deferred = {
|
|
30
|
+
promise: new Promise((res)=>{
|
|
31
|
+
resolve = res;
|
|
32
|
+
}),
|
|
33
|
+
resolve
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
onFinished(files, errors) {
|
|
37
|
+
const hasErrors = files.some((f)=>{
|
|
38
|
+
var ref;
|
|
39
|
+
return ((ref = f.result) == null ? void 0 : ref.state) === 'fail';
|
|
40
|
+
}) || (errors == null ? void 0 : errors.length) > 0;
|
|
41
|
+
this.deferred.resolve(hasErrors);
|
|
42
|
+
}
|
|
43
|
+
constructor(watch){
|
|
44
|
+
this.watch = watch;
|
|
45
|
+
this.setupDeferred();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
async function* vitestExecutor(options, context) {
|
|
49
|
+
const { startVitest } = await Function('return import("vitest/node")')();
|
|
50
|
+
const nxReporter = new NxReporter(options.watch);
|
|
51
|
+
const settings = await getSettings(options, context);
|
|
52
|
+
settings.reporters.push(nxReporter);
|
|
53
|
+
const ctx = await startVitest(options.mode, [], settings);
|
|
54
|
+
let hasErrors = false;
|
|
55
|
+
const processExit = ()=>{
|
|
56
|
+
ctx.exit();
|
|
57
|
+
if (hasErrors) {
|
|
58
|
+
process.exit(1);
|
|
59
|
+
} else {
|
|
60
|
+
process.exit(0);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
if (options.watch) {
|
|
64
|
+
process.on('SIGINT', processExit);
|
|
65
|
+
process.on('SIGTERM', processExit);
|
|
66
|
+
process.on('exit', processExit);
|
|
67
|
+
}
|
|
68
|
+
for await (const report of nxReporter){
|
|
69
|
+
// vitest sets the exitCode = 1 when code coverage isn't met
|
|
70
|
+
hasErrors = report.hasErrors || process.exitCode && process.exitCode !== 0;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
success: !hasErrors
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async function getSettings(options, context) {
|
|
77
|
+
var ref, ref1, ref2, ref3, ref4;
|
|
78
|
+
const projectRoot = context.projectGraph.nodes[context.projectName].data.root;
|
|
79
|
+
const offset = (0, _path.relative)(_devkit.workspaceRoot, context.cwd);
|
|
80
|
+
// if reportsDirectory is not provides vitest will remove all files in the project root
|
|
81
|
+
// when coverage is enabled in the vite.config.ts
|
|
82
|
+
const coverage = options.reportsDirectory ? {
|
|
83
|
+
enabled: options.coverage,
|
|
84
|
+
reportsDirectory: options.reportsDirectory
|
|
85
|
+
} : {};
|
|
86
|
+
const viteConfigPath = options.config ? (0, _path.join)(context.root, options.config) : findViteConfig((0, _path.join)(context.root, projectRoot));
|
|
87
|
+
const resolved = await (0, _vite.loadConfigFromFile)({
|
|
88
|
+
mode: options.mode,
|
|
89
|
+
command: 'serve'
|
|
90
|
+
}, viteConfigPath);
|
|
91
|
+
if (!viteConfigPath || !(resolved == null ? void 0 : (ref = resolved.config) == null ? void 0 : ref.test)) {
|
|
92
|
+
var _path1;
|
|
93
|
+
_devkit.logger.warn((0, _devkit.stripIndents)`Unable to load test config from config file ${(_path1 = resolved.path) != null ? _path1 : viteConfigPath}
|
|
94
|
+
Some settings may not be applied as expected.
|
|
95
|
+
You can manually set the config in the project, ${context.projectName}, configuration.
|
|
96
|
+
`);
|
|
97
|
+
}
|
|
98
|
+
var _reporters, ref5;
|
|
99
|
+
const settings = _extends({}, options, {
|
|
100
|
+
// when running nx from the project root, the root will get appended to the cwd.
|
|
101
|
+
// creating an invalid path and no tests will be found.
|
|
102
|
+
// instead if we are not at the root, let the cwd be root.
|
|
103
|
+
root: offset === '' ? projectRoot : '',
|
|
104
|
+
reporters: [
|
|
105
|
+
...(_reporters = options.reporters) != null ? _reporters : [],
|
|
106
|
+
...(ref5 = resolved == null ? void 0 : (ref1 = resolved.config) == null ? void 0 : (ref2 = ref1.test) == null ? void 0 : ref2.reporters) != null ? ref5 : [],
|
|
107
|
+
'default'
|
|
108
|
+
],
|
|
109
|
+
coverage: _extends({}, resolved == null ? void 0 : (ref3 = resolved.config) == null ? void 0 : (ref4 = ref3.test) == null ? void 0 : ref4.coverage, coverage)
|
|
110
|
+
});
|
|
111
|
+
return settings;
|
|
112
|
+
}
|
|
113
|
+
function findViteConfig(projectRootFullPath) {
|
|
114
|
+
const allowsExt = [
|
|
115
|
+
'js',
|
|
116
|
+
'mjs',
|
|
117
|
+
'ts',
|
|
118
|
+
'cjs',
|
|
119
|
+
'mts',
|
|
120
|
+
'cts'
|
|
121
|
+
];
|
|
122
|
+
for (const ext of allowsExt){
|
|
123
|
+
if ((0, _fs.existsSync)((0, _path.join)(projectRootFullPath, `vite.config.${ext}`))) {
|
|
124
|
+
return (0, _path.join)(projectRootFullPath, `vite.config.${ext}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const _default = vitestExecutor;
|
|
129
|
+
|
|
130
|
+
//# sourceMappingURL=vitest.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/executors/test/vitest.impl.ts"],"sourcesContent":["import {\n ExecutorContext,\n logger,\n stripIndents,\n workspaceRoot,\n} from '@nx/devkit';\nimport { CoverageOptions, File, Reporter } from 'vitest';\nimport { loadConfigFromFile } from 'vite';\nimport { VitestExecutorOptions } from './schema';\nimport { join, relative } from 'path';\nimport { existsSync } from 'fs';\n\nclass NxReporter implements Reporter {\n deferred: {\n promise: Promise<boolean>;\n resolve: (val: boolean) => void;\n };\n\n constructor(private watch: boolean) {\n this.setupDeferred();\n }\n\n async *[Symbol.asyncIterator]() {\n do {\n const hasErrors = await this.deferred.promise;\n yield { hasErrors };\n this.setupDeferred();\n } while (this.watch);\n }\n\n private setupDeferred() {\n let resolve: (val: boolean) => void;\n this.deferred = {\n promise: new Promise((res) => {\n resolve = res;\n }),\n resolve,\n };\n }\n\n onFinished(files: File[], errors?: unknown[]) {\n const hasErrors =\n files.some((f) => f.result?.state === 'fail') || errors?.length > 0;\n this.deferred.resolve(hasErrors);\n }\n}\n\nexport async function* vitestExecutor(\n options: VitestExecutorOptions,\n context: ExecutorContext\n) {\n const { startVitest } = await (Function(\n 'return import(\"vitest/node\")'\n )() as Promise<typeof import('vitest/node')>);\n\n const nxReporter = new NxReporter(options.watch);\n const settings = await getSettings(options, context);\n settings.reporters.push(nxReporter);\n\n const ctx = await startVitest(options.mode, [], settings);\n\n let hasErrors = false;\n\n const processExit = () => {\n ctx.exit();\n if (hasErrors) {\n process.exit(1);\n } else {\n process.exit(0);\n }\n };\n\n if (options.watch) {\n process.on('SIGINT', processExit);\n process.on('SIGTERM', processExit);\n process.on('exit', processExit);\n }\n\n for await (const report of nxReporter) {\n // vitest sets the exitCode = 1 when code coverage isn't met\n hasErrors =\n report.hasErrors || (process.exitCode && process.exitCode !== 0);\n }\n\n return {\n success: !hasErrors,\n };\n}\n\nasync function getSettings(\n options: VitestExecutorOptions,\n context: ExecutorContext\n) {\n const projectRoot = context.projectGraph.nodes[context.projectName].data.root;\n const offset = relative(workspaceRoot, context.cwd);\n // if reportsDirectory is not provides vitest will remove all files in the project root\n // when coverage is enabled in the vite.config.ts\n const coverage: CoverageOptions = options.reportsDirectory\n ? {\n enabled: options.coverage,\n reportsDirectory: options.reportsDirectory,\n }\n : {};\n\n const viteConfigPath = options.config\n ? join(context.root, options.config)\n : findViteConfig(join(context.root, projectRoot));\n\n const resolved = await loadConfigFromFile(\n {\n mode: options.mode,\n command: 'serve',\n },\n viteConfigPath\n );\n\n if (!viteConfigPath || !resolved?.config?.test) {\n logger.warn(stripIndents`Unable to load test config from config file ${\n resolved.path ?? viteConfigPath\n }\nSome settings may not be applied as expected.\nYou can manually set the config in the project, ${\n context.projectName\n }, configuration.\n `);\n }\n\n const settings = {\n ...options,\n // when running nx from the project root, the root will get appended to the cwd.\n // creating an invalid path and no tests will be found.\n // instead if we are not at the root, let the cwd be root.\n root: offset === '' ? projectRoot : '',\n reporters: [\n ...(options.reporters ?? []),\n ...((resolved?.config?.test?.reporters as string[]) ?? []),\n 'default',\n ] as (string | Reporter)[],\n coverage: { ...resolved?.config?.test?.coverage, ...coverage },\n };\n\n return settings;\n}\n\nfunction findViteConfig(projectRootFullPath: string): string {\n const allowsExt = ['js', 'mjs', 'ts', 'cjs', 'mts', 'cts'];\n\n for (const ext of allowsExt) {\n if (existsSync(join(projectRootFullPath, `vite.config.${ext}`))) {\n return join(projectRootFullPath, `vite.config.${ext}`);\n }\n }\n}\n\nexport default vitestExecutor;\n"],"names":["vitestExecutor","NxReporter","Symbol","asyncIterator","hasErrors","deferred","promise","setupDeferred","watch","resolve","Promise","res","onFinished","files","errors","some","f","result","state","length","constructor","options","context","startVitest","Function","nxReporter","settings","getSettings","reporters","push","ctx","mode","processExit","exit","process","on","report","exitCode","success","resolved","projectRoot","projectGraph","nodes","projectName","data","root","offset","relative","workspaceRoot","cwd","coverage","reportsDirectory","enabled","viteConfigPath","config","join","findViteConfig","loadConfigFromFile","command","test","logger","warn","stripIndents","path","projectRootFullPath","allowsExt","ext","existsSync"],"mappings":"AAAA;;;;;;;;IA+CuBA,cAAc,MAAdA;IA2GvB,OAA8B,MAA9B;;;wBArJO;sBAE4B;sBAEJ;oBACJ;AAE3B,IAAA,AAAMC,aAAN,MAAMA;IAUJ,OAAO,CAACC,OAAOC,aAAa,CAAC,GAAG;QAC9B,GAAG;YACD,MAAMC,YAAY,MAAM,IAAI,CAACC,QAAQ,CAACC,OAAO;YAC7C,MAAM;gBAAEF;YAAU;YAClB,IAAI,CAACG,aAAa;QACpB,QAAS,IAAI,CAACC,KAAK,CAAE;IACvB;IAEQD,gBAAgB;QACtB,IAAIE;QACJ,IAAI,CAACJ,QAAQ,GAAG;YACdC,SAAS,IAAII,QAAQ,CAACC,MAAQ;gBAC5BF,UAAUE;YACZ;YACAF;QACF;IACF;IAEAG,WAAWC,K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QAAAA,KAAkBoB,gBAAlBpB,KAAAA,SAAwBX,SAAR,YAAjB,OAAmD,EAAE;YACzD;SACD;QACDsB,UAAU,aAAKX,mBAAAA,KAAAA,IAAAA,CAAAA,OAAAA,SAAUe,MAAM,YAAhBf,KAAAA,IAAAA,QAAAA,KAAkBoB,gBAAlBpB,KAAAA,SAAwBW,QAAR,EAAqBA;;IAGtD,OAAOxB;AACT;AAEA,SAAS8B,eAAeQ,mBAA2B,EAAU;IAC3D,MAAMC,YAAY;QAAC;QAAM;QAAO;QAAM;QAAO;QAAO;KAAM;IAE1D,KAAK,MAAMC,OAAOD,UAAW;QAC3B,IAAIE,IAAAA,cAAU,EAACZ,IAAAA,UAAI,EAACS,qBAAqB,CAAC,YAAY,EAAEE,IAAI,CAAC,IAAI;YAC/D,OAAOX,IAAAA,UAAI,EAACS,qBAAqB,CAAC,YAAY,EAAEE,IAAI,CAAC;QACvD,CAAC;IACH;AACF;MAEA,WAAelE"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
|
+
import { ViteConfigurationGeneratorSchema } from './schema';
|
|
3
|
+
export declare function viteConfigurationGenerator(tree: Tree, schema: ViteConfigurationGeneratorSchema): Promise<GeneratorCallback>;
|
|
4
|
+
export default viteConfigurationGenerator;
|
|
5
|
+
export declare const configurationSchematic: (generatorOptions: ViteConfigurationGeneratorSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
viteConfigurationGenerator: ()=>viteConfigurationGenerator,
|
|
10
|
+
default: ()=>_default,
|
|
11
|
+
configurationSchematic: ()=>configurationSchematic
|
|
12
|
+
});
|
|
13
|
+
const _devkit = require("@nx/devkit");
|
|
14
|
+
const _generatorUtils = require("../../utils/generator-utils");
|
|
15
|
+
const _init = require("../init/init");
|
|
16
|
+
const _vitestGenerator = require("../vitest/vitest-generator");
|
|
17
|
+
var _schema;
|
|
18
|
+
async function viteConfigurationGenerator(tree, schema) {
|
|
19
|
+
const tasks = [];
|
|
20
|
+
const { targets , projectType , root } = (0, _devkit.readProjectConfiguration)(tree, schema.project);
|
|
21
|
+
let buildTargetName = 'build';
|
|
22
|
+
let serveTargetName = 'serve';
|
|
23
|
+
let testTargetName = 'test';
|
|
24
|
+
var _includeLib;
|
|
25
|
+
(_includeLib = (_schema = schema).includeLib) != null ? _includeLib : _schema.includeLib = projectType === 'library';
|
|
26
|
+
/**
|
|
27
|
+
* This is for when we are converting an existing project
|
|
28
|
+
* to use the vite executors.
|
|
29
|
+
*/ let projectAlreadyHasViteTargets = {};
|
|
30
|
+
if (!schema.newProject) {
|
|
31
|
+
var ref, ref1;
|
|
32
|
+
const userProvidedTargetName = {
|
|
33
|
+
build: schema.buildTarget,
|
|
34
|
+
serve: schema.serveTarget,
|
|
35
|
+
test: schema.testTarget
|
|
36
|
+
};
|
|
37
|
+
const { validFoundTargetName , projectContainsUnsupportedExecutor , userProvidedTargetIsUnsupported , alreadyHasNxViteTargets } = (0, _generatorUtils.findExistingTargetsInProject)(targets, userProvidedTargetName);
|
|
38
|
+
projectAlreadyHasViteTargets = alreadyHasNxViteTargets;
|
|
39
|
+
/**
|
|
40
|
+
* This means that we only found unsupported build targets in that project.
|
|
41
|
+
* The only way that buildTarget is defined, means that it is supported.
|
|
42
|
+
*
|
|
43
|
+
* If the `unsupported` flag was false, it would mean that we did not find
|
|
44
|
+
* a build target at all, so we can create a new one.
|
|
45
|
+
*
|
|
46
|
+
* So we only throw if we found a target, but it is unsupported.
|
|
47
|
+
*/ if (!validFoundTargetName.build && projectContainsUnsupportedExecutor) {
|
|
48
|
+
throw new Error(`The project ${schema.project} cannot be converted to use the @nrwl/vite executors.`);
|
|
49
|
+
}
|
|
50
|
+
if (alreadyHasNxViteTargets.build && (alreadyHasNxViteTargets.serve || projectType === 'library') && alreadyHasNxViteTargets.test) {
|
|
51
|
+
throw new Error(`The project ${schema.project} is already configured to use the @nrwl/vite executors.
|
|
52
|
+
Please try a different project, or remove the existing targets
|
|
53
|
+
and re-run this generator to reset the existing Vite Configuration.
|
|
54
|
+
`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* This means that we did not find any supported executors
|
|
58
|
+
* so we don't have any valid target names.
|
|
59
|
+
*
|
|
60
|
+
* However, the executors that we may have found are not in the
|
|
61
|
+
* list of the specifically unsupported executors either.
|
|
62
|
+
*
|
|
63
|
+
* So, we should warn the user about it.
|
|
64
|
+
*/ if (!projectContainsUnsupportedExecutor && !validFoundTargetName.build && !validFoundTargetName.serve && !validFoundTargetName.test) {
|
|
65
|
+
await (0, _generatorUtils.handleUnknownExecutors)(schema.project);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* There is a possibility at this stage that the user has provided
|
|
69
|
+
* targets with unsupported executors.
|
|
70
|
+
* We keep track here of which of the targets that the user provided
|
|
71
|
+
* are unsupported.
|
|
72
|
+
* We do this with the `userProvidedTargetIsUnsupported` object,
|
|
73
|
+
* which contains flags for each target (whether it is supported or not).
|
|
74
|
+
*
|
|
75
|
+
* We also keep track of the targets that we found in the project,
|
|
76
|
+
* through the findExistingTargetsInProject function, which returns
|
|
77
|
+
* targets for build/serve/test that use supported executors, and
|
|
78
|
+
* can be converted to use the vite executors. These are the
|
|
79
|
+
* kept in the validFoundTargetName object.
|
|
80
|
+
*/ await (0, _generatorUtils.handleUnsupportedUserProvidedTargets)(userProvidedTargetIsUnsupported, userProvidedTargetName, validFoundTargetName);
|
|
81
|
+
var _build;
|
|
82
|
+
/**
|
|
83
|
+
* Once the user is at this stage, then they can go ahead and convert.
|
|
84
|
+
*/ buildTargetName = (_build = validFoundTargetName.build) != null ? _build : buildTargetName;
|
|
85
|
+
var _serve;
|
|
86
|
+
serveTargetName = (_serve = validFoundTargetName.serve) != null ? _serve : serveTargetName;
|
|
87
|
+
if (projectType === 'application') {
|
|
88
|
+
(0, _generatorUtils.moveAndEditIndexHtml)(tree, schema, buildTargetName);
|
|
89
|
+
}
|
|
90
|
+
(0, _generatorUtils.deleteWebpackConfig)(tree, root, targets == null ? void 0 : (ref = targets[buildTargetName]) == null ? void 0 : (ref1 = ref.options) == null ? void 0 : ref1.webpackConfig);
|
|
91
|
+
(0, _generatorUtils.editTsConfig)(tree, schema);
|
|
92
|
+
}
|
|
93
|
+
const initTask = await (0, _init.default)(tree, {
|
|
94
|
+
uiFramework: schema.uiFramework,
|
|
95
|
+
includeLib: schema.includeLib
|
|
96
|
+
});
|
|
97
|
+
tasks.push(initTask);
|
|
98
|
+
if (!projectAlreadyHasViteTargets.build) {
|
|
99
|
+
(0, _generatorUtils.addOrChangeBuildTarget)(tree, schema, buildTargetName);
|
|
100
|
+
}
|
|
101
|
+
if (!schema.includeLib) {
|
|
102
|
+
if (!projectAlreadyHasViteTargets.serve) {
|
|
103
|
+
(0, _generatorUtils.addOrChangeServeTarget)(tree, schema, serveTargetName);
|
|
104
|
+
}
|
|
105
|
+
if (!projectAlreadyHasViteTargets.preview) {
|
|
106
|
+
(0, _generatorUtils.addPreviewTarget)(tree, schema, serveTargetName);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
(0, _generatorUtils.createOrEditViteConfig)(tree, schema, false, projectAlreadyHasViteTargets);
|
|
110
|
+
if (schema.includeVitest) {
|
|
111
|
+
const vitestTask = await (0, _vitestGenerator.default)(tree, {
|
|
112
|
+
project: schema.project,
|
|
113
|
+
uiFramework: schema.uiFramework,
|
|
114
|
+
inSourceTests: schema.inSourceTests,
|
|
115
|
+
coverageProvider: 'c8',
|
|
116
|
+
skipViteConfig: true,
|
|
117
|
+
testTarget: testTargetName,
|
|
118
|
+
skipFormat: true
|
|
119
|
+
});
|
|
120
|
+
tasks.push(vitestTask);
|
|
121
|
+
}
|
|
122
|
+
if (!schema.skipFormat) {
|
|
123
|
+
await (0, _devkit.formatFiles)(tree);
|
|
124
|
+
}
|
|
125
|
+
return (0, _devkit.runTasksInSerial)(...tasks);
|
|
126
|
+
}
|
|
127
|
+
const _default = viteConfigurationGenerator;
|
|
128
|
+
const configurationSchematic = (0, _devkit.convertNxGenerator)(viteConfigurationGenerator);
|
|
129
|
+
|
|
130
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/generators/configuration/configuration.ts"],"sourcesContent":["import {\n convertNxGenerator,\n formatFiles,\n GeneratorCallback,\n readProjectConfiguration,\n runTasksInSerial,\n Tree,\n} from '@nx/devkit';\n\nimport {\n addOrChangeBuildTarget,\n addOrChangeServeTarget,\n addPreviewTarget,\n createOrEditViteConfig,\n deleteWebpackConfig,\n editTsConfig,\n findExistingTargetsInProject,\n handleUnknownExecutors,\n handleUnsupportedUserProvidedTargets,\n moveAndEditIndexHtml,\n TargetFlags,\n UserProvidedTargetName,\n} from '../../utils/generator-utils';\n\nimport initGenerator from '../init/init';\nimport vitestGenerator from '../vitest/vitest-generator';\nimport { ViteConfigurationGeneratorSchema } from './schema';\n\nexport async function viteConfigurationGenerator(\n tree: Tree,\n schema: ViteConfigurationGeneratorSchema\n) {\n const tasks: GeneratorCallback[] = [];\n\n const { targets, projectType, root } = readProjectConfiguration(\n tree,\n schema.project\n );\n let buildTargetName = 'build';\n let serveTargetName = 'serve';\n let testTargetName = 'test';\n\n schema.includeLib ??= projectType === 'library';\n\n /**\n * This is for when we are converting an existing project\n * to use the vite executors.\n */\n let projectAlreadyHasViteTargets: TargetFlags = {};\n\n if (!schema.newProject) {\n const userProvidedTargetName: UserProvidedTargetName = {\n build: schema.buildTarget,\n serve: schema.serveTarget,\n test: schema.testTarget,\n };\n\n const {\n validFoundTargetName,\n projectContainsUnsupportedExecutor,\n userProvidedTargetIsUnsupported,\n alreadyHasNxViteTargets,\n } = findExistingTargetsInProject(targets, userProvidedTargetName);\n projectAlreadyHasViteTargets = alreadyHasNxViteTargets;\n /**\n * This means that we only found unsupported build targets in that project.\n * The only way that buildTarget is defined, means that it is supported.\n *\n * If the `unsupported` flag was false, it would mean that we did not find\n * a build target at all, so we can create a new one.\n *\n * So we only throw if we found a target, but it is unsupported.\n */\n if (!validFoundTargetName.build && projectContainsUnsupportedExecutor) {\n throw new Error(\n `The project ${schema.project} cannot be converted to use the @nrwl/vite executors.`\n );\n }\n\n if (\n alreadyHasNxViteTargets.build &&\n (alreadyHasNxViteTargets.serve || projectType === 'library') &&\n alreadyHasNxViteTargets.test\n ) {\n throw new Error(\n `The project ${schema.project} is already configured to use the @nrwl/vite executors.\n Please try a different project, or remove the existing targets \n and re-run this generator to reset the existing Vite Configuration.\n `\n );\n }\n\n /**\n * This means that we did not find any supported executors\n * so we don't have any valid target names.\n *\n * However, the executors that we may have found are not in the\n * list of the specifically unsupported executors either.\n *\n * So, we should warn the user about it.\n */\n\n if (\n !projectContainsUnsupportedExecutor &&\n !validFoundTargetName.build &&\n !validFoundTargetName.serve &&\n !validFoundTargetName.test\n ) {\n await handleUnknownExecutors(schema.project);\n }\n\n /**\n * There is a possibility at this stage that the user has provided\n * targets with unsupported executors.\n * We keep track here of which of the targets that the user provided\n * are unsupported.\n * We do this with the `userProvidedTargetIsUnsupported` object,\n * which contains flags for each target (whether it is supported or not).\n *\n * We also keep track of the targets that we found in the project,\n * through the findExistingTargetsInProject function, which returns\n * targets for build/serve/test that use supported executors, and\n * can be converted to use the vite executors. These are the\n * kept in the validFoundTargetName object.\n */\n await handleUnsupportedUserProvidedTargets(\n userProvidedTargetIsUnsupported,\n userProvidedTargetName,\n validFoundTargetName\n );\n\n /**\n * Once the user is at this stage, then they can go ahead and convert.\n */\n\n buildTargetName = validFoundTargetName.build ?? buildTargetName;\n serveTargetName = validFoundTargetName.serve ?? serveTargetName;\n\n if (projectType === 'application') {\n moveAndEditIndexHtml(tree, schema, buildTargetName);\n }\n\n deleteWebpackConfig(\n tree,\n root,\n targets?.[buildTargetName]?.options?.webpackConfig\n );\n\n editTsConfig(tree, schema);\n }\n\n const initTask = await initGenerator(tree, {\n uiFramework: schema.uiFramework,\n includeLib: schema.includeLib,\n });\n tasks.push(initTask);\n\n if (!projectAlreadyHasViteTargets.build) {\n addOrChangeBuildTarget(tree, schema, buildTargetName);\n }\n\n if (!schema.includeLib) {\n if (!projectAlreadyHasViteTargets.serve) {\n addOrChangeServeTarget(tree, schema, serveTargetName);\n }\n if (!projectAlreadyHasViteTargets.preview) {\n addPreviewTarget(tree, schema, serveTargetName);\n }\n }\n\n createOrEditViteConfig(tree, schema, false, projectAlreadyHasViteTargets);\n\n if (schema.includeVitest) {\n const vitestTask = await vitestGenerator(tree, {\n project: schema.project,\n uiFramework: schema.uiFramework,\n inSourceTests: schema.inSourceTests,\n coverageProvider: 'c8',\n skipViteConfig: true,\n testTarget: testTargetName,\n skipFormat: true,\n });\n tasks.push(vitestTask);\n }\n\n if (!schema.skipFormat) {\n await formatFiles(tree);\n }\n\n return runTasksInSerial(...tasks);\n}\n\nexport default viteConfigurationGenerator;\nexport const configurationSchematic = convertNxGenerator(\n viteConfigurationGenerator\n);\n"],"names":["viteConfigurationGenerator","configurationSchematic","schema","tree","tasks","targets","projectType","root","readProjectConfiguration","project","buildTargetName","serveTargetName","testTargetName","includeLib","projectAlreadyHasViteTargets","newProject","userProvidedTargetName","build","buildTarget","serve","serveTarget","test","testTarget","validFoundTargetName","projectContainsUnsupportedExecutor","userProvidedTargetIsUnsupported","alreadyHasNxViteTargets","findExistingTargetsInProject","Error","handleUnknownExecutors","handleUnsupportedUserProvidedTargets","moveAndEditIndexHtml","deleteWebpackConfig","options","webpackConfig","editTsConfig","initTask","initGenerator","uiFramework","push","addOrChangeBuildTarget","addOrChangeServeTarget","preview","addPreviewTarget","createOrEditViteConfig","includeVitest","vitestTask","vitestGenerator","inSourceTests","coverageProvider","sk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EDiC,IAAAA,sCAAsB,EAACzC,MAAMD,QAAQ,KAAK,EAAEY;IAE5C,IAAIZ,OAAO2C,aAAa,EAAE;QACxB,MAAMC,aAAa,MAAMC,IAAAA,wBAAe,EAAC5C,MAAM;YAC7CM,SAASP,OAAOO,OAAO;YACvB6B,aAAapC,OAAOoC,WAAW;YAC/BU,eAAe9C,OAAO8C,aAAa;YACnCC,kBAAkB;YAClBC,gBAAgB,IAAI;YACpB5B,YAAYV;YACZuC,YAAY,IAAI;QAClB;QACA/C,MAAMmC,IAAI,CAACO;IACb,CAAC;IAED,IAAI,CAAC5C,OAAOiD,UAAU,EAAE;QACtB,MAAMC,IAAAA,mBAAW,EAACjD;IACpB,CAAC;IAED,OAAOkD,IAAAA,wBAAgB,KAAIjD;AAC7B;MAEA,WAAeJ;AACR,MAAMC,yBAAyBqD,IAAAA,0BAAkB,EACtDtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/generators/configuration/schema.d.ts"],"sourcesContent":["export interface ViteConfigurationGeneratorSchema {\n uiFramework: 'react' | 'none';\n project: string;\n newProject?: boolean;\n includeVitest?: boolean;\n inSourceTests?: boolean;\n includeLib?: boolean;\n buildTarget?: string;\n serveTarget?: string;\n testTarget?: string;\n skipFormat?: boolean;\n}\n"],"names":[],"mappings":"AAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ViteConfigurationGeneratorSchema {
|
|
2
|
+
uiFramework: 'react' | 'none';
|
|
3
|
+
project: string;
|
|
4
|
+
newProject?: boolean;
|
|
5
|
+
includeVitest?: boolean;
|
|
6
|
+
inSourceTests?: boolean;
|
|
7
|
+
includeLib?: boolean;
|
|
8
|
+
buildTarget?: string;
|
|
9
|
+
serveTarget?: string;
|
|
10
|
+
testTarget?: string;
|
|
11
|
+
skipFormat?: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cli": "nx",
|
|
3
|
+
"title": "Configure a project to use Vite.js.",
|
|
4
|
+
"description": "Configure a project to use Vite.js.",
|
|
5
|
+
"$id": "configure-vite-project",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"project": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the project.",
|
|
11
|
+
"$default": {
|
|
12
|
+
"$source": "argv",
|
|
13
|
+
"index": 0
|
|
14
|
+
},
|
|
15
|
+
"aliases": ["name", "projectName"],
|
|
16
|
+
"x-dropdown": "project",
|
|
17
|
+
"x-prompt": "What is the name of the project to set up Vite for?"
|
|
18
|
+
},
|
|
19
|
+
"includeLib": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"description": "Add a library build option and skip the server option.",
|
|
22
|
+
"hidden": true
|
|
23
|
+
},
|
|
24
|
+
"includeVitest": {
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"description": "Use vitest for the test suite."
|
|
27
|
+
},
|
|
28
|
+
"uiFramework": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "UI Framework to use for Vite.",
|
|
31
|
+
"enum": ["react", "none"],
|
|
32
|
+
"default": "none",
|
|
33
|
+
"x-prompt": "What UI framework plugin should Vite use?"
|
|
34
|
+
},
|
|
35
|
+
"newProject": {
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"description": "Is this a new project?",
|
|
38
|
+
"default": false,
|
|
39
|
+
"hidden": true
|
|
40
|
+
},
|
|
41
|
+
"buildTarget": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "The build target of the project to be transformed to use the @nrwl/vite:build executor."
|
|
44
|
+
},
|
|
45
|
+
"serveTarget": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "The serve target of the project to be transformed to use the @nrwl/vite:dev-server and @nrwl/vite:preview-server executors."
|
|
48
|
+
},
|
|
49
|
+
"testTarget": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "The test target of the project to be transformed to use the @nrwl/vite:test executor."
|
|
52
|
+
},
|
|
53
|
+
"skipFormat": {
|
|
54
|
+
"description": "Skip formatting files.",
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"default": false,
|
|
57
|
+
"x-priority": "internal"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"examplesFile": "../../../docs/configuration-examples.md"
|
|
61
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
|
+
import { InitGeneratorSchema } from './schema';
|
|
3
|
+
export declare function createVitestConfig(tree: Tree): void;
|
|
4
|
+
export declare function initGenerator(tree: Tree, schema: InitGeneratorSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
5
|
+
export default initGenerator;
|
|
6
|
+
export declare const initSchematic: (generatorOptions: InitGeneratorSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
createVitestConfig: ()=>createVitestConfig,
|
|
10
|
+
initGenerator: ()=>initGenerator,
|
|
11
|
+
default: ()=>_default,
|
|
12
|
+
initSchematic: ()=>initSchematic
|
|
13
|
+
});
|
|
14
|
+
const _extends = require("@swc/helpers/lib/_extends.js").default;
|
|
15
|
+
const _devkit = require("@nx/devkit");
|
|
16
|
+
const _js = require("@nx/js");
|
|
17
|
+
const _versions = require("../../utils/versions");
|
|
18
|
+
var _nxJson, _targetDefaults, _test;
|
|
19
|
+
function checkDependenciesInstalled(host, schema) {
|
|
20
|
+
const packageJson = (0, _devkit.readJson)(host, 'package.json');
|
|
21
|
+
const devDependencies = {};
|
|
22
|
+
const dependencies = {};
|
|
23
|
+
packageJson.dependencies = packageJson.dependencies || {};
|
|
24
|
+
packageJson.devDependencies = packageJson.devDependencies || {};
|
|
25
|
+
// base deps
|
|
26
|
+
devDependencies['@nrwl/vite'] = _versions.nxVersion;
|
|
27
|
+
devDependencies['vite'] = _versions.viteVersion;
|
|
28
|
+
devDependencies['vite-plugin-eslint'] = _versions.vitePluginEslintVersion;
|
|
29
|
+
devDependencies['vite-tsconfig-paths'] = _versions.viteTsConfigPathsVersion;
|
|
30
|
+
devDependencies['vitest'] = _versions.vitestVersion;
|
|
31
|
+
devDependencies['@vitest/ui'] = _versions.vitestUiVersion;
|
|
32
|
+
devDependencies['jsdom'] = _versions.jsdomVersion;
|
|
33
|
+
if (schema.uiFramework === 'react') {
|
|
34
|
+
devDependencies['@vitejs/plugin-react'] = _versions.vitePluginReactVersion;
|
|
35
|
+
}
|
|
36
|
+
if (schema.includeLib) {
|
|
37
|
+
devDependencies['vite-plugin-dts'] = _versions.vitePluginDtsVersion;
|
|
38
|
+
}
|
|
39
|
+
return (0, _devkit.addDependenciesToPackageJson)(host, dependencies, devDependencies);
|
|
40
|
+
}
|
|
41
|
+
function moveToDevDependencies(tree) {
|
|
42
|
+
(0, _devkit.updateJson)(tree, 'package.json', (packageJson)=>{
|
|
43
|
+
packageJson.dependencies = packageJson.dependencies || {};
|
|
44
|
+
packageJson.devDependencies = packageJson.devDependencies || {};
|
|
45
|
+
if (packageJson.dependencies['@nrwl/vite']) {
|
|
46
|
+
packageJson.devDependencies['@nrwl/vite'] = packageJson.dependencies['@nrwl/vite'];
|
|
47
|
+
delete packageJson.dependencies['@nrwl/vite'];
|
|
48
|
+
}
|
|
49
|
+
return packageJson;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function createVitestConfig(tree) {
|
|
53
|
+
var ref;
|
|
54
|
+
const nxJson = (0, _devkit.readNxJson)(tree);
|
|
55
|
+
const productionFileSet = (ref = nxJson.namedInputs) == null ? void 0 : ref.production;
|
|
56
|
+
if (productionFileSet) {
|
|
57
|
+
productionFileSet.push('!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)', '!{projectRoot}/tsconfig.spec.json');
|
|
58
|
+
nxJson.namedInputs.production = Array.from(new Set(productionFileSet));
|
|
59
|
+
}
|
|
60
|
+
var _targetDefaults1;
|
|
61
|
+
(_targetDefaults1 = (_nxJson = nxJson).targetDefaults) != null ? _targetDefaults1 : _nxJson.targetDefaults = {};
|
|
62
|
+
var _test1;
|
|
63
|
+
(_test1 = (_targetDefaults = nxJson.targetDefaults).test) != null ? _test1 : _targetDefaults.test = {};
|
|
64
|
+
var _inputs;
|
|
65
|
+
(_inputs = (_test = nxJson.targetDefaults.test).inputs) != null ? _inputs : _test.inputs = [
|
|
66
|
+
'default',
|
|
67
|
+
productionFileSet ? '^production' : '^default'
|
|
68
|
+
];
|
|
69
|
+
(0, _devkit.updateNxJson)(tree, nxJson);
|
|
70
|
+
}
|
|
71
|
+
async function initGenerator(tree, schema) {
|
|
72
|
+
moveToDevDependencies(tree);
|
|
73
|
+
createVitestConfig(tree);
|
|
74
|
+
const tasks = [];
|
|
75
|
+
tasks.push(await (0, _js.initGenerator)(tree, _extends({}, schema, {
|
|
76
|
+
skipFormat: true
|
|
77
|
+
})));
|
|
78
|
+
tasks.push(checkDependenciesInstalled(tree, schema));
|
|
79
|
+
return (0, _devkit.runTasksInSerial)(...tasks);
|
|
80
|
+
}
|
|
81
|
+
const _default = initGenerator;
|
|
82
|
+
const initSchematic = (0, _devkit.convertNxGenerator)(initGenerator);
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/generators/init/init.ts"],"sourcesContent":["import {\n addDependenciesToPackageJson,\n convertNxGenerator,\n readJson,\n readNxJson,\n runTasksInSerial,\n Tree,\n updateJson,\n updateNxJson,\n} from '@nx/devkit';\n\nimport { initGenerator as jsInitGenerator } from '@nx/js';\n\nimport {\n jsdomVersion,\n nxVersion,\n vitePluginDtsVersion,\n vitePluginEslintVersion,\n vitePluginReactVersion,\n vitestUiVersion,\n vitestVersion,\n viteTsConfigPathsVersion,\n viteVersion,\n} from '../../utils/versions';\nimport { InitGeneratorSchema } from './schema';\n\nfunction checkDependenciesInstalled(host: Tree, schema: InitGeneratorSchema) {\n const packageJson = readJson(host, 'package.json');\n const devDependencies = {};\n const dependencies = {};\n packageJson.dependencies = packageJson.dependencies || {};\n packageJson.devDependencies = packageJson.devDependencies || {};\n\n // base deps\n devDependencies['@nrwl/vite'] = nxVersion;\n devDependencies['vite'] = viteVersion;\n devDependencies['vite-plugin-eslint'] = vitePluginEslintVersion;\n devDependencies['vite-tsconfig-paths'] = viteTsConfigPathsVersion;\n devDependencies['vitest'] = vitestVersion;\n devDependencies['@vitest/ui'] = vitestUiVersion;\n devDependencies['jsdom'] = jsdomVersion;\n\n if (schema.uiFramework === 'react') {\n devDependencies['@vitejs/plugin-react'] = vitePluginReactVersion;\n }\n\n if (schema.includeLib) {\n devDependencies['vite-plugin-dts'] = vitePluginDtsVersion;\n }\n\n return addDependenciesToPackageJson(host, dependencies, devDependencies);\n}\n\nfunction moveToDevDependencies(tree: Tree) {\n updateJson(tree, 'package.json', (packageJson) => {\n packageJson.dependencies = packageJson.dependencies || {};\n packageJson.devDependencies = packageJson.devDependencies || {};\n\n if (packageJson.dependencies['@nrwl/vite']) {\n packageJson.devDependencies['@nrwl/vite'] =\n packageJson.dependencies['@nrwl/vite'];\n delete packageJson.dependencies['@nrwl/vite'];\n }\n return packageJson;\n });\n}\n\nexport function createVitestConfig(tree: Tree) {\n const nxJson = readNxJson(tree);\n\n const productionFileSet = nxJson.namedInputs?.production;\n if (productionFileSet) {\n productionFileSet.push(\n '!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)',\n '!{projectRoot}/tsconfig.spec.json'\n );\n\n nxJson.namedInputs.production = Array.from(new Set(productionFileSet));\n }\n\n nxJson.targetDefaults ??= {};\n nxJson.targetDefaults.test ??= {};\n nxJson.targetDefaults.test.inputs ??= [\n 'default',\n productionFileSet ? '^production' : '^default',\n ];\n\n updateNxJson(tree, nxJson);\n}\n\nexport async function initGenerator(tree: Tree, schema: InitGeneratorSchema) {\n moveToDevDependencies(tree);\n createVitestConfig(tree);\n const tasks = [];\n\n tasks.push(\n await jsInitGenerator(tree, {\n ...schema,\n skipFormat: true,\n })\n );\n\n tasks.push(checkDependenciesInstalled(tree, schema));\n return runTasksInSerial(...tasks);\n}\n\nexport default initGenerator;\nexport const initSchematic = convertNxGenerator(initGenerator);\n"],"names":["createVitestConfig","initGenerator","initSchematic","nxJson","checkDependenciesInstalled","host","schema","packageJson","readJson","devDependencies","dependencies","nxVersion","viteVersion","vitePluginEslintVersion","viteTsConfigPathsVersion","vitestVersion","vitestUiVersion","jsdomVersion","uiFramework","vitePluginReactVersion","includeLib","vitePluginDtsVersion","addDependenciesToPackageJson","moveToDevDependencies","tree","updateJson","readNxJson","productionFileSet","namedInputs","production","push","Array","from","Set","targetDefaults","test","inputs","updateNxJson","tasks","jsInitGenerator","skipFormat","runTasksInSerial","convertNxGenerator"],"mappings":"AAAA;;;;;;;;IAmEgBA,kBAAkB,MAAlBA;IAuBMC,aAAa,MAAbA;IAgBtB,OAA6B,MAA7B;IACaC,aAAa,MAAbA;;;wBAlGN;oBAE0C;0BAY1C;IAyDLC,SACAA,iBACAA;AAxDF,SAASC,2BAA2BC,IAAU,EAAEC,MAA2B,EAAE;IAC3E,MAAMC,cAAcC,IAAAA,gBAAQ,EAACH,MAAM;IACnC,MAAMI,kBAAkB,CAAC;IACzB,MAAMC,eAAe,CAAC;IACtBH,YAAYG,YAAY,GAAGH,YAAYG,YAAY,IAAI,CAAC;IACxDH,YAAYE,eAAe,GAAGF,YAAYE,eAAe,IAAI,CAAC;IAE9D,YAAY;IACZA,eAAe,CAAC,aAAa,GAAGE,mBAAS;IACzCF,eAAe,CAAC,OAAO,GAAGG,qBAAW;IACrCH,eAAe,CAAC,qBAAqB,GAAGI,iCAAuB;IAC/DJ,eAAe,CAAC,s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OAAS,CAAC,CAAC;;IACjChC,YAAAA,QAAAA,OAAO+B,cAAc,CAACC,IAAI,EAACC,4BAA3BjC,MAA2BiC,SAAW;QACpC;QACAT,oBAAoB,gBAAgB,UAAU;KAC/C;IAEDU,IAAAA,oBAAY,EAACb,MAAMrB;AACrB;AAEO,eAAeF,cAAcuB,IAAU,EAAElB,MAA2B,EAAE;IAC3EiB,sBAAsBC;IACtBxB,mBAAmBwB;IACnB,MAAMc,QAAQ,EAAE;IAEhBA,MAAMR,IAAI,CACR,MAAMS,IAAAA,iBAAe,EAACf,MAAM,aACvBlB;QACHkC,YAAY,IAAI;;IAIpBF,MAAMR,IAAI,CAAC1B,2BAA2BoB,MAAMlB;IAC5C,OAAOmC,IAAAA,wBAAgB,KAAIH;AAC7B;MAEA,WAAerC;AACR,MAAMC,gBAAgBwC,IAAAA,0BAAkB,EAACzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/vite/src/generators/init/schema.d.ts"],"sourcesContent":["export interface InitGeneratorSchema {\n uiFramework: 'react' | 'none';\n includeLib?: boolean;\n}\n"],"names":[],"mappings":"AAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cli": "nx",
|
|
3
|
+
"title": "Initialize Vite in the workspace.",
|
|
4
|
+
"description": "Initialize Vite in the workspace.",
|
|
5
|
+
"$id": "init-vite-plugin",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"uiFramework": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "UI Framework to use for Vite.",
|
|
11
|
+
"enum": ["react", "none"],
|
|
12
|
+
"default": "react",
|
|
13
|
+
"x-prompt": "What UI framework plugin should Vite use?"
|
|
14
|
+
},
|
|
15
|
+
"includeLib": {
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"description": "Add dependencies needed to build libraries.",
|
|
18
|
+
"default": false
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"examplesFile": "../../../docs/init-examples.md"
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"types": ["vitest/globals", "vitest/importMeta", "vite/client", "node"]
|
|
6
|
+
},
|
|
7
|
+
"include": [
|
|
8
|
+
"vite.config.ts",
|
|
9
|
+
"src/**/*.test.ts",
|
|
10
|
+
"src/**/*.spec.ts",
|
|
11
|
+
"src/**/*.test.tsx",
|
|
12
|
+
"src/**/*.spec.tsx",
|
|
13
|
+
"src/**/*.test.js",
|
|
14
|
+
"src/**/*.spec.js",
|
|
15
|
+
"src/**/*.test.jsx",
|
|
16
|
+
"src/**/*.spec.jsx",
|
|
17
|
+
"src/**/*.d.ts"
|
|
18
|
+
]
|
|
19
|
+
}
|