@nx/web 16.8.0-beta.4 → 16.8.0-beta.6

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.
@@ -1,33 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const deprecatedOptions = ['showCircularDependencies', 'budgets'];
6
- function update(host) {
7
- var _a, _b, _c;
8
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
- const projects = (0, devkit_1.getProjects)(host);
10
- for (const [name, config] of projects.entries()) {
11
- if (config.targets.build.executor !== '@nrwl/web:build')
12
- return;
13
- for (const opt of deprecatedOptions) {
14
- let updated = false;
15
- if (typeof ((_c = (_b = (_a = config.targets.build) === null || _a === void 0 ? void 0 : _a.configurations) === null || _b === void 0 ? void 0 : _b.production) === null || _c === void 0 ? void 0 : _c[opt]) !==
16
- 'undefined') {
17
- delete config.targets.build.configurations.production[opt];
18
- updated = true;
19
- }
20
- if (typeof config.targets.build.options[opt] !== 'undefined') {
21
- delete config.targets.build.options[opt];
22
- updated = true;
23
- }
24
- if (updated) {
25
- (0, devkit_1.updateProjectConfiguration)(host, name, config);
26
- devkit_1.logger.info(`NX Removed legacy build option from "${name}": ${opt}`);
27
- }
5
+ async function update(host) {
6
+ const projects = (0, devkit_1.getProjects)(host);
7
+ for (const [name, config] of projects.entries()) {
8
+ if (config.targets.build.executor !== '@nrwl/web:build')
9
+ return;
10
+ for (const opt of deprecatedOptions) {
11
+ let updated = false;
12
+ if (typeof config.targets.build?.configurations?.production?.[opt] !==
13
+ 'undefined') {
14
+ delete config.targets.build.configurations.production[opt];
15
+ updated = true;
16
+ }
17
+ if (typeof config.targets.build.options[opt] !== 'undefined') {
18
+ delete config.targets.build.options[opt];
19
+ updated = true;
20
+ }
21
+ if (updated) {
22
+ (0, devkit_1.updateProjectConfiguration)(host, name, config);
23
+ devkit_1.logger.info(`NX Removed legacy build option from "${name}": ${opt}`);
28
24
  }
29
25
  }
30
- yield (0, devkit_1.formatFiles)(host);
31
- });
26
+ }
27
+ await (0, devkit_1.formatFiles)(host);
32
28
  }
33
29
  exports.default = update;
@@ -1,24 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  /**
6
5
  * For web/react apps with style scss option, remove node-sass sine it is deprecated.
7
6
  * We already include sass package in `@nrwl/web` deps so no need to install anything extra.
8
7
  */
9
- function update(tree) {
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
12
- let task = undefined;
13
- if (packageJson.devDependencies['node-sass']) {
14
- task = (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], ['node-sass']);
15
- }
16
- if (packageJson.dependencies['node-sass']) {
17
- task = (0, devkit_1.removeDependenciesFromPackageJson)(tree, ['node-sass'], []);
18
- }
19
- if (task)
20
- yield (0, devkit_1.formatFiles)(tree);
21
- return task;
22
- });
8
+ async function update(tree) {
9
+ const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
10
+ let task = undefined;
11
+ if (packageJson.devDependencies['node-sass']) {
12
+ task = (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], ['node-sass']);
13
+ }
14
+ if (packageJson.dependencies['node-sass']) {
15
+ task = (0, devkit_1.removeDependenciesFromPackageJson)(tree, ['node-sass'], []);
16
+ }
17
+ if (task)
18
+ await (0, devkit_1.formatFiles)(tree);
19
+ return task;
23
20
  }
