@nx/cypress 20.3.1 → 20.3.3

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2024 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2025 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/cypress",
3
- "version": "20.3.1",
3
+ "version": "20.3.3",
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.1",
40
- "@nx/eslint": "20.3.1",
41
- "@nx/js": "20.3.1",
39
+ "@nx/devkit": "20.3.3",
40
+ "@nx/eslint": "20.3.3",
41
+ "@nx/js": "20.3.3",
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)();
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = addE2eCiTargetDefaults;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
6
- const internal_api_1 = require("nx/src/project-graph/plugins/internal-api");
6
+ const loaded_nx_plugin_1 = require("nx/src/project-graph/plugins/loaded-nx-plugin");
7
7
  const devkit_internals_1 = require("nx/src/devkit-internals");
8
8
  const tsquery_1 = require("@phenomnomnominal/tsquery");
9
9
  const path_1 = require("path");
@@ -19,7 +19,7 @@ async function addE2eCiTargetDefaults(tree) {
19
19
  for (const plugin of matchingPluginRegistrations) {
20
20
  let projectConfigs;
21
21
  try {
22
- const loadedPlugin = new internal_api_1.LoadedNxPlugin({ createNodesV2, name: pluginName }, plugin);
22
+ const loadedPlugin = new loaded_nx_plugin_1.LoadedNxPlugin({ createNodesV2, name: pluginName }, plugin);
23
23
  projectConfigs = await (0, devkit_internals_1.retrieveProjectConfigurations)([loadedPlugin], tree.root, nxJson);
24
24
  }
25
25
  catch (e) {