nx 16.8.0-beta.0 → 16.8.0-beta.2

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/bin/nx.js CHANGED
@@ -85,7 +85,7 @@ function main() {
85
85
  * - .env.local
86
86
  */
87
87
  function loadDotEnvFiles() {
88
- for (const file of ['.env', '.local.env', '.env.local']) {
88
+ for (const file of ['.local.env', '.env.local', '.env']) {
89
89
  (0, dotenv_1.config)({
90
90
  path: file,
91
91
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "16.8.0-beta.0",
3
+ "version": "16.8.0-beta.2",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://nx.dev",
34
34
  "dependencies": {
35
- "@nrwl/tao": "16.8.0-beta.0",
35
+ "@nrwl/tao": "16.8.0-beta.2",
36
36
  "@parcel/watcher": "2.0.4",
37
37
  "@yarnpkg/lockfile": "^1.1.0",
38
38
  "@yarnpkg/parsers": "3.0.0-rc.46",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-arm64": "16.8.0-beta.0",
85
- "@nx/nx-darwin-x64": "16.8.0-beta.0",
86
- "@nx/nx-freebsd-x64": "16.8.0-beta.0",
87
- "@nx/nx-linux-arm-gnueabihf": "16.8.0-beta.0",
88
- "@nx/nx-linux-arm64-gnu": "16.8.0-beta.0",
89
- "@nx/nx-linux-arm64-musl": "16.8.0-beta.0",
90
- "@nx/nx-linux-x64-gnu": "16.8.0-beta.0",
91
- "@nx/nx-linux-x64-musl": "16.8.0-beta.0",
92
- "@nx/nx-win32-arm64-msvc": "16.8.0-beta.0",
93
- "@nx/nx-win32-x64-msvc": "16.8.0-beta.0"
84
+ "@nx/nx-darwin-arm64": "16.8.0-beta.2",
85
+ "@nx/nx-darwin-x64": "16.8.0-beta.2",
86
+ "@nx/nx-freebsd-x64": "16.8.0-beta.2",
87
+ "@nx/nx-linux-arm-gnueabihf": "16.8.0-beta.2",
88
+ "@nx/nx-linux-arm64-gnu": "16.8.0-beta.2",
89
+ "@nx/nx-linux-arm64-musl": "16.8.0-beta.2",
90
+ "@nx/nx-linux-x64-gnu": "16.8.0-beta.2",
91
+ "@nx/nx-linux-x64-musl": "16.8.0-beta.2",
92
+ "@nx/nx-win32-arm64-msvc": "16.8.0-beta.2",
93
+ "@nx/nx-win32-x64-msvc": "16.8.0-beta.2"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -177,5 +177,5 @@
177
177
  },
178
178
  "main": "./bin/nx.js",
179
179
  "type": "commonjs",
180
- "gitHead": "818352404283c1d34ab303d91b3bd16474f54916"
180
+ "gitHead": "9bcc04742f9e1516d8c1ddbfb1907770c347876f"
181
181
  }
@@ -33,10 +33,6 @@ exports.examples = {
33
33
  command: 'affected -t test --parallel=5',
34
34
  description: 'Run tests in parallel',
35
35
  },
36
- {
37
- command: 'affected -t test --all',
38
- description: 'Run the test target for all projects',
39
- },
40
36
  {
41
37
  command: 'affected -t lint test build',
42
38
  description: 'Run lint, test, and build targets for affected projects. Requires Nx v15.4+',
@@ -67,10 +63,6 @@ exports.examples = {
67
63
  command: 'affected:test --parallel=5',
68
64
  description: 'Run tests in parallel',
69
65
  },
70
- {
71
- command: 'affected:test --all',
72
- description: 'Run the test target for all projects',
73
- },
74
66
  {
75
67
  command: 'affected:test --files=libs/mylib/src/index.ts',
76
68
  description: 'Run tests for all the projects affected by changing the index.ts file',
@@ -89,10 +81,6 @@ exports.examples = {
89
81
  command: 'affected:build --parallel=5',
90
82
  description: 'Run build in parallel',
91
83
  },
92
- {
93
- command: 'affected:build --all',
94
- description: 'Run the build target for all projects',
95
- },
96
84
  {
97
85
  command: 'affected:build --files=libs/mylib/src/index.ts',
98
86
  description: 'Run build for all the projects affected by changing the index.ts file',
@@ -111,10 +99,6 @@ exports.examples = {
111
99
  command: 'affected:e2e --parallel=5',
112
100
  description: 'Run tests in parallel',
113
101
  },
114
- {
115
- command: 'affected:e2e --all',
116
- description: 'Run the test target for all projects',
117
- },
118
102
  {
119
103
  command: 'affected:e2e --files=libs/mylib/src/index.ts',
120
104
  description: 'Run tests for all the projects affected by changing the index.ts file',
@@ -133,10 +117,6 @@ exports.examples = {
133
117
  command: 'affected:lint --parallel=5',
134
118
  description: 'Run lint in parallel',
135
119
  },
136
- {
137
- command: 'affected:lint --all',
138
- description: 'Run the lint target for all projects',
139
- },
140
120
  {
141
121
  command: 'affected:lint --files=libs/mylib/src/index.ts',
142
122
  description: 'Run lint for all the projects affected by changing the index.ts file',
@@ -257,7 +237,7 @@ exports.examples = {
257
237
  description: 'Test all projects with a `type:feature` or `type:ui` tag',
258
238
  },
259
239
  {
260
- command: 'run-many --targets=lint,test,build --all',
240
+ command: 'run-many --targets=lint,test,build',
261
241
  description: 'Run lint, test, and build targets for all projects. Requires Nx v15.4+',
262
242
  },
263
243
  ],
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const child_process_1 = require("child_process");
6
6
  const path = require("path");
7
7
  const command_line_utils_1 = require("../../utils/command-line-utils");
8
+ const ignore_1 = require("../../utils/ignore");
8
9
  const fileutils_1 = require("../../utils/fileutils");
9
10
  const file_utils_1 = require("../../project-graph/file-utils");
10
11
  const prettier = require("prettier");
@@ -16,7 +17,6 @@ const affected_project_graph_1 = require("../../project-graph/affected/affected-
16
17
  const configuration_1 = require("../../config/configuration");
17
18
  const chunkify_1 = require("../../utils/chunkify");
18
19
  const all_file_data_1 = require("../../utils/all-file-data");
19
- const semver_1 = require("semver");
20
20
  const PRETTIER_PATH = getPrettierPath();
21
21
  function format(command, args) {
22
22
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -64,9 +64,11 @@ function getPatterns(args) {
64
64
  // which allows it to be considered for calculating "patterns"
65
65
  .concat('.swcrc');
66
66
  const patterns = p.files.filter((f) => (0, fileutils_1.fileExists)(f) && supportedExtensions.includes(path.extname(f)));
67
+ // exclude patterns in .nxignore or .gitignore
68
+ const nonIgnoredPatterns = (0, ignore_1.getIgnoreObject)().filter(patterns);
67
69
  return args.libsAndApps
68
- ? yield getPatternsFromApps(patterns, yield (0, all_file_data_1.allFileData)(), graph)
69
- : patterns;
70
+ ? yield getPatternsFromApps(nonIgnoredPatterns, yield (0, all_file_data_1.allFileData)(), graph)
71
+ : nonIgnoredPatterns;
70
72
  }
71
73
  catch (_a) {
72
74
  return allFilesPattern;
@@ -146,9 +148,6 @@ function sortTsConfig() {
146
148
  }
147
149
  }
148
150
  function getPrettierPath() {
149
- const prettierVersion = (0, package_json_1.readModulePackageJson)('prettier').packageJson.version;
150
- if ((0, semver_1.gte)(prettierVersion, '3.0.0')) {
151
- return require.resolve('prettier/bin/prettier.cjs');
152
- }
153
- return require.resolve('prettier/bin-prettier');
151
+ const { bin } = (0, package_json_1.readModulePackageJson)('prettier').packageJson;
152
+ return require.resolve(path.join('prettier', bin));
154
153
  }
@@ -148,7 +148,8 @@ function projectHasKarmaConfig(project) {
148
148
  return (0, fileutils_1.fileExists)((0, path_1.join)(project.root, 'karma.conf.js'));
149
149
  }
150
150
  function projectHasEslintConfig(project) {
151
- return (0, fileutils_1.fileExists)((0, path_1.join)(project.root, '.eslintrc.json'));
151
+ return ((0, fileutils_1.fileExists)((0, path_1.join)(project.root, '.eslintrc.json')) ||
152
+ (0, fileutils_1.fileExists)((0, path_1.join)(project.root, 'eslint.config.js')));
152
153
  }
153
154
  function replaceNgWithNxInPackageJsonScripts(repoRoot) {
154
155
  var _a;
@@ -147,7 +147,7 @@ function withRunManyOptions(yargs) {
147
147
  describe: 'Projects to run. (comma/space delimited project names and/or patterns)',
148
148
  })
149
149
  .option('all', {
150
- describe: '[deprecated] Run the target on all projects in the workspace',
150
+ describe: '[deprecated] `run-many` runs all targets on all projects in the workspace if no projects are provided. This option is no longer required.',
151
151
  type: 'boolean',
152
152
  default: true,
153
153
  });
@@ -34,7 +34,9 @@ function formatChangedFilesWithPrettierIfAvailable(tree) {
34
34
  if (support.ignored || !support.inferredParser) {
35
35
  return;
36
36
  }
37
- tree.write(file.path, prettier.format(file.content.toString('utf-8'), options));
37
+ tree.write(file.path,
38
+ // In prettier v3 the format result is a promise
39
+ yield prettier.format(file.content.toString('utf-8'), options));
38
40
  }
39
41
  catch (e) {
40
42
  console.warn(`Could not format ${file.path}. Error: "${e.message}"`);
@@ -167,7 +167,7 @@ function findCreatedProjectFiles(tree, globPatterns) {
167
167
  for (const change of tree.listChanges()) {
168
168
  if (change.type === 'CREATE') {
169
169
  const fileName = (0, path_1.basename)(change.path);
170
- if (globPatterns.some((pattern) => minimatch(change.path, pattern))) {
170
+ if (globPatterns.some((pattern) => minimatch(change.path, pattern, { dot: true }))) {
171
171
  createdProjectFiles.push(change.path);
172
172
  }
173
173
  else if (fileName === 'package.json') {
@@ -222,7 +222,7 @@ class TaskHasherImpl {
222
222
  const { getFilesForOutputs } = require('../native');
223
223
  const outputFiles = getFilesForOutputs(workspace_root_1.workspaceRoot, outputs);
224
224
  const filteredFiles = outputFiles.filter((p) => p === dependentTasksOutputFiles ||
225
- minimatch(p, dependentTasksOutputFiles));
225
+ minimatch(p, dependentTasksOutputFiles, { dot: true }));
226
226
  const hashDetails = {};
227
227
  const hashes = [];
228
228
  for (const [file, hash] of yield this.fileHasher.hashFiles(filteredFiles.map((p) => (0, path_1.join)(workspace_root_1.workspaceRoot, p)))) {
@@ -9,7 +9,7 @@ const retrieve_workspace_files_1 = require("../../project-graph/utils/retrieve-w
9
9
  function default_1(tree) {
10
10
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
11
  const nxJson = (0, nx_json_1.readNxJson)(tree);
12
- const projectFiles = (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(tree.root, nxJson);
12
+ const projectFiles = yield (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(tree.root, nxJson);
13
13
  const projectJsons = projectFiles.filter((f) => f.endsWith('project.json'));
14
14
  for (let f of projectJsons) {
15
15
  const projectJson = (0, json_1.readJson)(tree, f);
@@ -23,16 +23,12 @@ const processProjectGraph = (graph, context) => tslib_1.__awaiter(void 0, void 0
23
23
  let parsedLockFile;
24
24
  if (lockFileNeedsReprocessing(lockHash)) {
25
25
  parsedLockFile = (0, lock_file_1.parseLockFile)();
26
- if (parsedLockFile) {
27
- writeLastProcessedLockfileHash(lockHash, parsedLockFile);
28
- }
26
+ writeLastProcessedLockfileHash(lockHash, parsedLockFile);
29
27
  }
30
28
  else {
31
29
  parsedLockFile = readParsedLockFile();
32
30
  }
33
- if (parsedLockFile) {
34
- builder.mergeProjectGraph(parsedLockFile);
35
- }
31
+ builder.mergeProjectGraph(parsedLockFile);
36
32
  }
37
33
  }
38
34
  perf_hooks_1.performance.mark('build typescript dependencies - start');
@@ -287,8 +287,7 @@ function mapSnapshots(dependencies, nodes, packageJson, isBerry) {
287
287
  if (isBerry && key.includes('@patch:') && key.includes('#')) {
288
288
  normalizedKey = key
289
289
  .slice(0, key.indexOf('#'))
290
- .replace(`@patch:${packageName}@`, '@npm:')
291
- .replace(/:.*$/u, ':' + snapshotKey.version);
290
+ .replace(`@patch:${packageName}@`, '@npm:');
292
291
  }
293
292
  if (!existingKeys.get(packageName) ||
294
293
  !existingKeys.get(packageName).has(normalizedKey)) {
@@ -366,6 +365,10 @@ function findPatchedKeys(dependencies, node) {
366
365
  if (!keys[0].startsWith(`${node.data.packageName}@patch:`)) {
367
366
  continue;
368
367
  }
368
+ // local patches are currently not supported
369
+ if (keys[0].includes('.yarn/patches')) {
370
+ continue;
371
+ }
369
372
  if (snapshot.version === node.data.version) {
370
373
  return [keys, snapshot];
371
374
  }
@@ -14,7 +14,9 @@ const getTouchedProjectsFromProjectGlobChanges = (touchedFiles, projectGraphNode
14
14
  const globPattern = (0, globs_1.combineGlobPatterns)((0, retrieve_workspace_files_1.configurationGlobs)(workspace_root_1.workspaceRoot, yield (0, nx_plugin_1.loadNxPlugins)(nxJson === null || nxJson === void 0 ? void 0 : nxJson.plugins, (0, installation_directory_1.getNxRequirePaths)(workspace_root_1.workspaceRoot), workspace_root_1.workspaceRoot)));
15
15
  const touchedProjects = new Set();
16
16
  for (const touchedFile of touchedFiles) {
17
- const isProjectFile = minimatch(touchedFile.file, globPattern);
17
+ const isProjectFile = minimatch(touchedFile.file, globPattern, {
18
+ dot: true,
19
+ });
18
20
  if (isProjectFile) {
19
21
  // If the file no longer exists on disk, then it was deleted
20
22
  if (!(0, fs_1.existsSync)((0, path_1.join)(workspace_root_1.workspaceRoot, touchedFile.file))) {
@@ -34,7 +34,7 @@ const getImplicitlyTouchedProjects = (fileChanges, projectGraphNodes, nxJson) =>
34
34
  });
35
35
  const touched = new Set();
36
36
  for (const [pattern, projects] of Object.entries(implicits)) {
37
- const implicitDependencyWasChanged = fileChanges.some((f) => minimatch(f.file, pattern));
37
+ const implicitDependencyWasChanged = fileChanges.some((f) => minimatch(f.file, pattern, { dot: true }));
38
38
  if (!implicitDependencyWasChanged) {
39
39
  continue;
40
40
  }
@@ -61,7 +61,7 @@ plugins, root = workspace_root_1.workspaceRoot) {
61
61
  continue;
62
62
  }
63
63
  for (const file of projectFiles) {
64
- if (minimatch(file, pattern)) {
64
+ if (minimatch(file, pattern, { dot: true })) {
65
65
  const { projects: projectNodes, externalNodes: pluginExternalNodes } = configurationConstructor(file, {
66
66
  nxJsonConfiguration: nxJson,
67
67
  workspaceRoot: root,
@@ -35,7 +35,7 @@ export declare function retrieveProjectConfigurationsSync(workspaceRoot: string,
35
35
  externalNodes: Record<string, ProjectGraphExternalNode>;
36
36
  projectNodes: Record<string, ProjectConfiguration>;
37
37
  };
38
- export declare function retrieveProjectConfigurationPaths(root: string, nxJson: NxJsonConfiguration): string[];
38
+ export declare function retrieveProjectConfigurationPaths(root: string, nxJson: NxJsonConfiguration): Promise<string[]>;
39
39
  export declare function retrieveProjectConfigurationPathsWithoutPluginInference(root: string): string[];
40
40
  export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Record<string, ProjectConfiguration>;
41
41
  export declare function configurationGlobs(workspaceRoot: string, plugins: NxPluginV2[]): string[];
@@ -6,7 +6,6 @@ const perf_hooks_1 = require("perf_hooks");
6
6
  const installation_directory_1 = require("../../utils/installation-directory");
7
7
  const angular_json_1 = require("../../adapter/angular-json");
8
8
  const nx_json_1 = require("../../config/nx-json");
9
- const native_1 = require("../../native");
10
9
  const package_json_workspaces_1 = require("../../../plugins/package-json-workspaces");
11
10
  const project_configuration_utils_1 = require("./project-configuration-utils");
12
11
  const nx_plugin_1 = require("../../utils/nx-plugin");
@@ -97,13 +96,16 @@ function _retrieveProjectConfigurations(workspaceRoot, nxJson, plugins, globs) {
97
96
  }
98
97
  function retrieveProjectConfigurationPaths(root, nxJson) {
99
98
  var _a;
100
- const projectGlobPatterns = configurationGlobs(root, (0, nx_plugin_1.loadNxPluginsSync)((_a = nxJson === null || nxJson === void 0 ? void 0 : nxJson.plugins) !== null && _a !== void 0 ? _a : [], (0, installation_directory_1.getNxRequirePaths)(root), root));
101
- const { getProjectConfigurationFiles } = require('../../native');
102
- return getProjectConfigurationFiles(root, projectGlobPatterns);
99
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
100
+ const projectGlobPatterns = configurationGlobs(root, yield (0, nx_plugin_1.loadNxPlugins)((_a = nxJson === null || nxJson === void 0 ? void 0 : nxJson.plugins) !== null && _a !== void 0 ? _a : [], (0, installation_directory_1.getNxRequirePaths)(root), root));
101
+ const { getProjectConfigurationFiles } = require('../../native');
102
+ return getProjectConfigurationFiles(root, projectGlobPatterns);
103
+ });
103
104
  }
104
105
  exports.retrieveProjectConfigurationPaths = retrieveProjectConfigurationPaths;
105
106
  function retrieveProjectConfigurationPathsWithoutPluginInference(root) {
106
- return (0, native_1.getProjectConfigurationFiles)(root, configurationGlobsWithoutPlugins(root));
107
+ const { getProjectConfigurationFiles } = require('../../native');
108
+ return getProjectConfigurationFiles(root, configurationGlobsWithoutPlugins(root));
107
109
  }
108
110
  exports.retrieveProjectConfigurationPathsWithoutPluginInference = retrieveProjectConfigurationPathsWithoutPluginInference;
109
111
  const projectsWithoutPluginCache = new Map();
@@ -310,9 +310,9 @@ class ForkedProcessTaskRunner {
310
310
  `.env.${task.target.target}`,
311
311
  `.${task.target.target}.env`,
312
312
  // Load base DotEnv Files at workspace root
313
- `.env`,
314
313
  `.local.env`,
315
314
  `.env.local`,
315
+ `.env`,
316
316
  ];
317
317
  for (const file of dotEnvFiles) {
318
318
  (0, dotenv_1.config)({
@@ -161,7 +161,7 @@ exports.getMatchingStringsWithCache = (() => {
161
161
  }
162
162
  const patternCache = minimatchCache.get(pattern);
163
163
  if (!regexCache.has(pattern)) {
164
- const regex = minimatch.makeRe(pattern);
164
+ const regex = minimatch.makeRe(pattern, { dot: true });
165
165
  if (regex) {
166
166
  regexCache.set(pattern, regex);
167
167
  }
@@ -49,7 +49,7 @@ export interface PackageJson {
49
49
  }>;
50
50
  resolutions?: Record<string, string>;
51
51
  overrides?: PackageOverride;
52
- bin?: Record<string, string>;
52
+ bin?: Record<string, string> | string;
53
53
  workspaces?: string[] | {
54
54
  packages: string[];
55
55
  };