24
21
  exports.default = update;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const packages = [
6
5
  'webpack',
@@ -15,18 +14,15 @@ const packages = [
15
14
  'react-refresh',
16
15
  '@pmmmwh/react-refresh-webpack-plugin',
17
16
  ];
18
- function update(tree) {
19
- var _a;
20
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
- const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
22
- let task = undefined;
23
- // Undo the install by `nx g @nrwl/web:webpack5` in Nx 12.
24
- if (((_a = packageJson.devDependencies['webpack']) === null || _a === void 0 ? void 0 : _a.match(/^([\^~])?5\./)) &&
25
- packages.every((p) => packageJson.devDependencies[p])) {
26
- task = (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], packages);
27
- yield (0, devkit_1.formatFiles)(tree);
28
- }
29
- return task;
30
- });
17
+ async function update(tree) {
18
+ const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
19
+ let task = undefined;
20
+ // Undo the install by `nx g @nrwl/web:webpack5` in Nx 12.
21
+ if (packageJson.devDependencies['webpack']?.match(/^([\^~])?5\./) &&
22
+ packages.every((p) => packageJson.devDependencies[p])) {
23
+ task = (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], packages);
24
+ await (0, devkit_1.formatFiles)(tree);
25
+ }
26
+ return task;
31
27
  }
32
28
  exports.default = update;
