@nx/devkit 16.5.2 → 16.5.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/devkit",
3
- "version": "16.5.2",
3
+ "version": "16.5.4",
4
4
  "private": false,
5
5
  "description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more.",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://nx.dev",
30
30
  "dependencies": {
31
- "@nrwl/devkit": "16.5.2",
31
+ "@nrwl/devkit": "16.5.4",
32
32
  "ejs": "^3.1.7",
33
33
  "ignore": "^5.0.4",
34
34
  "semver": "7.5.3",
@@ -45,5 +45,5 @@
45
45
  "migrations": "./migrations.json"
46
46
  },
47
47
  "types": "./index.d.ts",
48
- "gitHead": "928273940d11aa7dea87cb625a92f2c3ec62e726"
48
+ "gitHead": "9b2b8f311f1dfcd3380f57bfa3f07c513424b173"
49
49
  }
@@ -25,10 +25,14 @@ function installPackagesTask(tree, alwaysRun = false, cwd = '', packageManager =
25
25
  if (storedPackageJsonValue != packageJsonValue || alwaysRun) {
26
26
  global['__packageJsonInstallCache__'] = packageJsonValue;
27
27
  const pmc = getPackageManagerCommand(packageManager);
28
- (0, child_process_1.execSync)(pmc.install, {
28
+ const execSyncOptions = {
29
29
  cwd: (0, path_1.join)(tree.root, cwd),
30
30
  stdio: process.env.NX_GENERATE_QUIET === 'true' ? 'ignore' : 'inherit',
31
- });
31
+ };
32
+ if (pmc.preInstall) {
33
+ (0, child_process_1.execSync)(pmc.preInstall, execSyncOptions);
34
+ }
35
+ (0, child_process_1.execSync)(pmc.install, execSyncOptions);
32
36
  }
33
37
  }
34
38
  exports.installPackagesTask = installPackagesTask;
@@ -8,7 +8,8 @@ const install_packages_task_1 = require("../tasks/install-packages-task");
8
8
  const nx_1 = require("../../nx");
9
9
  const tmp_1 = require("tmp");
10
10
  const path_1 = require("path");
11
- const { readJson, updateJson, getPackageManagerCommand, workspaceRoot, detectPackageManager, createTempNpmDirectory, } = (0, nx_1.requireNx)();
11
+ const fs_1 = require("fs");
12
+ const { readJson, updateJson, getPackageManagerCommand, workspaceRoot, detectPackageManager, createTempNpmDirectory, getPackageManagerVersion, } = (0, nx_1.requireNx)();
12
13
  const UNIDENTIFIED_VERSION = 'UNIDENTIFIED_VERSION';
13
14
  const NON_SEMVER_TAGS = {
14
15
  '*': 2,
@@ -268,6 +269,7 @@ function ensurePackage(pkgOrTree, requiredVersionOrPackage, maybeRequiredVersion
268
269
  console.log(`Fetching ${pkg}...`);
269
270
  const packageManager = detectPackageManager();
270
271
  const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
272
+ generatePackageManagerFiles(tempDir, packageManager);
271
273
  const preInstallCommand = getPackageManagerCommand(packageManager).preInstall;
272
274
  if (preInstallCommand) {
273
275
  // ensure package.json and repo in tmp folder is set to a proper package manager state
@@ -306,6 +308,20 @@ function ensurePackage(pkgOrTree, requiredVersionOrPackage, maybeRequiredVersion
306
308
  }
307
309
  }
308
310
  exports.ensurePackage = ensurePackage;
311
+ /**
312
+ * Generates necessary files needed for the package manager to work
313
+ * and for the node_modules to be accessible.
314
+ */
315
+ function generatePackageManagerFiles(root, packageManager = detectPackageManager()) {
316
+ const [pmMajor] = getPackageManagerVersion(packageManager).split('.');
317
+ switch (packageManager) {
318
+ case 'yarn':
319
+ if (+pmMajor >= 2) {
320
+ (0, fs_1.writeFileSync)((0, path_1.join)(root, '.yarnrc.yml'), 'nodeLinker: node-modules\nenableScripts: false');
321
+ }
322
+ break;
323
+ }
324
+ }
309
325
  function addToNodePath(dir) {
310
326
  // NODE_PATH is a delimited list of paths.
311
327
  // The delimiter is different for windows.