@nx/angular 18.3.0-canary.20240410-7a7cbec → 18.3.0-canary.20240412-d1584f8

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "18.3.0-canary.20240410-7a7cbec",
3
+ "version": "18.3.0-canary.20240412-d1584f8",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -78,14 +78,14 @@
78
78
  "tslib": "^2.3.0",
79
79
  "webpack": "^5.80.0",
80
80
  "webpack-merge": "^5.8.0",
81
- "@nx/devkit": "18.3.0-canary.20240410-7a7cbec",
82
- "@nx/js": "18.3.0-canary.20240410-7a7cbec",
83
- "@nx/eslint": "18.3.0-canary.20240410-7a7cbec",
84
- "@nx/webpack": "18.3.0-canary.20240410-7a7cbec",
85
- "@nx/web": "18.3.0-canary.20240410-7a7cbec",
86
- "@nx/workspace": "18.3.0-canary.20240410-7a7cbec",
81
+ "@nx/devkit": "18.3.0-canary.20240412-d1584f8",
82
+ "@nx/js": "18.3.0-canary.20240412-d1584f8",
83
+ "@nx/eslint": "18.3.0-canary.20240412-d1584f8",
84
+ "@nx/webpack": "18.3.0-canary.20240412-d1584f8",
85
+ "@nx/web": "18.3.0-canary.20240412-d1584f8",
86
+ "@nx/workspace": "18.3.0-canary.20240412-d1584f8",
87
87
  "piscina": "^4.4.0",
88
- "@nrwl/angular": "18.3.0-canary.20240410-7a7cbec"
88
+ "@nrwl/angular": "18.3.0-canary.20240412-d1584f8"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
@@ -23,6 +23,7 @@ async function addLintingGenerator(tree, options) {
23
23
  rootProject: rootProject,
24
24
  addPlugin: false,
25
25
  addExplicitTargets: true,
26
+ skipPackageJson: options.skipPackageJson,
26
27
  });
27
28
  tasks.push(lintTask);
28
29
  if ((0, eslint_file_1.isEslintConfigSupported)(tree)) {
@@ -29,7 +29,9 @@ async function applicationGeneratorInternal(tree, schema) {
29
29
  ...options,
30
30
  skipFormat: true,
31
31
  });
32
- (0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree);
32
+ if (!options.skipPackageJson) {
33
+ (0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree);
34
+ }
33
35
  (0, lib_1.createProject)(tree, options);
34
36
  await (0, lib_1.createFiles)(tree, options, rootOffset);
35
37
  if (options.addTailwind) {
@@ -62,6 +64,7 @@ async function applicationGeneratorInternal(tree, schema) {
62
64
  await (0, setup_ssr_1.setupSsr)(tree, {
63
65
  project: options.name,
64
66
  standalone: options.standalone,
67
+ skipPackageJson: options.skipPackageJson,
65
68
  });
66
69
  }
67
70
  if (!options.skipFormat) {
@@ -59,7 +59,9 @@ async function addE2e(tree, options) {
59
59
  }
60
60
  exports.addE2e = addE2e;
61
61
  function addFileServerTarget(tree, options, targetName) {
62
- (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion });
62
+ if (!options.skipPackageJson) {
63
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion });
64
+ }
63
65
  const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
64
66
  const isUsingApplicationBuilder = angularMajorVersion >= 17 && options.bundler === 'esbuild';
65
67
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.name);
@@ -29,12 +29,14 @@ async function updateSsrSetup(tree, options, appName, typescriptConfiguration) {
29
29
  project.targets['serve-ssr'].executor =
30
30
  '@nx/angular:module-federation-dev-ssr';
31
31
  (0, devkit_1.updateProjectConfiguration)(tree, appName, project);
32
- const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
33
- cors: versions_1.corsVersion,
34
- '@module-federation/node': versions_1.moduleFederationNodeVersion,
35
- }, {
36
- '@types/cors': versions_1.typesCorsVersion,
37
- });
38
- return installTask;
32
+ if (!options.skipPackageJson) {
33
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {
34
+ cors: versions_1.corsVersion,
35
+ '@module-federation/node': versions_1.moduleFederationNodeVersion,
36
+ }, {
37
+ '@types/cors': versions_1.typesCorsVersion,
38
+ });
39
+ }
40
+ return () => { };
39
41
  }
