nx 21.0.0-beta.0 → 21.0.0-beta.10
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/.eslintrc.json +5 -1
- package/migrations.json +5 -35
- package/package.json +12 -12
- package/release/index.d.ts +1 -1
- package/release/index.js +2 -1
- package/schemas/nx-schema.json +182 -35
- package/schemas/project-schema.json +5 -0
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +3 -0
- package/src/command-line/add/add.js +6 -16
- package/src/command-line/affected/command-object.js +6 -6
- package/src/command-line/examples.js +0 -4
- package/src/command-line/exec/command-object.js +1 -1
- package/src/command-line/generate/generator-utils.js +8 -3
- package/src/command-line/import/import.js +1 -1
- package/src/command-line/init/command-object.js +18 -6
- package/src/command-line/init/configure-plugins.d.ts +6 -7
- package/src/command-line/init/configure-plugins.js +52 -38
- package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
- package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
- package/src/command-line/init/implementation/check-compatible-with-plugins.js +7 -1
- package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
- package/src/command-line/init/implementation/deduce-default-base.js +53 -0
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +32 -185
- package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
- package/src/command-line/init/implementation/utils.d.ts +6 -2
- package/src/command-line/init/implementation/utils.js +110 -45
- package/src/command-line/init/init-v1.js +1 -1
- package/src/command-line/init/init-v2.d.ts +1 -0
- package/src/command-line/init/init-v2.js +70 -39
- package/src/command-line/migrate/migrate-ui-api.d.ts +58 -0
- package/src/command-line/migrate/migrate-ui-api.js +227 -0
- package/src/command-line/migrate/migrate.d.ts +16 -3
- package/src/command-line/migrate/migrate.js +134 -101
- package/src/command-line/nx-commands.js +19 -5
- package/src/command-line/register/command-object.d.ts +6 -0
- package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
- package/src/command-line/register/register.d.ts +2 -0
- package/src/command-line/register/register.js +9 -0
- package/src/command-line/release/changelog.js +18 -15
- package/src/command-line/release/command-object.d.ts +8 -0
- package/src/command-line/release/command-object.js +9 -0
- package/src/command-line/release/config/config.d.ts +8 -7
- package/src/command-line/release/config/config.js +139 -45
- package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/src/command-line/release/config/use-legacy-versioning.js +9 -0
- package/src/command-line/release/index.d.ts +4 -0
- package/src/command-line/release/index.js +6 -1
- package/src/command-line/release/plan-check.js +6 -3
- package/src/command-line/release/plan.js +7 -3
- package/src/command-line/release/publish.js +7 -3
- package/src/command-line/release/release.js +8 -3
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
- package/src/command-line/release/utils/git.d.ts +3 -2
- package/src/command-line/release/utils/git.js +65 -9
- package/src/command-line/release/utils/github.js +3 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +8 -0
- package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
- package/src/command-line/release/utils/shared-legacy.js +2 -0
- package/src/command-line/release/utils/shared.d.ts +11 -17
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
- package/src/command-line/release/version/project-logger.d.ts +8 -0
- package/src/command-line/release/version/project-logger.js +45 -0
- package/src/command-line/release/version/release-group-processor.d.ts +252 -0
- package/src/command-line/release/version/release-group-processor.js +1057 -0
- package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
- package/src/command-line/release/version/resolve-current-version.js +241 -0
- package/src/command-line/release/version/test-utils.d.ts +93 -0
- package/src/command-line/release/version/test-utils.js +415 -0
- package/src/command-line/release/version/topological-sort.d.ts +9 -0
- package/src/command-line/release/version/topological-sort.js +41 -0
- package/src/command-line/release/version/version-actions.d.ts +171 -0
- package/src/command-line/release/version/version-actions.js +195 -0
- package/src/command-line/release/version-legacy.d.ts +46 -0
- package/src/command-line/release/version-legacy.js +453 -0
- package/src/command-line/release/version.d.ts +0 -40
- package/src/command-line/release/version.js +84 -262
- package/src/command-line/repair/repair.js +0 -1
- package/src/command-line/report/report.d.ts +7 -3
- package/src/command-line/report/report.js +52 -18
- package/src/command-line/run/command-object.js +2 -2
- package/src/command-line/run/executor-utils.d.ts +6 -1
- package/src/command-line/run/executor-utils.js +10 -1
- package/src/command-line/run/run.js +2 -2
- package/src/command-line/run-many/command-object.js +2 -2
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
- package/src/command-line/yargs-utils/shared-options.js +20 -0
- package/src/config/misc-interfaces.d.ts +11 -1
- package/src/config/nx-json.d.ts +160 -16
- package/src/config/project-graph.d.ts +4 -2
- package/src/config/project-graph.js +8 -0
- package/src/config/workspace-json-project-json.d.ts +2 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +2 -2
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +2 -0
- package/src/daemon/client/client.js +15 -0
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +9 -1
- package/src/daemon/message-types/hash-glob.d.ts +6 -0
- package/src/daemon/message-types/hash-glob.js +9 -1
- package/src/daemon/server/handle-glob.d.ts +1 -0
- package/src/daemon/server/handle-glob.js +8 -0
- package/src/daemon/server/handle-hash-glob.d.ts +1 -0
- package/src/daemon/server/handle-hash-glob.js +8 -0
- package/src/daemon/server/logger.js +2 -1
- package/src/daemon/server/server.js +7 -0
- package/src/devkit-internals.d.ts +3 -2
- package/src/devkit-internals.js +5 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +2 -5
- package/src/executors/run-commands/run-commands.impl.js +14 -42
- package/src/executors/run-commands/running-tasks.d.ts +9 -4
- package/src/executors/run-commands/running-tasks.js +103 -30
- package/src/executors/run-script/run-script.impl.js +4 -3
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
- package/src/generators/testing-utils/create-tree.js +5 -1
- package/src/migrations/{update-17-0-0/rm-default-collection-npm-scope.d.ts → update-21-0-0/release-version-config-changes.d.ts} +1 -1
- package/src/migrations/update-21-0-0/release-version-config-changes.js +111 -0
- package/src/native/index.d.ts +98 -19
- package/src/native/index.js +16 -2
- package/src/native/native-bindings.js +7 -0
- package/src/native/nx.wasi-browser.js +20 -19
- package/src/native/nx.wasi.cjs +20 -19
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/nx-cloud-tasks-runner-shell.js +3 -3
- package/src/plugins/js/lock-file/lock-file.js +28 -13
- package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/src/plugins/js/lock-file/utils/package-json.js +8 -6
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +3 -3
- package/src/plugins/js/lock-file/yarn-parser.js +85 -39
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +10 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +59 -6
- package/src/plugins/js/utils/packages.js +22 -3
- package/src/plugins/js/utils/register.js +1 -0
- package/src/plugins/js/utils/typescript.js +3 -3
- package/src/plugins/package-json/create-nodes.d.ts +1 -1
- package/src/plugins/package-json/create-nodes.js +4 -2
- package/src/project-graph/affected/locators/project-glob-changes.js +2 -2
- package/src/project-graph/error-types.js +32 -2
- package/src/project-graph/file-utils.d.ts +1 -10
- package/src/project-graph/file-utils.js +2 -77
- package/src/project-graph/nx-deps-cache.js +7 -2
- package/src/project-graph/plugins/get-plugins.js +2 -1
- package/src/project-graph/plugins/in-process-loader.js +1 -1
- package/src/project-graph/plugins/isolation/plugin-worker.js +12 -6
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +2 -1
- package/src/project-graph/plugins/loaded-nx-plugin.js +3 -7
- package/src/project-graph/plugins/public-api.d.ts +1 -1
- package/src/project-graph/plugins/utils.d.ts +2 -2
- package/src/project-graph/plugins/utils.js +2 -2
- package/src/project-graph/project-graph.js +5 -2
- package/src/project-graph/utils/project-configuration-utils.d.ts +3 -3
- package/src/project-graph/utils/project-configuration-utils.js +54 -21
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +1 -1
- package/src/project-graph/utils/retrieve-workspace-files.js +14 -18
- package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
- package/src/tasks-runner/batch/run-batch.js +3 -4
- package/src/tasks-runner/cache.d.ts +20 -6
- package/src/tasks-runner/cache.js +104 -20
- package/src/tasks-runner/create-task-graph.d.ts +0 -1
- package/src/tasks-runner/create-task-graph.js +11 -11
- package/src/tasks-runner/default-tasks-runner.js +5 -14
- package/src/tasks-runner/forked-process-task-runner.d.ts +8 -3
- package/src/tasks-runner/forked-process-task-runner.js +59 -46
- package/src/tasks-runner/init-tasks-runner.d.ts +15 -1
- package/src/tasks-runner/init-tasks-runner.js +62 -2
- package/src/tasks-runner/is-tui-enabled.d.ts +2 -0
- package/src/tasks-runner/is-tui-enabled.js +64 -0
- package/src/tasks-runner/life-cycle.d.ts +14 -3
- package/src/tasks-runner/life-cycle.js +37 -2
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +2 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +15 -7
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +5 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +35 -5
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.d.ts +18 -0
- package/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +229 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +10 -7
- package/src/tasks-runner/pseudo-terminal.js +37 -35
- package/src/tasks-runner/run-command.d.ts +4 -1
- package/src/tasks-runner/run-command.js +220 -42
- package/src/tasks-runner/running-tasks/node-child-process.js +4 -11
- package/src/tasks-runner/running-tasks/running-task.d.ts +3 -0
- package/src/tasks-runner/running-tasks/shared-running-task.d.ts +14 -0
- package/src/tasks-runner/running-tasks/shared-running-task.js +30 -0
- package/src/tasks-runner/task-env.d.ts +1 -4
- package/src/tasks-runner/task-env.js +2 -0
- package/src/tasks-runner/task-orchestrator.d.ts +26 -10
- package/src/tasks-runner/task-orchestrator.js +212 -57
- package/src/tasks-runner/tasks-runner.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.js +9 -0
- package/src/tasks-runner/utils.d.ts +2 -2
- package/src/tasks-runner/utils.js +18 -12
- package/src/utils/child-process.d.ts +4 -0
- package/src/utils/child-process.js +23 -30
- package/src/utils/command-line-utils.d.ts +1 -1
- package/src/utils/find-matching-projects.js +2 -2
- package/src/utils/git-utils.d.ts +1 -1
- package/src/utils/git-utils.js +8 -3
- package/src/utils/handle-errors.js +15 -0
- package/src/utils/is-ci.js +4 -1
- package/src/utils/is-using-prettier.d.ts +3 -0
- package/src/utils/is-using-prettier.js +62 -0
- package/src/utils/nx-key.d.ts +7 -0
- package/src/utils/nx-key.js +52 -0
- package/src/utils/package-json.d.ts +1 -1
- package/src/utils/package-json.js +16 -2
- package/src/utils/package-manager.js +2 -2
- package/src/utils/path.js +1 -1
- package/src/utils/require-nx-key.d.ts +1 -0
- package/src/utils/require-nx-key.js +22 -0
- package/src/utils/workspace-context.d.ts +2 -0
- package/src/utils/workspace-context.js +16 -0
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
- package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
- package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
- package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
- package/src/migrations/update-17-0-0/move-cache-directory.d.ts +0 -2
- package/src/migrations/update-17-0-0/move-cache-directory.js +0 -35
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +0 -72
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.d.ts +0 -2
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +0 -122
- package/src/migrations/update-17-2-0/move-default-base.d.ts +0 -5
- package/src/migrations/update-17-2-0/move-default-base.js +0 -21
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +0 -3
- package/src/migrations/update-17-3-0/nx-release-path.js +0 -47
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +0 -2
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +0 -11
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
@@ -1,61 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.writeCracoConfig = writeCracoConfig;
|
4
|
-
const fs_1 = require("fs");
|
5
|
-
function writeCracoConfig(appName, isCRA5, isStandalone) {
|
6
|
-
const configOverride = `
|
7
|
-
const path = require('path');
|
8
|
-
const TsConfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
9
|
-
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
10
|
-
module.exports = {
|
11
|
-
webpack: {
|
12
|
-
configure: (config) => {
|
13
|
-
// Remove guard against importing modules outside of \`src\`.
|
14
|
-
// Needed for workspace projects.
|
15
|
-
config.resolve.plugins = config.resolve.plugins.filter(
|
16
|
-
(plugin) => !(plugin instanceof ModuleScopePlugin)
|
17
|
-
);
|
18
|
-
// Add support for importing workspace projects.
|
19
|
-
config.resolve.plugins.push(
|
20
|
-
new TsConfigPathsPlugin({
|
21
|
-
configFile: path.resolve(__dirname, 'tsconfig.json'),
|
22
|
-
extensions: ['.ts', '.tsx', '.js', '.jsx'],
|
23
|
-
mainFields: ['browser', 'module', 'main'],
|
24
|
-
})
|
25
|
-
);
|
26
|
-
${isCRA5
|
27
|
-
? `
|
28
|
-
// Replace include option for babel loader with exclude
|
29
|
-
// so babel will handle workspace projects as well.
|
30
|
-
config.module.rules[1].oneOf.forEach((r) => {
|
31
|
-
if (r.loader && r.loader.indexOf('babel') !== -1) {
|
32
|
-
r.exclude = /node_modules/;
|
33
|
-
delete r.include;
|
34
|
-
}
|
35
|
-
});`
|
36
|
-
: `
|
37
|
-
// Replace include option for babel loader with exclude
|
38
|
-
// so babel will handle workspace projects as well.
|
39
|
-
config.module.rules.forEach((r) => {
|
40
|
-
if (r.oneOf) {
|
41
|
-
const babelLoader = r.oneOf.find(
|
42
|
-
(rr) => rr.loader.indexOf('babel-loader') !== -1
|
43
|
-
);
|
44
|
-
babelLoader.exclude = /node_modules/;
|
45
|
-
delete babelLoader.include;
|
46
|
-
}
|
47
|
-
});
|
48
|
-
`}
|
49
|
-
return config;
|
50
|
-
},
|
51
|
-
},
|
52
|
-
jest: {
|
53
|
-
configure: (config) => {
|
54
|
-
config.resolver = '@nx/jest/plugins/resolver';
|
55
|
-
return config;
|
56
|
-
},
|
57
|
-
},
|
58
|
-
};
|
59
|
-
`;
|
60
|
-
(0, fs_1.writeFileSync)(isStandalone ? 'craco.config.js' : `apps/${appName}/craco.config.js`, configOverride);
|
61
|
-
}
|
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = moveCacheDirectory;
|
4
|
-
const ignore_1 = require("ignore");
|
5
|
-
function moveCacheDirectory(tree) {
|
6
|
-
// If nx.json doesn't exist the repo can't utilize
|
7
|
-
// caching, so .nx/cache is less relevant. Lerna users
|
8
|
-
// that don't want to fully opt in to Nx at this time
|
9
|
-
// may also be caught off guard by the appearance of
|
10
|
-
// a .nx directory, so we are going to special case
|
11
|
-
// this for the time being.
|
12
|
-
if (tree.exists('lerna.json') && !tree.exists('nx.json')) {
|
13
|
-
return;
|
14
|
-
}
|
15
|
-
updateGitIgnore(tree);
|
16
|
-
if (tree.exists('.prettierignore')) {
|
17
|
-
const ignored = tree.read('.prettierignore', 'utf-8');
|
18
|
-
if (!ignored.includes('.nx/cache')) {
|
19
|
-
tree.write('.prettierignore', [ignored, '/.nx/cache'].join('\n'));
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
23
|
-
function updateGitIgnore(tree) {
|
24
|
-
const gitignore = tree.exists('.gitignore')
|
25
|
-
? tree.read('.gitignore', 'utf-8')
|
26
|
-
: '';
|
27
|
-
const ig = (0, ignore_1.default)();
|
28
|
-
ig.add(gitignore);
|
29
|
-
if (!ig.ignores('.nx/cache')) {
|
30
|
-
const updatedLines = gitignore.length
|
31
|
-
? [gitignore, '.nx/cache']
|
32
|
-
: ['.nx/cache'];
|
33
|
-
tree.write('.gitignore', updatedLines.join('\n'));
|
34
|
-
}
|
35
|
-
}
|
@@ -1,72 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = update;
|
4
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
5
|
-
const nx_json_1 = require("../../generators/utils/nx-json");
|
6
|
-
const json_1 = require("../../generators/utils/json");
|
7
|
-
const output_1 = require("../../utils/output");
|
8
|
-
const path_1 = require("../../utils/path");
|
9
|
-
async function update(tree) {
|
10
|
-
if (!tree.exists('nx.json')) {
|
11
|
-
return;
|
12
|
-
}
|
13
|
-
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
14
|
-
delete nxJson.cli?.['defaultCollection'];
|
15
|
-
if (nxJson?.cli && Object.keys(nxJson.cli).length < 1) {
|
16
|
-
delete nxJson.cli;
|
17
|
-
}
|
18
|
-
warnNpmScopeHasChanged(tree, nxJson);
|
19
|
-
delete nxJson['npmScope'];
|
20
|
-
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
21
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
22
|
-
}
|
23
|
-
function warnNpmScopeHasChanged(tree, nxJson) {
|
24
|
-
const originalScope = nxJson['npmScope'];
|
25
|
-
// There was no original scope
|
26
|
-
if (!originalScope) {
|
27
|
-
return false;
|
28
|
-
}
|
29
|
-
// package.json does not exist
|
30
|
-
if (!tree.exists('package.json')) {
|
31
|
-
return false;
|
32
|
-
}
|
33
|
-
const newScope = getNpmScopeFromPackageJson(tree);
|
34
|
-
// New and Original scope are the same.
|
35
|
-
if (originalScope === newScope) {
|
36
|
-
return false;
|
37
|
-
}
|
38
|
-
const packageJsonName = (0, json_1.readJson)(tree, 'package.json').name;
|
39
|
-
if (newScope) {
|
40
|
-
output_1.output.warn({
|
41
|
-
title: 'npmScope has been removed from nx.json',
|
42
|
-
bodyLines: [
|
43
|
-
'This will now be read from package.json',
|
44
|
-
`Old value which was in nx.json: ${originalScope}`,
|
45
|
-
`New value from package.json: ${newScope}`,
|
46
|
-
`Typescript path mappings for new libraries will now be generated as such: @${newScope}/new-lib instead of @${originalScope}/new-lib`,
|
47
|
-
`If you would like to change this back, change the name in package.json to ${packageJsonName.replace(newScope, originalScope)}`,
|
48
|
-
],
|
49
|
-
});
|
50
|
-
}
|
51
|
-
else {
|
52
|
-
// There is no scope in package.json
|
53
|
-
output_1.output.warn({
|
54
|
-
title: 'npmScope has been removed from nx.json',
|
55
|
-
bodyLines: [
|
56
|
-
'This will now be read from package.json',
|
57
|
-
`Old value which was in nx.json: ${originalScope}`,
|
58
|
-
`New value from package.json: null`,
|
59
|
-
`Typescript path mappings for new libraries will now be generated as such: new-lib instead of @${originalScope}/new-lib`,
|
60
|
-
`If you would like to change this back, change the name in package.json to ${(0, path_1.joinPathFragments)(`@${originalScope}`, packageJsonName)}`,
|
61
|
-
],
|
62
|
-
});
|
63
|
-
}
|
64
|
-
}
|
65
|
-
function getNpmScopeFromPackageJson(tree) {
|
66
|
-
const { name } = tree.exists('package.json')
|
67
|
-
? (0, json_1.readJson)(tree, 'package.json')
|
68
|
-
: { name: null };
|
69
|
-
if (name?.startsWith('@')) {
|
70
|
-
return name.split('/')[0].substring(1);
|
71
|
-
}
|
72
|
-
}
|
@@ -1,122 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = migrate;
|
4
|
-
const json_1 = require("../../generators/utils/json");
|
5
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
6
|
-
const nx_json_1 = require("../../generators/utils/nx-json");
|
7
|
-
const update_manager_1 = require("../../nx-cloud/update-manager");
|
8
|
-
const run_command_1 = require("../../tasks-runner/run-command");
|
9
|
-
const output_1 = require("../../utils/output");
|
10
|
-
async function migrate(tree) {
|
11
|
-
if (!tree.exists('nx.json')) {
|
12
|
-
return;
|
13
|
-
}
|
14
|
-
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
15
|
-
// Already migrated
|
16
|
-
if (!nxJson.tasksRunnerOptions?.default) {
|
17
|
-
return;
|
18
|
-
}
|
19
|
-
const nxCloudClientSupported = await isNxCloudClientSupported(nxJson);
|
20
|
-
(0, json_1.updateJson)(tree, 'nx.json', (nxJson) => {
|
21
|
-
const { runner, options } = nxJson.tasksRunnerOptions.default;
|
22
|
-
// This property shouldn't ever be part of tasks runner options.
|
23
|
-
if (options.useDaemonProcess !== undefined) {
|
24
|
-
nxJson.useDaemonProcess = options.useDaemonProcess;
|
25
|
-
delete options.useDaemonProcess;
|
26
|
-
}
|
27
|
-
// Remaining keys may be specific to a given runner, so leave them alone if there are multiple runners.
|
28
|
-
if (Object.keys(nxJson.tasksRunnerOptions ?? {}).length > 1) {
|
29
|
-
return nxJson;
|
30
|
-
}
|
31
|
-
// These options can only be moved for nx-cloud.
|
32
|
-
if (runner === 'nx-cloud' || runner === '@nrwl/nx-cloud') {
|
33
|
-
nxJson.nxCloudAccessToken = options.accessToken;
|
34
|
-
delete options.accessToken;
|
35
|
-
if (options.url) {
|
36
|
-
nxJson.nxCloudUrl = options.url;
|
37
|
-
delete options.url;
|
38
|
-
}
|
39
|
-
if (nxCloudClientSupported) {
|
40
|
-
removeNxCloudDependency(tree);
|
41
|
-
}
|
42
|
-
else {
|
43
|
-
options.useLightClient = false;
|
44
|
-
}
|
45
|
-
if (options.encryptionKey) {
|
46
|
-
nxJson.nxCloudEncryptionKey = options.encryptionKey;
|
47
|
-
delete options.encryptionKey;
|
48
|
-
}
|
49
|
-
}
|
50
|
-
// These options should be safe to move for all tasks runners:
|
51
|
-
if (options.parallel !== undefined) {
|
52
|
-
nxJson.parallel = options.parallel;
|
53
|
-
delete options.parallel;
|
54
|
-
}
|
55
|
-
if (options.cacheDirectory !== undefined) {
|
56
|
-
nxJson.cacheDirectory = options.cacheDirectory;
|
57
|
-
delete options.cacheDirectory;
|
58
|
-
}
|
59
|
-
if (Array.isArray(options.cacheableOperations)) {
|
60
|
-
nxJson.targetDefaults ??= {};
|
61
|
-
for (const target of options.cacheableOperations) {
|
62
|
-
nxJson.targetDefaults[target] ??= {};
|
63
|
-
nxJson.targetDefaults[target].cache ??= true;
|
64
|
-
}
|
65
|
-
delete options.cacheableOperations;
|
66
|
-
}
|
67
|
-
if (['nx-cloud', '@nrwl/nx-cloud', 'nx/tasks-runners/default'].includes(runner)) {
|
68
|
-
delete nxJson.tasksRunnerOptions.default.runner;
|
69
|
-
if (Object.values(options).length === 0) {
|
70
|
-
delete nxJson.tasksRunnerOptions;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
return nxJson;
|
74
|
-
});
|
75
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
76
|
-
}
|
77
|
-
async function isNxCloudClientSupported(nxJson) {
|
78
|
-
const nxCloudOptions = (0, run_command_1.getRunnerOptions)('default', nxJson, {}, true);
|
79
|
-
// Non enterprise workspaces support the Nx Cloud Client
|
80
|
-
if (!isNxCloudEnterpriseWorkspace(nxJson)) {
|
81
|
-
return true;
|
82
|
-
}
|
83
|
-
// If we can get the nx cloud client, it's supported
|
84
|
-
try {
|
85
|
-
await (0, update_manager_1.verifyOrUpdateNxCloudClient)(nxCloudOptions);
|
86
|
-
return true;
|
87
|
-
}
|
88
|
-
catch (e) {
|
89
|
-
if (e instanceof update_manager_1.NxCloudEnterpriseOutdatedError) {
|
90
|
-
output_1.output.warn({
|
91
|
-
title: 'Nx Cloud Instance is outdated.',
|
92
|
-
bodyLines: [
|
93
|
-
'If you are an Nx Enterprise customer, please reach out to your assigned Developer Productivity Engineer.',
|
94
|
-
'If you are NOT an Nx Enterprise customer but are seeing this message, please reach out to cloud-support@nrwl.io.',
|
95
|
-
],
|
96
|
-
});
|
97
|
-
}
|
98
|
-
return false;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
function isNxCloudEnterpriseWorkspace(nxJson) {
|
102
|
-
const { runner, options } = nxJson.tasksRunnerOptions.default;
|
103
|
-
return ((runner === 'nx-cloud' || runner === '@nrwl/nx-cloud') &&
|
104
|
-
options.url &&
|
105
|
-
![
|
106
|
-
'https://nx.app',
|
107
|
-
'https://cloud.nx.app',
|
108
|
-
'https://staging.nx.app',
|
109
|
-
'https://snapshot.nx.app',
|
110
|
-
].includes(options.url));
|
111
|
-
}
|
112
|
-
function removeNxCloudDependency(tree) {
|
113
|
-
if (tree.exists('package.json')) {
|
114
|
-
(0, json_1.updateJson)(tree, 'package.json', (packageJson) => {
|
115
|
-
delete packageJson.dependencies?.['nx-cloud'];
|
116
|
-
delete packageJson.devDependencies?.['nx-cloud'];
|
117
|
-
delete packageJson.dependencies?.['@nrwl/nx-cloud'];
|
118
|
-
delete packageJson.devDependencies?.['@nrwl/nx-cloud'];
|
119
|
-
return packageJson;
|
120
|
-
});
|
121
|
-
}
|
122
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = update;
|
4
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
5
|
-
const nx_json_1 = require("../../generators/utils/nx-json");
|
6
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
7
|
-
/**
|
8
|
-
* Updates existing workspaces to move nx.json's affected.defaultBase to nx.json's base.
|
9
|
-
*/
|
10
|
-
async function update(host) {
|
11
|
-
const nxJson = (0, nx_json_1.readNxJson)(host);
|
12
|
-
if (nxJson?.affected?.defaultBase) {
|
13
|
-
nxJson.defaultBase = nxJson.affected.defaultBase;
|
14
|
-
delete nxJson.affected.defaultBase;
|
15
|
-
if (Object.keys(nxJson.affected).length === 0) {
|
16
|
-
delete nxJson.affected;
|
17
|
-
}
|
18
|
-
(0, nx_json_1.updateNxJson)(host, nxJson);
|
19
|
-
}
|
20
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(host);
|
21
|
-
}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = nxReleasePath;
|
4
|
-
exports.visitNotIgnoredFiles = visitNotIgnoredFiles;
|
5
|
-
const node_path_1 = require("node:path");
|
6
|
-
const ignore_1 = require("../../utils/ignore");
|
7
|
-
function nxReleasePath(tree) {
|
8
|
-
visitNotIgnoredFiles(tree, '', (file) => {
|
9
|
-
const contents = tree.read(file).toString('utf-8');
|
10
|
-
if (
|
11
|
-
// the deep import usage should be replaced by the new location
|
12
|
-
contents.includes('nx/src/command-line/release') ||
|
13
|
-
// changelog-renderer has moved into nx/release
|
14
|
-
contents.includes('nx/changelog-renderer')) {
|
15
|
-
const finalContents = contents
|
16
|
-
// replace instances of old changelog renderer location
|
17
|
-
.replace(/nx\/changelog-renderer/g, 'nx/release/changelog-renderer')
|
18
|
-
// replace instances of deep import for programmatic API (only perform the replacement if an actual import by checking for trailing ' or ")
|
19
|
-
.replace(/nx\/src\/command-line\/release(['"])/g, 'nx/release$1');
|
20
|
-
tree.write(file, finalContents);
|
21
|
-
}
|
22
|
-
});
|
23
|
-
}
|
24
|
-
// Adapted from devkit
|
25
|
-
function visitNotIgnoredFiles(tree, dirPath = tree.root, visitor) {
|
26
|
-
const ig = (0, ignore_1.getIgnoreObject)();
|
27
|
-
dirPath = normalizePathRelativeToRoot(dirPath, tree.root);
|
28
|
-
if (dirPath !== '' && ig?.ignores(dirPath)) {
|
29
|
-
return;
|
30
|
-
}
|
31
|
-
for (const child of tree.children(dirPath)) {
|
32
|
-
const fullPath = (0, node_path_1.join)(dirPath, child);
|
33
|
-
if (ig?.ignores(fullPath)) {
|
34
|
-
continue;
|
35
|
-
}
|
36
|
-
if (tree.isFile(fullPath)) {
|
37
|
-
visitor(fullPath);
|
38
|
-
}
|
39
|
-
else {
|
40
|
-
visitNotIgnoredFiles(tree, fullPath, visitor);
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
44
|
-
// Copied from devkit
|
45
|
-
function normalizePathRelativeToRoot(path, root) {
|
46
|
-
return (0, node_path_1.relative)(root, (0, node_path_1.join)(root, path)).split(node_path_1.sep).join('/');
|
47
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = migrate;
|
4
|
-
const nx_json_1 = require("../../generators/utils/nx-json");
|
5
|
-
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
6
|
-
async function migrate(tree) {
|
7
|
-
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
8
|
-
nxJson.useInferencePlugins = false;
|
9
|
-
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
10
|
-
await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
|
11
|
-
}
|
package/src/utils/powerpack.d.ts
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
export declare function printPowerpackLicense(): Promise<void>;
|
2
|
-
export declare function getPowerpackLicenseInformation(): Promise<import("@nx/powerpack-license").PowerpackLicense>;
|
3
|
-
export declare class NxPowerpackNotInstalledError extends Error {
|
4
|
-
constructor(e: Error);
|
5
|
-
}
|
package/src/utils/powerpack.js
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.NxPowerpackNotInstalledError = void 0;
|
4
|
-
exports.printPowerpackLicense = printPowerpackLicense;
|
5
|
-
exports.getPowerpackLicenseInformation = getPowerpackLicenseInformation;
|
6
|
-
const logger_1 = require("./logger");
|
7
|
-
const package_manager_1 = require("./package-manager");
|
8
|
-
const workspace_root_1 = require("./workspace-root");
|
9
|
-
async function printPowerpackLicense() {
|
10
|
-
try {
|
11
|
-
const { organizationName, seatCount, workspaceCount } = await getPowerpackLicenseInformation();
|
12
|
-
logger_1.logger.log(`Nx Powerpack Licensed to ${organizationName} for ${seatCount} user${seatCount > 1 ? 's' : ''} in ${workspaceCount === 9999 ? 'an unlimited number of' : workspaceCount} workspace${workspaceCount > 1 ? 's' : ''}`);
|
13
|
-
}
|
14
|
-
catch { }
|
15
|
-
}
|
16
|
-
async function getPowerpackLicenseInformation() {
|
17
|
-
try {
|
18
|
-
const { getPowerpackLicenseInformation, getPowerpackLicenseInformationAsync, } = (await Promise.resolve().then(() => require('@nx/powerpack-license')));
|
19
|
-
return (getPowerpackLicenseInformationAsync ?? getPowerpackLicenseInformation)(workspace_root_1.workspaceRoot);
|
20
|
-
}
|
21
|
-
catch (e) {
|
22
|
-
if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
|
23
|
-
throw new NxPowerpackNotInstalledError(e);
|
24
|
-
}
|
25
|
-
throw e;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
class NxPowerpackNotInstalledError extends Error {
|
29
|
-
constructor(e) {
|
30
|
-
super(`The "@nx/powerpack-license" package is needed to use Nx Powerpack enabled features. Please install the @nx/powerpack-license with ${(0, package_manager_1.getPackageManagerCommand)().addDev} @nx/powerpack-license`, { cause: e });
|
31
|
-
}
|
32
|
-
}
|
33
|
-
exports.NxPowerpackNotInstalledError = NxPowerpackNotInstalledError;
|