@nx/cypress 20.3.2 → 20.3.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/cypress",
3
- "version": "20.3.2",
3
+ "version": "20.3.4",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Cypress contains executors and generators allowing your workspace to use the powerful Cypress integration testing capabilities.",
6
6
  "repository": {
@@ -36,9 +36,9 @@
36
36
  "migrations": "./migrations.json"
37
37
  },
38
38
  "dependencies": {
39
- "@nx/devkit": "20.3.2",
40
- "@nx/eslint": "20.3.2",
41
- "@nx/js": "20.3.2",
39
+ "@nx/devkit": "20.3.4",
40
+ "@nx/eslint": "20.3.4",
41
+ "@nx/js": "20.3.4",
42
42
  "@phenomnomnominal/tsquery": "~5.0.1",
43
43
  "detect-port": "^1.5.1",
44
44
  "tslib": "^2.3.0"
@@ -15,6 +15,7 @@ const cypress_version_1 = require("../../utils/cypress-version");
15
15
  const versions_1 = require("../../utils/versions");
16
16
  const base_setup_1 = require("../base-setup/base-setup");
17
17
  const init_1 = require("../init/init");
18
+ const prompt_1 = require("@nx/devkit/src/generators/prompt");
18
19
  function configurationGenerator(tree, options) {
19
20
  return configurationGeneratorInternal(tree, {
20
21
  addPlugin: false,
@@ -106,6 +107,13 @@ async function normalizeOptions(tree, options) {
106
107
  throw new Error(`Project ${options.project} already has an e2e target.
107
108
  Rename or remove the existing e2e target.`);
108
109
  }
110
+ if (!options.baseUrl &&
111
+ !options.devServerTarget &&
112
+ !projectConfig?.targets?.serve) {
113
+ const { devServerTarget, baseUrl } = await promptForMissingServeData(options.project);
114
+ options.devServerTarget = devServerTarget;
115
+ options.baseUrl = baseUrl;
116
+ }
109
117
  if (!options.baseUrl &&
110
118
  !options.devServerTarget &&
111
119
  !projectConfig?.targets?.serve) {
@@ -131,6 +139,29 @@ In this case you need to provide a devServerTarget,'<projectName>:<targetName>[:
131
139
  devServerTarget,
132
140
  };
133
141
  }
142
+ async function promptForMissingServeData(projectName) {
143
+ const { devServerTarget, port } = await (0, prompt_1.promptWhenInteractive)([
144
+ {
145
+ type: 'input',
146
+ name: 'devServerTarget',
147
+ message: 'What is the name of the target used to serve the application locally?',
148
+ initial: `${projectName}:serve`,
149
+ },
150
+ {
151
+ type: 'numeral',
152
+ name: 'port',
153
+ message: 'What port will the application be served on?',
154
+ initial: 3000,
155
+ },
156
+ ], {
157
+ devServerTarget: `${projectName}:serve`,
158
+ port: 3000,
159
+ });
160
+ return {
161
+ devServerTarget,
162
+ baseUrl: `http://localhost:${port}`,
163
+ };
164
+ }
134
165
  async function addFiles(tree, options, projectGraph, hasPlugin) {
135
166
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
136
167
  const cyVersion = (0, cypress_version_1.installedCypressVersion)();