@nx/workspace 20.2.0-beta.5 → 20.2.0-beta.7

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/workspace",
3
- "version": "20.2.0-beta.5",
3
+ "version": "20.2.0-beta.7",
4
4
  "private": false,
5
5
  "description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
6
6
  "repository": {
@@ -38,12 +38,12 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@nx/devkit": "20.2.0-beta.5",
41
+ "@nx/devkit": "20.2.0-beta.7",
42
42
  "chalk": "^4.1.0",
43
43
  "enquirer": "~2.3.6",
44
44
  "tslib": "^2.3.0",
45
45
  "yargs-parser": "21.1.1",
46
- "nx": "20.2.0-beta.5"
46
+ "nx": "20.2.0-beta.7"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
@@ -9,6 +9,7 @@ const get_npm_package_version_1 = require("../utils/get-npm-package-version");
9
9
  const path_1 = require("path");
10
10
  const yargsParser = require("yargs-parser");
11
11
  const child_process_1 = require("child_process");
12
+ const installation_directory_1 = require("nx/src/utils/installation-directory");
12
13
  function addPresetDependencies(host, options) {
13
14
  const { dependencies, dev } = getPresetDependencies(options);
14
15
  return (0, devkit_1.addDependenciesToPackageJson)(host, dependencies, dev, (0, path_1.join)(options.directory, 'package.json'));
@@ -20,17 +21,22 @@ function generatePreset(host, opts) {
20
21
  interactive: true,
21
22
  },
22
23
  });
23
- const spawnOptions = {
24
+ const newWorkspaceRoot = (0, path_1.join)(host.root, opts.directory);
25
+ const forkOptions = {
24
26
  stdio: 'inherit',
25
- shell: true,
26
- cwd: (0, path_1.join)(host.root, opts.directory),
27
- windowsHide: false,
27
+ cwd: newWorkspaceRoot,
28
28
  };
29
29
  const pmc = (0, devkit_1.getPackageManagerCommand)();
30
- const executable = `${pmc.exec} nx`;
30
+ const nxInstallationPaths = (0, installation_directory_1.getNxRequirePaths)(newWorkspaceRoot);
31
+ const nxBinForNewWorkspaceRoot = require.resolve('nx/bin/nx', {
32
+ paths: nxInstallationPaths,
33
+ });
31
34
  const args = getPresetArgs(opts);
32
35
  return new Promise((resolve, reject) => {
33
- (0, child_process_1.spawn)(executable, args, spawnOptions).on('close', (code) => {
36
+ // This needs to be `fork` instead of `spawn` because `spawn` is failing on Windows with pnpm + yarn
37
+ // The root cause is unclear. Spawn causes the `@nx/workspace:preset` generator to be called twice
38
+ // and the second time it fails with `Project {projectName} already exists.`
39
+ (0, child_process_1.fork)(nxBinForNewWorkspaceRoot, args, forkOptions).on('close', (code) => {
34
40
  if (code === 0) {
35
41
  resolve();
36
42
  }