nx 18.3.0-beta.1 → 18.3.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "18.3.0-beta.1",
3
+ "version": "18.3.0-beta.3",
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": {
@@ -66,7 +66,7 @@
66
66
  "yargs-parser": "21.1.1",
67
67
  "node-machine-id": "1.1.12",
68
68
  "ora": "5.3.0",
69
- "@nrwl/tao": "18.3.0-beta.1"
69
+ "@nrwl/tao": "18.3.0-beta.3"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "@swc-node/register": "^1.8.0",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-x64": "18.3.0-beta.1",
85
- "@nx/nx-darwin-arm64": "18.3.0-beta.1",
86
- "@nx/nx-linux-x64-gnu": "18.3.0-beta.1",
87
- "@nx/nx-linux-x64-musl": "18.3.0-beta.1",
88
- "@nx/nx-win32-x64-msvc": "18.3.0-beta.1",
89
- "@nx/nx-linux-arm64-gnu": "18.3.0-beta.1",
90
- "@nx/nx-linux-arm64-musl": "18.3.0-beta.1",
91
- "@nx/nx-linux-arm-gnueabihf": "18.3.0-beta.1",
92
- "@nx/nx-win32-arm64-msvc": "18.3.0-beta.1",
93
- "@nx/nx-freebsd-x64": "18.3.0-beta.1"
84
+ "@nx/nx-darwin-x64": "18.3.0-beta.3",
85
+ "@nx/nx-darwin-arm64": "18.3.0-beta.3",
86
+ "@nx/nx-linux-x64-gnu": "18.3.0-beta.3",
87
+ "@nx/nx-linux-x64-musl": "18.3.0-beta.3",
88
+ "@nx/nx-win32-x64-msvc": "18.3.0-beta.3",
89
+ "@nx/nx-linux-arm64-gnu": "18.3.0-beta.3",
90
+ "@nx/nx-linux-arm64-musl": "18.3.0-beta.3",
91
+ "@nx/nx-linux-arm-gnueabihf": "18.3.0-beta.3",
92
+ "@nx/nx-win32-arm64-msvc": "18.3.0-beta.3",
93
+ "@nx/nx-freebsd-x64": "18.3.0-beta.3"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -4,7 +4,7 @@ import { Observable } from 'rxjs';
4
4
  import type { GenerateOptions } from '../command-line/generate/generate';
5
5
  import { ProjectConfiguration } from '../config/workspace-json-project-json';
6
6
  import { Tree } from '../generators/tree';
7
- import { ExecutorContext } from '../config/misc-interfaces';
7
+ import { ExecutorContext, GeneratorCallback } from '../config/misc-interfaces';
8
8
  export declare function createBuilderContext(builderInfo: {
9
9
  builderName: string;
10
10
  description: string;
@@ -85,6 +85,6 @@ export declare function mockSchematicsForTesting(schematics: {
85
85
  }): void;
86
86
  export declare function wrapAngularDevkitSchematic(collectionName: string, generatorName: string): (host: Tree, generatorOptions: {
87
87
  [k: string]: any;
88
- }) => Promise<any>;
88
+ }) => Promise<GeneratorCallback>;
89
89
  export declare const getLogger: (isVerbose?: boolean) => logging.Logger;
90
90
  export {};
@@ -655,15 +655,6 @@ function wrapAngularDevkitSchematic(collectionName, generatorName) {
655
655
  mockedSchematics[`${collectionName}:${generatorName}`]) {
656
656
  return await mockedSchematics[`${collectionName}:${generatorName}`](host, generatorOptions);
657
657
  }
658
- const emptyLogger = {
659
- log: (e) => { },
660
- info: (e) => { },
661
- warn: (e) => { },
662
- debug: () => { },
663
- error: (e) => { },
664
- fatal: (e) => { },
665
- };
666
- emptyLogger.createChild = () => emptyLogger;
667
658
  const recorder = (event) => {
668
659
  let eventPath = event.path.startsWith('/')
669
660
  ? event.path.slice(1)
@@ -690,6 +681,7 @@ function wrapAngularDevkitSchematic(collectionName, generatorName) {
690
681
  }
691
682
  };
692
683
  const fsHost = new NxScopeHostUsedForWrappedSchematics(host.root, host);