40
42
  exports.updateSsrSetup = updateSsrSetup;
@@ -50,7 +50,9 @@ async function libraryGeneratorInternal(tree, schema) {
50
50
  skipFormat: true,
51
51
  });
52
52
  await (0, init_1.default)(tree, { ...libraryOptions, skipFormat: true });
53
- (0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree);
53
+ if (!libraryOptions.skipPackageJson) {
54
+ (0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree);
55
+ }
54
56
  const project = (0, add_project_1.addProject)(tree, libraryOptions);
55
57
  (0, create_files_1.createFiles)(tree, options, project);
56
58
  (0, update_tsconfig_1.updateTsConfig)(tree, libraryOptions);
@@ -72,10 +74,11 @@ async function libraryGeneratorInternal(tree, schema) {
72
74
  skipPackageJson: libraryOptions.skipPackageJson,
73
75
  });
74
76
  }
75
- if (libraryOptions.buildable || libraryOptions.publishable) {
76
- (0, version_utils_1.addDependenciesToPackageJsonIfDontExist)(tree, {}, {
77
+ if ((libraryOptions.buildable || libraryOptions.publishable) &&
78
+ !libraryOptions.skipPackageJson) {
79
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
77
80
  'ng-packagr': pkgVersions.ngPackagrVersion,
78
- });
81
+ }, undefined, true);
79
82
  (0, dependencies_1.addBuildableLibrariesPostCssDependencies)(tree);
80
83
  }
81
84
  (0, js_1.addTsConfigPath)(tree, libraryOptions.importPath, [
@@ -1,7 +1,8 @@
1
1
  import type { Tree } from '@nx/devkit';
2
- export declare function updateSsrSetup(tree: Tree, { appName, port, standalone, typescriptConfiguration, }: {
2
+ export declare function updateSsrSetup(tree: Tree, { appName, port, standalone, typescriptConfiguration, skipPackageJson, }: {
3
3
  appName: string;
4
4
  port: number;
5
5
  standalone: boolean;
6
6
  typescriptConfiguration: boolean;
7
+ skipPackageJson?: boolean;
7
8
  }): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
5
5
  const path_1 = require("path");
6
6
  const versions_1 = require("../../../utils/versions");
7
7
  const version_utils_1 = require("../../utils/version-utils");
8
- async function updateSsrSetup(tree, { appName, port, standalone, typescriptConfiguration, }) {
8
+ async function updateSsrSetup(tree, { appName, port, standalone, typescriptConfiguration, skipPackageJson, }) {
9
9
  let project = (0, devkit_1.readProjectConfiguration)(tree, appName);
10
10
  tree.rename((0, devkit_1.joinPathFragments)(project.sourceRoot, 'main.server.ts'), (0, devkit_1.joinPathFragments)(project.sourceRoot, 'bootstrap.server.ts'));
11
11
  tree.write((0, devkit_1.joinPathFragments)(project.root, 'server.ts'), "import('./src/main.server');");
@@ -48,12 +48,14 @@ async function updateSsrSetup(tree, { appName, port, standalone, typescriptConfi
48
48
  },
49
49
  };
50
50
  (0, devkit_1.updateProjectConfiguration)(tree, appName, project);
51
- const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
52
- cors: versions_1.corsVersion,
53
- '@module-federation/node': versions_1.moduleFederationNodeVersion,
54
- }, {
55
- '@types/cors': versions_1.typesCorsVersion,
56
- });
57
- return installTask;
51
+ if (!skipPackageJson) {
52
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {
53
+ cors: versions_1.corsVersion,
54
+ '@module-federation/node': versions_1.moduleFederationNodeVersion,
55
+ }, {
56
+ '@types/cors': versions_1.typesCorsVersion,
57
+ });
58
+ }
59
+ return () => { };
58
60
  }
59
61
  exports.updateSsrSetup = updateSsrSetup;
@@ -56,16 +56,20 @@ async function remoteInternal(tree, schema) {
56
56
  typescriptConfiguration,
57
57
  setParserOptionsProject: options.setParserOptionsProject,
58
58
  });
59
- const installSwcHelpersTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
60
- '@swc/helpers': versions_1.swcHelpersVersion,
61
- });
62
- let installTasks = [appInstallTask, installSwcHelpersTask];
59
+ const installTasks = [appInstallTask];
60
+ if (!options.skipPackageJson) {
61
+ const installSwcHelpersTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
62
+ '@swc/helpers': versions_1.swcHelpersVersion,
63
+ });
64
+ installTasks.push(installSwcHelpersTask);
65
+ }
63
66
  if (options.ssr) {
64
67
  let ssrInstallTask = await (0, lib_1.updateSsrSetup)(tree, {
65
68
  appName: remoteProjectName,
66
69
  port,
67
70
  typescriptConfiguration,
68
71
  standalone: options.standalone,
72
+ skipPackageJson: options.skipPackageJson,
69
73
  });
70
74
  installTasks.push(ssrInstallTask);
71
75
  }
