@nx/vue 19.5.7 → 19.6.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/package.json +6 -6
- package/src/generators/application/application.js +1 -1
- package/src/generators/application/files/nx-welcome/claimed/src/app/NxWelcome.vue.template +791 -0
- package/src/generators/application/files/{common → nx-welcome/not-configured}/src/app/NxWelcome.vue.template +52 -90
- package/src/generators/application/files/nx-welcome/unclaimed/src/app/NxWelcome.vue.template +792 -0
- package/src/generators/application/lib/add-e2e.js +57 -9
- package/src/generators/application/lib/create-application-files.d.ts +1 -1
- package/src/generators/application/lib/create-application-files.js +11 -1
- package/src/generators/application/schema.d.ts +1 -0
|
@@ -4,13 +4,25 @@ exports.addE2e = addE2e;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const web_1 = require("@nx/web");
|
|
6
6
|
const versions_1 = require("../../../utils/versions");
|
|
7
|
+
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
8
|
+
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
7
9
|
async function addE2e(tree, options) {
|
|
10
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
11
|
+
const hasPlugin = nxJson.plugins?.find((p) => typeof p === 'string'
|
|
12
|
+
? p === '@nx/vite/plugin'
|
|
13
|
+
: p.plugin === '@nx/vite/plugin');
|
|
14
|
+
const e2eWebServerTarget = hasPlugin
|
|
15
|
+
? typeof hasPlugin === 'string'
|
|
16
|
+
? 'serve'
|
|
17
|
+
: hasPlugin.options?.serveTargetName ?? 'serve'
|
|
18
|
+
: 'serve';
|
|
19
|
+
const e2eCiWebServerTarget = hasPlugin
|
|
20
|
+
? typeof hasPlugin === 'string'
|
|
21
|
+
? 'preview'
|
|
22
|
+
: hasPlugin.options?.previewTargetName ?? 'preview'
|
|
23
|
+
: 'preview';
|
|
8
24
|
switch (options.e2eTestRunner) {
|
|
9
25
|
case 'cypress': {
|
|
10
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
11
|
-
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
12
|
-
? p === '@nx/vite/plugin'
|
|
13
|
-
: p.plugin === '@nx/vite/plugin');
|
|
14
26
|
if (!hasPlugin) {
|
|
15
27
|
await (0, web_1.webStaticServeGenerator)(tree, {
|
|
16
28
|
buildTarget: `${options.projectName}:build`,
|
|
@@ -27,16 +39,38 @@ async function addE2e(tree, options) {
|
|
|
27
39
|
tags: [],
|
|
28
40
|
implicitDependencies: [options.projectName],
|
|
29
41
|
});
|
|
30
|
-
|
|
42
|
+
const e2eTask = await configurationGenerator(tree, {
|
|
31
43
|
...options,
|
|
32
44
|
project: options.e2eProjectName,
|
|
33
45
|
directory: 'src',
|
|
34
46
|
bundler: 'vite',
|
|
35
47
|
skipFormat: true,
|
|
36
|
-
devServerTarget: `${options.projectName}
|
|
48
|
+
devServerTarget: `${options.projectName}:${e2eWebServerTarget}`,
|
|
37
49
|
baseUrl: 'http://localhost:4200',
|
|
38
50
|
jsx: true,
|
|
51
|
+
webServerCommands: hasPlugin
|
|
52
|
+
? {
|
|
53
|
+
default: `nx run ${options.projectName}:${e2eWebServerTarget}`,
|
|
54
|
+
production: `nx run ${options.projectName}:preview`,
|
|
55
|
+
}
|
|
56
|
+
: undefined,
|
|
57
|
+
ciWebServerCommand: `nx run ${options.projectName}:${e2eCiWebServerTarget}`,
|
|
58
|
+
ciBaseUrl: 'http://localhost:4300',
|
|
39
59
|
});
|
|
60
|
+
if (options.addPlugin ||
|
|
61
|
+
(0, devkit_1.readNxJson)(tree).plugins?.find((p) => typeof p === 'string'
|
|
62
|
+
? p === '@nx/cypress/plugin'
|
|
63
|
+
: p.plugin === '@nx/cypress/plugin')) {
|
|
64
|
+
let buildTarget = '^build';
|
|
65
|
+
if (hasPlugin) {
|
|
66
|
+
const matchingPlugin = await (0, find_plugin_for_config_file_1.findPluginForConfigFile)(tree, `@nx/vite/plugin`, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.${options.js ? 'js' : 'ts'}`));
|
|
67
|
+
if (matchingPlugin && typeof matchingPlugin !== 'string') {
|
|
68
|
+
buildTarget = `^${matchingPlugin.options?.buildTargetName ?? 'build'}`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
await (0, target_defaults_utils_1.addE2eCiTargetDefaults)(tree, '@nx/cypress/plugin', buildTarget, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, `cypress.config.${options.js ? 'js' : 'ts'}`));
|
|
72
|
+
}
|
|
73
|
+
return e2eTask;
|
|
40
74
|
}
|
|
41
75
|
case 'playwright': {
|
|
42
76
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
@@ -47,7 +81,7 @@ async function addE2e(tree, options) {
|
|
|
47
81
|
targets: {},
|
|
48
82
|
implicitDependencies: [options.projectName],
|
|
49
83
|
});
|
|
50
|
-
|
|
84
|
+
const e2eTask = await configurationGenerator(tree, {
|
|
51
85
|
...options,
|
|
52
86
|
project: options.e2eProjectName,
|
|
53
87
|
skipFormat: true,
|
|
@@ -56,9 +90,23 @@ async function addE2e(tree, options) {
|
|
|
56
90
|
js: false,
|
|
57
91
|
linter: options.linter,
|
|
58
92
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
59
|
-
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx
|
|
60
|
-
webServerAddress: 'http://localhost:
|
|
93
|
+
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx run ${options.projectName}:${e2eCiWebServerTarget}`,
|
|
94
|
+
webServerAddress: 'http://localhost:4300',
|
|
61
95
|
});
|
|
96
|
+
if (options.addPlugin ||
|
|
97
|
+
(0, devkit_1.readNxJson)(tree).plugins?.find((p) => typeof p === 'string'
|
|
98
|
+
? p === '@nx/playwright/plugin'
|
|
99
|
+
: p.plugin === '@nx/playwright/plugin')) {
|
|
100
|
+
let buildTarget = '^build';
|
|
101
|
+
if (hasPlugin) {
|
|
102
|
+
const matchingPlugin = await (0, find_plugin_for_config_file_1.findPluginForConfigFile)(tree, `@nx/vite/plugin`, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.${options.js ? 'js' : 'ts'}`));
|
|
103
|
+
if (matchingPlugin && typeof matchingPlugin !== 'string') {
|
|
104
|
+
buildTarget = `^${matchingPlugin.options?.buildTargetName ?? 'build'}`;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
await (0, target_defaults_utils_1.addE2eCiTargetDefaults)(tree, '@nx/playwright/plugin', buildTarget, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, `playwright.config.ts`));
|
|
108
|
+
}
|
|
109
|
+
return e2eTask;
|
|
62
110
|
}
|
|
63
111
|
case 'none':
|
|
64
112
|
default:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { NormalizedSchema } from '../schema';
|
|
3
|
-
export declare function createApplicationFiles(tree: Tree, options: NormalizedSchema): void
|
|
3
|
+
export declare function createApplicationFiles(tree: Tree, options: NormalizedSchema): Promise<void>;
|
|
@@ -5,12 +5,22 @@ const path = require("path");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
7
|
const create_ts_config_1 = require("../../../utils/create-ts-config");
|
|
8
|
-
|
|
8
|
+
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
9
|
+
async function createApplicationFiles(tree, options) {
|
|
10
|
+
const onBoardingStatus = await (0, onboarding_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
|
|
11
|
+
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
12
|
+
(await (0, onboarding_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
9
13
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, '../files/common'), options.appProjectRoot, {
|
|
10
14
|
...options,
|
|
11
15
|
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
|
|
12
16
|
title: options.projectName,
|
|
13
17
|
});
|
|
18
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, '../files/nx-welcome', onBoardingStatus), options.appProjectRoot, {
|
|
19
|
+
...options,
|
|
20
|
+
connectCloudUrl,
|
|
21
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
|
|
22
|
+
title: options.projectName,
|
|
23
|
+
});
|
|
14
24
|
if (options.style !== 'none') {
|
|
15
25
|
(0, devkit_1.generateFiles)(tree, path.join(__dirname, '../files/stylesheet'), options.appProjectRoot, {
|
|
16
26
|
...options,
|