684
+ const logger = (0, exports.getLogger)(generatorOptions.verbose);
693
685
  const options = {
694
686
  generatorOptions,
695
687
  dryRun: true,
@@ -717,10 +709,18 @@ function wrapAngularDevkitSchematic(collectionName, generatorName) {
717
709
  }
718
710
  const collection = getCollection(workflow, collectionName);
719
711
  const schematic = collection.createSchematic(generatorName, true);
720
- const res = await runSchematic(fsHost, host.root, workflow, emptyLogger, options, schematic, false, recorder);
712
+ const res = await runSchematic(fsHost, host.root, workflow, logger, options, schematic, false, recorder);
721
713
  if (res.status !== 0) {
722
714
  throw new Error(res.loggingQueue.join('\n'));
723
715
  }
716
+ const { lastValueFrom } = require('rxjs');
717
+ const toPromise = (obs) => lastValueFrom ? lastValueFrom(obs) : obs.toPromise();
718
+ return async () => {
719
+ // https://github.com/angular/angular-cli/blob/344193f79d880177e421cff85dd3e94338d07420/packages/angular_devkit/schematics/src/workflow/base.ts#L194-L200
720
+ await toPromise(workflow.engine
721
+ .executePostTasks()
722
+ .pipe((0, operators_1.defaultIfEmpty)(undefined), (0, operators_1.last)()));
723
+ };
724
724
  };
725
725
  }
726
726
  exports.wrapAngularDevkitSchematic = wrapAngularDevkitSchematic;
@@ -63,7 +63,7 @@ async function addNxToMonorepo(options) {
63
63
  (0, utils_1.createNxJsonFile)(repoRoot, targetDefaults, cacheableOperations, scriptOutputs);
64
64
  if (!options.legacy) {
65
65
  packageJsonFiles.forEach((packageJsonPath) => {
66
- (0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, packageJsonPath), cacheableOperations);
66
+ (0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, packageJsonPath));
67
67
  });
68
68
  }
69
69
  (0, utils_1.updateGitIgnore)(repoRoot);
@@ -57,7 +57,7 @@ async function addNxToNpmRepo(options) {
57
57
  (0, utils_1.markRootPackageJsonAsNxProjectLegacy)(repoRoot, cacheableOperations, pmc);
58
58
  }
59
59
  else {
60
- (0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, 'package.json'), cacheableOperations);
60
+ (0, utils_1.markPackageJsonAsNxProject)((0, path_1.join)(repoRoot, 'package.json'));
61
61
  }
62
62
  output_1.output.log({ title: '📦 Installing dependencies' });
63
63
  (0, utils_1.runInstall)(repoRoot, pmc);