@@ -18,7 +18,9 @@ async function setupMf(tree, rawOptions) {
18
18
  (0, lib_1.addRemoteEntry)(tree, options, projectConfig.root);
19
19
  (0, lib_1.removeDeadCodeFromRemote)(tree, options);
20
20
  (0, lib_1.setupTspathForRemote)(tree, options);
21
- installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion, '@nx/webpack': versions_1.nxVersion });
21
+ if (!options.skipPackageJson) {
22
+ installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion, '@nx/webpack': versions_1.nxVersion });
23
+ }
22
24
  }
23
25
  const remotesWithPorts = (0, lib_1.getRemotesWithPorts)(tree, options);
24
26
  (0, lib_1.generateWebpackConfig)(tree, options, projectConfig.root, remotesWithPorts);
@@ -37,7 +39,9 @@ async function setupMf(tree, rawOptions) {
37
39
  port,
38
40
  });
39
41
  }
40
- installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/webpack': versions_1.nxVersion });
42
+ if (!options.skipPackageJson) {
43
+ installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/webpack': versions_1.nxVersion });
44
+ }
41
45
  }
42
46
  if (!options.skipE2E) {
43
47
  (0, lib_1.addCypressOnErrorWorkaround)(tree, options);
@@ -9,4 +9,5 @@ export interface Schema {
9
9
  standalone?: boolean;
10
10
  hydration?: boolean;
11
11
  skipFormat?: boolean;
12
+ skipPackageJson?: boolean;
12
13
  }
@@ -61,6 +61,12 @@
61
61
  "type": "boolean",
62
62
  "description": "Skip formatting the workspace after the generator completes.",
63
63
  "x-priority": "internal"
64
+ },
65
+ "skipPackageJson": {
66
+ "type": "boolean",
67
+ "default": false,
68
+ "description": "Do not add dependencies to `package.json`.",
69
+ "x-priority": "internal"
64
70
  }
65
71
  },
66
72
  "required": ["project"],