@@ -1,18 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
- function update(host) {
6
- var _a, _b;
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- const projects = (0, devkit_1.getProjects)(host);
9
- for (const [name, config] of projects.entries()) {
10
- if (((_b = (_a = config === null || config === void 0 ? void 0 : config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) !== '@nrwl/web:build')
11
- continue;
12
- config.targets.build.executor = '@nrwl/web:webpack';
13
- (0, devkit_1.updateProjectConfiguration)(host, name, config);
14
- }
15
- yield (0, devkit_1.formatFiles)(host);
16
- });
4
+ async function update(host) {
5
+ const projects = (0, devkit_1.getProjects)(host);
6
+ for (const [name, config] of projects.entries()) {
7
+ if (config?.targets?.build?.executor !== '@nrwl/web:build')
8
+ continue;
9
+ config.targets.build.executor = '@nrwl/web:webpack';
10
+ (0, devkit_1.updateProjectConfiguration)(host, name, config);
11
+ }
12
+ await (0, devkit_1.formatFiles)(host);
17
13
  }
18
14
  exports.default = update;
@@ -1,18 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
- function update(host) {
6
- var _a, _b;
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- const projects = (0, devkit_1.getProjects)(host);
9
- for (const [name, config] of projects.entries()) {
10
- if (((_b = (_a = config === null || config === void 0 ? void 0 : config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) !== '@nrwl/web:package')
11
- continue;
12
- config.targets.build.executor = '@nrwl/web:rollup';
13
- (0, devkit_1.updateProjectConfiguration)(host, name, config);
14
- }
15
- yield (0, devkit_1.formatFiles)(host);
16
- });
4
+ async function update(host) {
5
+ const projects = (0, devkit_1.getProjects)(host);
6
+ for (const [name, config] of projects.entries()) {
7
+ if (config?.targets?.build?.executor !== '@nrwl/web:package')
8
+ continue;
9
+ config.targets.build.executor = '@nrwl/web:rollup';
10
+ (0, devkit_1.updateProjectConfiguration)(host, name, config);
11
+ }
12
+ await (0, devkit_1.formatFiles)(host);
17
13
  }
18
14
  exports.default = update;
@@ -1,25 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  /*
6
5
  * This migration ensures that the previous behavior of applying the app postcss config
7
6
  * is carried over to Nx 13.8.0.
8
7
  */
9
- function update(host) {
10
- var _a, _b;
11
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
- const projects = (0, devkit_1.getProjects)(host);
13
- for (const [name, config] of projects.entries()) {
14
- if (((_b = (_a = config === null || config === void 0 ? void 0 : config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) !== '@nrwl/web:webpack')
15
- continue;
16
- const configPath = `${config.root}/postcss.config.js`;
17
- if (host.exists(configPath)) {
18
- config.targets.build.options.postcssConfig = configPath;
19
- }
20
- (0, devkit_1.updateProjectConfiguration)(host, name, config);
8
+ async function update(host) {
9
+ const projects = (0, devkit_1.getProjects)(host);
10
+ for (const [name, config] of projects.entries()) {
11
+ if (config?.targets?.build?.executor !== '@nrwl/web:webpack')
12
+ continue;
13
+ const configPath = `${config.root}/postcss.config.js`;
14
+ if (host.exists(configPath)) {
15
+ config.targets.build.options.postcssConfig = configPath;
21
16
  }
22
- yield (0, devkit_1.formatFiles)(host);
23
- });
17
+ (0, devkit_1.updateProjectConfiguration)(host, name, config);
18
+ }
19
+ await (0, devkit_1.formatFiles)(host);
24
20
  }
25
21
  exports.default = update;
@@ -1,22 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  /*
6
5
  *
7
6
  */
8
- function update(tree) {
9
- var _a, _b, _c;
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- for (const [name, config] of (0, devkit_1.getProjects)(tree)) {
12
- if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) !== '@nrwl/web:rollup')
13
- continue;
14
- if (Array.isArray((_c = config.targets.build.options) === null || _c === void 0 ? void 0 : _c.format))
15
- continue;
16
- config.targets.build.options = Object.assign(Object.assign({}, config.targets.build.options), { format: ['esm', 'cjs'] });
17
- (0, devkit_1.updateProjectConfiguration)(tree, name, config);
18
- }
19
- yield (0, devkit_1.formatFiles)(tree);
20
- });
7
+ async function update(tree) {
8
+ for (const [name, config] of (0, devkit_1.getProjects)(tree)) {
9
+ if (config.targets?.build?.executor !== '@nrwl/web:rollup')
10
+ continue;
11
+ if (Array.isArray(config.targets.build.options?.format))
12
+ continue;
13
+ config.targets.build.options = {
14
+ ...config.targets.build.options,
15
+ format: ['esm', 'cjs'],
16
+ };
17
+ (0, devkit_1.updateProjectConfiguration)(tree, name, config);
18
+ }
19
+ await (0, devkit_1.formatFiles)(tree);
21
20
  }
22
21
  exports.default = update;
@@ -1,26 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
- function update(host) {
6
- var _a, _b, _c, _d;
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- const projects = (0, devkit_1.getProjects)(host);
9
- for (const [name, config] of projects.entries()) {
10
- let updated = false;
11
- if (((_b = (_a = config === null || config === void 0 ? void 0 : config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/web:webpack') {
12
- config.targets.build.executor = '@nrwl/webpack:webpack';
13
- updated = true;
14
- }
15
- if (((_d = (_c = config === null || config === void 0 ? void 0 : config.targets) === null || _c === void 0 ? void 0 : _c.serve) === null || _d === void 0 ? void 0 : _d.executor) === '@nrwl/web:dev-server') {
16
- config.targets.serve.executor = '@nrwl/webpack:dev-server';
17
- updated = true;
18
- }
19
- if (updated) {
20
- (0, devkit_1.updateProjectConfiguration)(host, name, config);
21
- }
4
+ async function update(host) {
5
+ const projects = (0, devkit_1.getProjects)(host);
6
+ for (const [name, config] of projects.entries()) {
7
+ let updated = false;
8
+ if (config?.targets?.build?.executor === '@nrwl/web:webpack') {
9
+ config.targets.build.executor = '@nrwl/webpack:webpack';
10
+ updated = true;
22
11
  }
23
- yield (0, devkit_1.formatFiles)(host);
24
- });
12
+ if (config?.targets?.serve?.executor === '@nrwl/web:dev-server') {
13
+ config.targets.serve.executor = '@nrwl/webpack:dev-server';
14
+ updated = true;
15
+ }
16
+ if (updated) {
17
+ (0, devkit_1.updateProjectConfiguration)(host, name, config);
18
+ }
19
+ }
20
+ await (0, devkit_1.formatFiles)(host);
25
21
  }
26
22
  exports.default = update;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const add_babel_inputs_1 = require("@nx/js/src/utils/add-babel-inputs");
6
- function default_1(tree) {
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- (0, add_babel_inputs_1.addBabelInputs)(tree);
9
- yield (0, devkit_1.formatFiles)(tree);
10
- });
5
+ async function default_1(tree) {
6
+ (0, add_babel_inputs_1.addBabelInputs)(tree);
7
+ await (0, devkit_1.formatFiles)(tree);
11
8
  }
12
9
  exports.default = default_1;
@@ -1,37 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
- function update(host) {
6
- var _a, _b, _c, _d, _e, _f;
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- const projects = (0, devkit_1.getProjects)(host);
9
- for (const [name, config] of projects.entries()) {
10
- let updated = false;
11
- if (((_b = (_a = config === null || config === void 0 ? void 0 : config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/web:rollup') {
12
- config.targets.build.executor = '@nrwl/rollup:rollup';
13
- updated = true;
14
- }
15
- if ((_f = (_e = (_d = (_c = config === null || config === void 0 ? void 0 : config.targets) === null || _c === void 0 ? void 0 : _c.build) === null || _d === void 0 ? void 0 : _d.options) === null || _e === void 0 ? void 0 : _e.formats) === null || _f === void 0 ? void 0 : _f.includes('umd')) {
16
- config.targets.build.options.formats =
17
- config.targets.build.options.formats.reduce((acc, x) => {
18
- const format = x === 'umd' ? 'cjs' : x;
19
- if (format === 'cjs') {
20
- if (!acc.includes('cjs'))
21
- acc.push(format);
22
- }
23
- else {
4
+ async function update(host) {
5
+ const projects = (0, devkit_1.getProjects)(host);
6
+ for (const [name, config] of projects.entries()) {
7
+ let updated = false;
8
+ if (config?.targets?.build?.executor === '@nrwl/web:rollup') {
9
+ config.targets.build.executor = '@nrwl/rollup:rollup';
10
+ updated = true;
11
+ }
12
+ if (config?.targets?.build?.options?.formats?.includes('umd')) {
13
+ config.targets.build.options.formats =
14
+ config.targets.build.options.formats.reduce((acc, x) => {
15
+ const format = x === 'umd' ? 'cjs' : x;
16
+ if (format === 'cjs') {
17
+ if (!acc.includes('cjs'))
24
18
  acc.push(format);
25
- }
26
- return acc;
27
- }, []);
28
- updated = true;
29
- }
30
- if (updated) {
31
- (0, devkit_1.updateProjectConfiguration)(host, name, config);
32
- }
19
+ }
20
+ else {
21
+ acc.push(format);
22
+ }
23
+ return acc;
24
+ }, []);
25
+ updated = true;
26
+ }
27
+ if (updated) {
28
+ (0, devkit_1.updateProjectConfiguration)(host, name, config);
33
29
  }
34
- yield (0, devkit_1.formatFiles)(host);
35
- });
30
+ }
31
+ await (0, devkit_1.formatFiles)(host);
36
32
  }
37
33
  exports.default = update;
@@ -1,36 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const versions_1 = require("../../utils/versions");
6
5
  /* Updates @nrwl/web/babel to @nrwl/js/babel because web package is no longer necessary to use webpack/rollup + babel. */
7
- function update(tree) {
8
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
- // Add `@nrwl/js` in case it was missing before.
10
- (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
11
- '@nrwl/js': versions_1.nxVersion,
12
- });
13
- const projects = (0, devkit_1.getProjects)(tree);
14
- projects.forEach((config, name) => {
15
- var _a;
16
- const babelrcPath = (0, devkit_1.joinPathFragments)(config.root, '.babelrc');
17
- if (!tree.exists(babelrcPath))
18
- return;
19
- const babelrc = (0, devkit_1.readJson)(tree, babelrcPath);
20
- const idx = (_a = babelrc === null || babelrc === void 0 ? void 0 : babelrc.presets) === null || _a === void 0 ? void 0 : _a.findIndex((p) => typeof p === 'string'
21
- ? p === '@nrwl/web/babel'
22
- : p[0] === '@nrwl/web/babel');
23
- if (idx === -1)
24
- return;
25
- const preset = babelrc.presets[idx];
26
- if (typeof preset === 'string') {
27
- babelrc.presets.splice(idx, 1, '@nrwl/js/babel');
28
- }
29
- else if (Array.isArray(preset)) {
30
- babelrc.presets.splice(idx, 1, ['@nrwl/js/babel', preset[1]]);
31
- }
32
- (0, devkit_1.writeJson)(tree, babelrcPath, babelrc);
33
- });
6
+ async function update(tree) {
7
+ // Add `@nrwl/js` in case it was missing before.
8
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
9
+ '@nrwl/js': versions_1.nxVersion,
10
+ });
11
+ const projects = (0, devkit_1.getProjects)(tree);
12
+ projects.forEach((config, name) => {
13
+ const babelrcPath = (0, devkit_1.joinPathFragments)(config.root, '.babelrc');
14
+ if (!tree.exists(babelrcPath))
15
+ return;
16
+ const babelrc = (0, devkit_1.readJson)(tree, babelrcPath);
17
+ const idx = babelrc?.presets?.findIndex((p) => typeof p === 'string'
18
+ ? p === '@nrwl/web/babel'
19
+ : p[0] === '@nrwl/web/babel');
20
+ if (idx === -1)
21
+ return;
22
+ const preset = babelrc.presets[idx];
23
+ if (typeof preset === 'string') {
24
+ babelrc.presets.splice(idx, 1, '@nrwl/js/babel');
25
+ }
26
+ else if (Array.isArray(preset)) {
27
+ babelrc.presets.splice(idx, 1, ['@nrwl/js/babel', preset[1]]);
28
+ }
29
+ (0, devkit_1.writeJson)(tree, babelrcPath, babelrc);
34
30
  });
35
31
  }
36
32
  exports.default = update;
@@ -1,39 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
- function addDroppedDependencies(tree) {
6
- var _a, _b, _c, _d;
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- const devDependencies = {};
9
- const droppedDependencies = [
10
- '@nrwl/linter',
11
- '@nrwl/cypress',
12
- '@nrwl/jest',
13
- '@nrwl/rollup',
14
- ];
15
- const projects = (0, devkit_1.getProjects)(tree);
16
- for (const [_, projectConfiguration] of projects) {
17
- for (const [_, targetConfiguration] of Object.entries((_a = projectConfiguration.targets) !== null && _a !== void 0 ? _a : {})) {
18
- for (const droppedDependency of droppedDependencies) {
19
- if ((_b = targetConfiguration.executor) === null || _b === void 0 ? void 0 : _b.startsWith(droppedDependency + ':')) {
20
- devDependencies[droppedDependency] = devkit_1.NX_VERSION;
21
- }
22
- }
23
- }
24
- }
25
- const nxJson = (0, devkit_1.readNxJson)(tree);
26
- for (const [_, targetConfiguration] of Object.entries((_c = nxJson === null || nxJson === void 0 ? void 0 : nxJson.targetDefaults) !== null && _c !== void 0 ? _c : {})) {
4
+ async function addDroppedDependencies(tree) {
5
+ const devDependencies = {};
6
+ const droppedDependencies = [
7
+ '@nrwl/linter',
8
+ '@nrwl/cypress',
9
+ '@nrwl/jest',
10
+ '@nrwl/rollup',
11
+ ];
12
+ const projects = (0, devkit_1.getProjects)(tree);
13
+ for (const [_, projectConfiguration] of projects) {
14
+ for (const [_, targetConfiguration] of Object.entries(projectConfiguration.targets ?? {})) {
27
15
  for (const droppedDependency of droppedDependencies) {
28
- if ((_d = targetConfiguration.executor) === null || _d === void 0 ? void 0 : _d.startsWith(droppedDependency + ':')) {
16
+ if (targetConfiguration.executor?.startsWith(droppedDependency + ':')) {
29
17
  devDependencies[droppedDependency] = devkit_1.NX_VERSION;
30
18
  }
31
19
  }
32
20
  }
33
- if (Object.keys(devDependencies).length > 0) {
34
- (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
21
+ }
22
+ const nxJson = (0, devkit_1.readNxJson)(tree);
23
+ for (const [_, targetConfiguration] of Object.entries(nxJson?.targetDefaults ?? {})) {
24
+ for (const droppedDependency of droppedDependencies) {
25
+ if (targetConfiguration.executor?.startsWith(droppedDependency + ':')) {
26
+ devDependencies[droppedDependency] = devkit_1.NX_VERSION;
27
+ }
35
28
  }
36
- yield (0, devkit_1.formatFiles)(tree);
37
- });
29
+ }
30
+ if (Object.keys(devDependencies).length > 0) {
31
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
32
+ }
33
+ await (0, devkit_1.formatFiles)(tree);
38
34
  }
39
35
  exports.default = addDroppedDependencies;
@@ -1,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
6
- function replacePackage(tree) {
7
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
- yield (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/web', '@nx/web');
9
- yield (0, devkit_1.formatFiles)(tree);
10
- });
5
+ async function replacePackage(tree) {
6
+ await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/web', '@nx/web');
7
+ await (0, devkit_1.formatFiles)(tree);
11
8
  }
12
9
  exports.default = replacePackage;
@@ -1,38 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const devkit_1 = require("@nx/devkit");
5
4
  const versions_1 = require("../../utils/versions");
6
- function update(host) {
7
- var _a, _b, _c, _d, _e, _f;
8
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
- const projects = (0, devkit_1.getProjects)(host);
10
- const deps = {};
11
- for (const [name, config] of projects.entries()) {
12
- let updated = false;
13
- // webpack
14
- if (((_b = (_a = config === null || config === void 0 ? void 0 : config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) === '@nrwl/web:webpack') {
15
- config.targets.build.executor = '@nx/webpack:webpack';
16
- deps['@nx/webpack'] = versions_1.nxVersion;
17
- updated = true;
18
- }
19
- if (((_d = (_c = config === null || config === void 0 ? void 0 : config.targets) === null || _c === void 0 ? void 0 : _c.serve) === null || _d === void 0 ? void 0 : _d.executor) === '@nrwl/web:dev-server') {
20
- config.targets.serve.executor = '@nx/webpack:dev-server';
21
- deps['@nx/webpack'] = versions_1.nxVersion;
22
- updated = true;
23
- }
24
- // rollup
25
- if (((_f = (_e = config === null || config === void 0 ? void 0 : config.targets) === null || _e === void 0 ? void 0 : _e.build) === null || _f === void 0 ? void 0 : _f.executor) === '@nrwl/web:rollup') {
26
- config.targets.build.executor = '@nx/rollup:rollup';
27
- deps['@nx/rollup'] = versions_1.nxVersion;
28
- updated = true;
29
- }
30
- if (updated) {
31
- (0, devkit_1.updateProjectConfiguration)(host, name, config);
32
- }
5
+ async function update(host) {
6
+ const projects = (0, devkit_1.getProjects)(host);
7
+ const deps = {};
8
+ for (const [name, config] of projects.entries()) {
9
+ let updated = false;
10
+ // webpack
11
+ if (config?.targets?.build?.executor === '@nrwl/web:webpack') {
12
+ config.targets.build.executor = '@nx/webpack:webpack';
13
+ deps['@nx/webpack'] = versions_1.nxVersion;
14
+ updated = true;
33
15
  }
34
- yield (0, devkit_1.formatFiles)(host);
35
- return (0, devkit_1.addDependenciesToPackageJson)(host, {}, deps);
36
- });
16
+ if (config?.targets?.serve?.executor === '@nrwl/web:dev-server') {
17
+ config.targets.serve.executor = '@nx/webpack:dev-server';
18
+ deps['@nx/webpack'] = versions_1.nxVersion;
19
+ updated = true;
20
+ }
21
+ // rollup
22
+ if (config?.targets?.build?.executor === '@nrwl/web:rollup') {
23
+ config.targets.build.executor = '@nx/rollup:rollup';
24
+ deps['@nx/rollup'] = versions_1.nxVersion;
25
+ updated = true;
26
+ }
27
+ if (updated) {
28
+ (0, devkit_1.updateProjectConfiguration)(host, name, config);
29
+ }
30
+ }
31
+ await (0, devkit_1.formatFiles)(host);
32
+ return (0, devkit_1.addDependenciesToPackageJson)(host, {}, deps);
37
33
  }
38
34
  exports.default = update;