@@ -9,7 +9,7 @@ export declare function runInstall(repoRoot: string, pmc?: PackageManagerCommand
9
9
  export declare function initCloud(repoRoot: string, installationSource: 'nx-init-angular' | 'nx-init-cra' | 'nx-init-monorepo' | 'nx-init-nest' | 'nx-init-npm-repo'): void;
10
10
  export declare function addVsCodeRecommendedExtensions(repoRoot: string, extensions: string[]): void;
11
11
  export declare function markRootPackageJsonAsNxProjectLegacy(repoRoot: string, cacheableScripts: string[], pmc: PackageManagerCommands): void;
12
- export declare function markPackageJsonAsNxProject(packageJsonPath: string, cacheableScripts: string[]): void;
12
+ export declare function markPackageJsonAsNxProject(packageJsonPath: string): void;
13
13
  export declare function printFinalMessage({ learnMoreLink, bodyLines, }: {
14
14
  learnMoreLink?: string;
15
15
  bodyLines?: string[];
@@ -154,17 +154,12 @@ function markRootPackageJsonAsNxProjectLegacy(repoRoot, cacheableScripts, pmc) {
154
154
  (0, fileutils_1.writeJsonFile)(`package.json`, json);
155
155
  }
156
156
  exports.markRootPackageJsonAsNxProjectLegacy = markRootPackageJsonAsNxProjectLegacy;
157
- function markPackageJsonAsNxProject(packageJsonPath, cacheableScripts) {
157
+ function markPackageJsonAsNxProject(packageJsonPath) {
158
158
  const json = (0, fileutils_1.readJsonFile)(packageJsonPath);
159
159
  if (!json.scripts) {
160
160
  return;
161
161
  }
162
- json.nx = { includedScripts: [] };
163
- for (let script of cacheableScripts) {
164
- if (json.scripts[script]) {
165
- json.nx.includedScripts.push(script);
166
- }
167
- }
162
+ json.nx = {};
168
163
  (0, fileutils_1.writeJsonFile)(packageJsonPath, json);
169
164
  }
170
165
  exports.markPackageJsonAsNxProject = markPackageJsonAsNxProject;
@@ -17,7 +17,6 @@ const workspace_context_1 = require("../../utils/workspace-context");
17
17
  const connect_to_nx_cloud_1 = require("../connect/connect-to-nx-cloud");
18
18
  const add_nx_to_npm_repo_1 = require("./implementation/add-nx-to-npm-repo");
19
19
  const add_nx_to_monorepo_1 = require("./implementation/add-nx-to-monorepo");
20
- const path_1 = require("path");
21
20
  async function initHandler(options) {
22
21
  process.env.NX_RUNNING_NX_INIT = 'true';
23
22
  const version = process.env.NX_VERSION ?? ((0, semver_1.prerelease)(versions_1.nxVersion) ? 'next' : 'latest');
@@ -52,29 +51,29 @@ async function initHandler(options) {
52
51
  }
53
52
  output_1.output.log({ title: '🧐 Checking dependencies' });
54
53
  const { plugins, updatePackageScripts } = await detectPlugins();
55
- if (!plugins.length) {
56
- // If no plugins are detected/chosen, guide users to setup
57
- // their targetDefaults correctly so their package scripts will work.
58
- const packageJson = (0, fileutils_1.readJsonFile)('package.json');
59
- if ((0, utils_1.isMonorepo)(packageJson)) {
60
- await (0, add_nx_to_monorepo_1.addNxToMonorepo)({ interactive: options.interactive });
61
- }
62
- else {
63
- await (0, add_nx_to_npm_repo_1.addNxToNpmRepo)({ interactive: options.interactive });
64
- }
54
+ const packageJson = (0, fileutils_1.readJsonFile)('package.json');
55
+ if ((0, utils_1.isMonorepo)(packageJson)) {
56
+ await (0, add_nx_to_monorepo_1.addNxToMonorepo)({
57
+ interactive: options.interactive,
58
+ nxCloud: false,
59
+ });
65
60
  }
66
61
  else {
67
- const useNxCloud = options.nxCloud ??
68
- (options.interactive
69
- ? await (0, connect_to_nx_cloud_1.connectExistingRepoToNxCloudPrompt)()
70
- : false);
71
- const repoRoot = process.cwd();
72
- const pmc = (0, package_manager_1.getPackageManagerCommand)();
73
- (0, utils_1.createNxJsonFile)(repoRoot, [], [], {});
74
- (0, utils_1.updateGitIgnore)(repoRoot);
75
- (0, utils_1.addDepsToPackageJson)(repoRoot, plugins);
76
- output_1.output.log({ title: '📦 Installing Nx' });
77
- (0, utils_1.runInstall)(repoRoot, pmc);
62
+ await (0, add_nx_to_npm_repo_1.addNxToNpmRepo)({
63
+ interactive: options.interactive,
64
+ nxCloud: false,
65
+ });
66
+ }
67
+ const useNxCloud = options.nxCloud ??
68
+ (options.interactive ? await (0, connect_to_nx_cloud_1.connectExistingRepoToNxCloudPrompt)() : false);
69
+ const repoRoot = process.cwd();
70
+ const pmc = (0, package_manager_1.getPackageManagerCommand)();
71
+ (0, utils_1.createNxJsonFile)(repoRoot, [], [], {});
72
+ (0, utils_1.updateGitIgnore)(repoRoot);
73
+ (0, utils_1.addDepsToPackageJson)(repoRoot, plugins);
74
+ output_1.output.log({ title: '📦 Installing Nx' });
75
+ (0, utils_1.runInstall)(repoRoot, pmc);
76
+ if (plugins.length > 0) {
78
77
  output_1.output.log({ title: '🔨 Configuring plugins' });
79
78
  for (const plugin of plugins) {
80
79
  (0, child_process_2.execSync)(`${pmc.exec} nx g ${plugin}:init --keepExistingVersions ${updatePackageScripts ? '--updatePackageScripts' : ''} --no-interactive`, {
@@ -82,19 +81,13 @@ async function initHandler(options) {
82
81
  cwd: repoRoot,
83
82
  });
84
83
  }
85
- if (!updatePackageScripts) {
86
- const rootPackageJsonPath = (0, path_1.join)(repoRoot, 'package.json');
87
- const json = (0, fileutils_1.readJsonFile)(rootPackageJsonPath);
88
- json.nx = { includedScripts: [] };
89
- (0, fileutils_1.writeJsonFile)(rootPackageJsonPath, json);
90
- }
91
- if (useNxCloud) {
92
- output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
93
- (0, child_process_2.execSync)(`${pmc.exec} nx g nx:connect-to-nx-cloud --installationSource=nx-init --quiet --hideFormatLogs --no-interactive`, {
94
- stdio: [0, 1, 2],
95
- cwd: repoRoot,
96
- });
97
- }
84
+ }
85
+ if (useNxCloud) {
86
+ output_1.output.log({ title: '🛠️ Setting up Nx Cloud' });
87
+ (0, child_process_2.execSync)(`${pmc.exec} nx g nx:connect-to-nx-cloud --installationSource=nx-init --quiet --hideFormatLogs --no-interactive`, {
88
+ stdio: [0, 1, 2],
89
+ cwd: repoRoot,
90
+ });
98
91
  }
99
92
  output_1.output.log({
100
93
  title: '👀 Explore Your Workspace',
@@ -170,9 +163,8 @@ async function detectPlugins() {
170
163
  {
171
164
  name: 'plugins',
172
165
  type: 'multiselect',
173
- message: `Which plugins would you like to add?`,
166
+ message: `Which plugins would you like to add? Press <Space> to select and <Enter> to submit.`,
174
167
  choices: plugins.map((p) => ({ name: p, value: p })),
175
- initial: plugins.map((_, i) => i), // casting to avoid type error due to bad d.ts file from enquirer
176
168
  },
177
169
  ]).then((r) => r.plugins);
178
170
  if (pluginsToInstall?.length === 0)
@@ -107,7 +107,7 @@ const versionCommand = {
107
107
  })
108
108
  .option('preid', {
109
109
  type: 'string',
110
- describe: 'The optional prerelease identifier to apply to the version, in the case that specifier has been set to prerelease.',
110
+ describe: 'The optional prerelease identifier to apply to the version, in the case that the specifier argument has been set to `prerelease`.',
111
111
  default: '',
112
112
  })
113
113
  .option('stage-changes', {
@@ -212,6 +212,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
212
212
  SOFTWARE.
213
213
 
214
214
 
215
+ core-js
216
+ MIT
217
+ Copyright (c) 2014-2024 Denis Pushkarev
218
+
219
+ Permission is hereby granted, free of charge, to any person obtaining a copy
220
+ of this software and associated documentation files (the "Software"), to deal
221
+ in the Software without restriction, including without limitation the rights
222
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
223
+ copies of the Software, and to permit persons to whom the Software is
224
+ furnished to do so, subject to the following conditions:
225
+
226
+ The above copyright notice and this permission notice shall be included in
227
+ all copies or substantial portions of the Software.
228
+
229
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
230
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
231
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
232
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
233
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
234
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
235
+ THE SOFTWARE.
236
+
237
+
215
238
  cytoscape
216
239
  MIT
217
240
  Copyright (c) 2016-2022, The Cytoscape Consortium.
@@ -681,32 +704,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
681
704
  SOFTWARE.
682
705
 
683
706
 
684
- tabbable
685
- MIT
686
- The MIT License (MIT)
687
-
688
- Copyright (c) 2015 David Clark
689
-
690
- Permission is hereby granted, free of charge, to any person obtaining a copy
691
- of this software and associated documentation files (the "Software"), to deal
692
- in the Software without restriction, including without limitation the rights
693
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
694
- copies of the Software, and to permit persons to whom the Software is
695
- furnished to do so, subject to the following conditions:
696
-
697
- The above copyright notice and this permission notice shall be included in all
698
- copies or substantial portions of the Software.
699
-
700
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
701
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
702
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
703
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
704
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
705
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
706
- SOFTWARE.
707
-
708
-
709
-
710
707
  toggle-selection
711
708
  MIT
712
709