@@ -10,7 +10,9 @@ async function setupSsr(tree, schema) {
10
10
  const { targets } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
11
11
  const isUsingApplicationBuilder = targets.build.executor === '@angular-devkit/build-angular:application' ||
12
12
  targets.build.executor === '@nx/angular:application';
13
- (0, lib_1.addDependencies)(tree, isUsingApplicationBuilder);
13
+ if (!schema.skipPackageJson) {
14
+ (0, lib_1.addDependencies)(tree, isUsingApplicationBuilder);
15
+ }
14
16
  (0, lib_1.generateSSRFiles)(tree, options, isUsingApplicationBuilder);
15
17
  if (!options.standalone) {
16
18
  (0, lib_1.updateAppModule)(tree, options);
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addJest = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const versions_1 = require("../../utils/versions");
6
- const version_utils_1 = require("./version-utils");
7
6
  async function addJest(tree, options) {
8
7
  if (!options.skipPackageJson) {
9
8
  process.env.npm_config_legacy_peer_deps ??= 'true';
10
- (0, version_utils_1.addDependenciesToPackageJsonIfDontExist)(tree, {}, { 'jest-preset-angular': versions_1.jestPresetAngularVersion });
9
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'jest-preset-angular': versions_1.jestPresetAngularVersion }, undefined, true);
11
10
  }
12
11
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/jest', versions_1.nxVersion);
13
12
  await configurationGenerator(tree, {
@@ -1,2 +1,2 @@
1
- import type { GeneratorCallback, Tree } from '@nx/devkit';
1
+ import { type GeneratorCallback, type Tree } from '@nx/devkit';
2
2
  export declare function ensureAngularDependencies(tree: Tree): GeneratorCallback;
@@ -1,35 +1,52 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureAngularDependencies = void 0;
4
+ const devkit_1 = require("@nx/devkit");
4
5
  const version_utils_1 = require("./version-utils");
5
6
  function ensureAngularDependencies(tree) {
7
+ const dependencies = {};
8
+ const devDependencies = {};
6
9
  const pkgVersions = (0, version_utils_1.versions)(tree);
7
- const angularVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, '@angular/core') ??
8
- pkgVersions.angularVersion;
9
- const angularDevkitVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, '@angular-devkit/build-angular') ??
10
- pkgVersions.angularDevkitVersion;
11
- const rxjsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'rxjs') ?? pkgVersions.rxjsVersion;
12
- const tsLibVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'tslib') ?? pkgVersions.tsLibVersion;
13
- const zoneJsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'zone.js') ?? pkgVersions.zoneJsVersion;
14
- return (0, version_utils_1.addDependenciesToPackageJsonIfDontExist)(tree, {
15
- '@angular/animations': angularVersion,
16
- '@angular/common': angularVersion,
17
- '@angular/compiler': angularVersion,
18
- '@angular/core': angularVersion,
19
- '@angular/forms': angularVersion,
20
- '@angular/platform-browser': angularVersion,
21
- '@angular/platform-browser-dynamic': angularVersion,
22
- '@angular/router': angularVersion,
23
- rxjs: rxjsVersion,
24
- tslib: tsLibVersion,
25
- 'zone.js': zoneJsVersion,
26
- }, {
27
- '@angular/cli': angularDevkitVersion,
28
- '@angular/compiler-cli': angularVersion,
29
- '@angular/language-service': angularVersion,
30
- '@angular-devkit/build-angular': angularDevkitVersion,
31
- '@angular-devkit/schematics': angularDevkitVersion,
32
- '@schematics/angular': angularDevkitVersion,
33
- });
10
+ const installedAngularCoreVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, '@angular/core');
11
+ if (!installedAngularCoreVersion) {
12
+ /**
13
+ * If @angular/core is already installed, we assume the workspace was already
14
+ * initialized with Angular dependencies and we don't want to re-install them.
15
+ * This is to avoid re-installing Angular runtime dependencies that the user
16
+ * might have removed.
17
+ */
18
+ const angularVersion = pkgVersions.angularVersion;
19
+ const rxjsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'rxjs') ?? pkgVersions.rxjsVersion;
20
+ const tsLibVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'tslib') ?? pkgVersions.tsLibVersion;
21
+ const zoneJsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'zone.js') ?? pkgVersions.zoneJsVersion;
22
+ dependencies['@angular/animations'] = angularVersion;
23
+ dependencies['@angular/common'] = angularVersion;
24
+ dependencies['@angular/compiler'] = angularVersion;
25
+ dependencies['@angular/core'] = angularVersion;
26
+ dependencies['@angular/forms'] = angularVersion;
27
+ dependencies['@angular/platform-browser'] = angularVersion;
28
+ dependencies['@angular/platform-browser-dynamic'] = angularVersion;
29
+ dependencies['@angular/router'] = angularVersion;
30
+ dependencies.rxjs = rxjsVersion;
31
+ dependencies.tslib = tsLibVersion;
32
+ dependencies['zone.js'] = zoneJsVersion;
33
+ }
34
+ const installedAngularDevkitVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, '@angular-devkit/build-angular');
35
+ if (!installedAngularDevkitVersion) {
36
+ /**
37
+ * If `@angular-devkit/build-angular` is already installed, we assume the workspace
38
+ * was already initialized with Angular and we don't want to re-install the tooling.
39
+ * This is to avoid re-installing Angular tooling that the user might have removed.
40
+ */
41
+ devDependencies['@angular/cli'] = pkgVersions.angularDevkitVersion;
42
+ devDependencies['@angular/compiler-cli'] = pkgVersions.angularVersion;
43
+ devDependencies['@angular/language-service'] = pkgVersions.angularVersion;
44
+ }
45
+ // Ensure the `@nx/angular` peer dependencies are always installed.
46
+ const angularDevkitVersion = installedAngularDevkitVersion ?? pkgVersions.angularDevkitVersion;
47
+ devDependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
48
+ devDependencies['@angular-devkit/schematics'] = angularDevkitVersion;
49
+ devDependencies['@schematics/angular'] = angularDevkitVersion;
50
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, dependencies, devDependencies, undefined, true);
34
51
  }
35
52
  exports.ensureAngularDependencies = ensureAngularDependencies;
@@ -5,14 +5,12 @@ const devkit_1 = require("@nx/devkit");
5
5
  const testing_1 = require("@nx/devkit/testing");
6
6
  const eslint_1 = require("@nx/eslint");
7
7
  const test_runners_1 = require("../../utils/test-runners");
8
- const versions_1 = require("../../utils/versions");
9
8
  const application_1 = require("../application/application");
10
9
  const component_1 = require("../component/component");
11
10
  const host_1 = require("../host/host");
12
11
  const library_1 = require("../library/library");
13
12
  const remote_1 = require("../remote/remote");
14
13
  async function generateTestApplication(tree, options) {
15
- addAngularPluginPeerDeps(tree);
16
14
  tree.write('.gitignore', '');
17
15
  await (0, application_1.applicationGenerator)(tree, {
18
16
  projectNameAndRootFormat: 'as-provided',
@@ -21,19 +19,16 @@ async function generateTestApplication(tree, options) {
21
19
  }
22
20
  exports.generateTestApplication = generateTestApplication;
23
21
  async function generateTestHostApplication(tree, options) {
24
- addAngularPluginPeerDeps(tree);
25
22
  tree.write('.gitignore', '');
26
23
  await (0, host_1.host)(tree, { projectNameAndRootFormat: 'as-provided', ...options });
27
24
  }
28
25
  exports.generateTestHostApplication = generateTestHostApplication;
29
26
  async function generateTestRemoteApplication(tree, options) {
30
- addAngularPluginPeerDeps(tree);
31
27
  tree.write('.gitignore', '');
32
28
  await (0, remote_1.remote)(tree, { projectNameAndRootFormat: 'as-provided', ...options });
33
29
  }
34
30
  exports.generateTestRemoteApplication = generateTestRemoteApplication;
35
31
  async function generateTestLibrary(tree, options) {
36
- addAngularPluginPeerDeps(tree);
37
32
  tree.write('.gitignore', '');
38
33
  await (0, library_1.libraryGenerator)(tree, {
39
34
  projectNameAndRootFormat: 'as-provided',
@@ -43,7 +38,6 @@ async function generateTestLibrary(tree, options) {
43
38
  exports.generateTestLibrary = generateTestLibrary;
44
39
  async function createStorybookTestWorkspaceForLib(libName) {
45
40
  let tree = (0, testing_1.createTreeWithEmptyWorkspace)({ layout: 'apps-libs' });
46
- addAngularPluginPeerDeps(tree);
47
41
  tree.write('.gitignore', '');
48
42
  await (0, library_1.libraryGenerator)(tree, {
49
43
  name: libName,
@@ -243,17 +237,6 @@ export class StaticMemberDeclarationsModule {
243
237
  return tree;
244
238
  }
245
239
  exports.createStorybookTestWorkspaceForLib = createStorybookTestWorkspaceForLib;
246
- function addAngularPluginPeerDeps(tree) {
247
- (0, devkit_1.updateJson)(tree, 'package.json', (json) => ({
248
- ...json,
249
- devDependencies: {
250
- ...json.devDependencies,
251
- '@angular-devkit/core': versions_1.angularDevkitVersion,
252
- '@angular-devkit/schematics': versions_1.angularDevkitVersion,
253
- '@schematics/angular': versions_1.angularDevkitVersion,
254
- },
255
- }));
256
- }
257
240
  function generateModule(tree, options) {
258
241
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
259
242
  if (options.path === undefined) {
@@ -1,4 +1,4 @@
1
- import type { GeneratorCallback, Tree } from '@nx/devkit';
1
+ import { type Tree } from '@nx/devkit';
2
2
  import { type PackageCompatVersions, type PackageLatestVersions } from '../../utils/backward-compatible-versions';
3
3
  export declare function getInstalledAngularVersion(tree: Tree): string;
4
4
  export declare function getInstalledAngularMajorVersion(tree: Tree): number;
@@ -11,5 +11,4 @@ export declare function getInstalledPackageVersionInfo(tree: Tree, pkgName: stri
11
11
  major: number;
12
12
  version: string;
13
13
  };
14
- export declare function addDependenciesToPackageJsonIfDontExist(tree: Tree, dependencies: Record<string, string>, devDependencies: Record<string, string>, packageJsonPath?: string): GeneratorCallback;
15
14
  export declare function versions(tree: Tree): PackageLatestVersions | PackageCompatVersions;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.versions = exports.addDependenciesToPackageJsonIfDontExist = exports.getInstalledPackageVersionInfo = exports.getInstalledPackageVersion = exports.getInstalledAngularVersionInfo = exports.getInstalledAngularMajorVersion = exports.getInstalledAngularVersion = void 0;
3
+ exports.versions = exports.getInstalledPackageVersionInfo = exports.getInstalledPackageVersion = exports.getInstalledAngularVersionInfo = exports.getInstalledAngularMajorVersion = exports.getInstalledAngularVersion = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const semver_1 = require("semver");
6
6
  const backward_compatible_versions_1 = require("../../utils/backward-compatible-versions");
@@ -40,18 +40,6 @@ function getInstalledPackageVersionInfo(tree, pkgName) {
40
40
  return version ? { major: (0, semver_1.major)((0, semver_1.coerce)(version)), version } : null;
41
41
  }
42
42
  exports.getInstalledPackageVersionInfo = getInstalledPackageVersionInfo;
43
- function addDependenciesToPackageJsonIfDontExist(tree, dependencies, devDependencies, packageJsonPath = 'package.json') {
44
- const packageJson = (0, devkit_1.readJson)(tree, packageJsonPath);
45
- function filterExisting(deps) {
46
- return Object.keys(deps)
47
- .filter((d) => !packageJson.dependencies?.[d] && !packageJson.devDependencies?.[d])
48
- .reduce((acc, d) => ({ ...acc, [d]: deps[d] }), {});
49
- }
50
- const depsToAdd = filterExisting(dependencies);
51
- const devDepsToAdd = filterExisting(devDependencies);
52
- return (0, devkit_1.addDependenciesToPackageJson)(tree, depsToAdd, devDepsToAdd, packageJsonPath);
53
- }
54
- exports.addDependenciesToPackageJsonIfDontExist = addDependenciesToPackageJsonIfDontExist;
55
43
  function versions(tree) {
56
44
  const majorAngularVersion = getInstalledAngularMajorVersion(tree);
57
45
  switch (majorAngularVersion) {