nx 17.0.3 → 17.0.4
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/LICENSE +1 -1
- package/README.md +9 -4
- package/bin/init-local.js +10 -60
- package/bin/nx-cloud.js +6 -0
- package/bin/nx.js +1 -9
- package/bin/post-install.js +5 -1
- package/bin/run-executor.js +1 -1
- package/migrations.json +18 -0
- package/package.json +21 -18
- package/plugins/package-json.js +1 -1
- package/{changelog-renderer → release/changelog-renderer}/index.d.ts +18 -3
- package/{changelog-renderer → release/changelog-renderer}/index.js +78 -34
- package/release/index.d.ts +4 -0
- package/release/index.js +11 -0
- package/schemas/nx-schema.json +203 -19
- package/schemas/project-schema.json +20 -0
- package/src/adapter/angular-json.js +28 -18
- package/src/adapter/compat.d.ts +2 -2
- package/src/adapter/compat.js +6 -1
- package/src/adapter/ngcli-adapter.d.ts +16 -4
- package/src/adapter/ngcli-adapter.js +85 -28
- package/src/command-line/add/add.d.ts +2 -0
- package/src/command-line/add/add.js +169 -0
- package/src/command-line/add/command-object.d.ts +7 -0
- package/src/command-line/add/command-object.js +24 -0
- package/src/command-line/affected/affected.js +0 -3
- package/src/command-line/affected/command-object.d.ts +4 -4
- package/src/command-line/affected/command-object.js +53 -26
- package/src/command-line/affected/print-affected.js +10 -1
- package/src/command-line/connect/command-object.d.ts +1 -2
- package/src/command-line/connect/command-object.js +3 -7
- package/src/command-line/connect/connect-to-nx-cloud.d.ts +4 -5
- package/src/command-line/connect/connect-to-nx-cloud.js +43 -31
- package/src/command-line/connect/view-logs.js +5 -21
- package/src/command-line/examples.js +18 -0
- package/src/command-line/exec/command-object.js +2 -1
- package/src/command-line/exec/exec.d.ts +1 -1
- package/src/command-line/exec/exec.js +78 -35
- package/src/command-line/format/format.js +13 -4
- package/src/command-line/generate/generate.js +9 -9
- package/src/command-line/generate/generator-utils.d.ts +3 -2
- package/src/command-line/generate/generator-utils.js +5 -5
- package/src/command-line/graph/graph.d.ts +1 -1
- package/src/command-line/graph/graph.js +82 -37
- package/src/command-line/init/command-object.js +70 -43
- package/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +4 -2
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +11 -2
- package/src/command-line/init/implementation/add-nx-to-nest.d.ts +1 -1
- package/src/command-line/init/implementation/add-nx-to-nest.js +9 -6
- package/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +4 -2
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +14 -4
- package/src/command-line/init/implementation/angular/index.js +4 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +10 -5
- package/src/command-line/init/implementation/angular/standalone-workspace.js +1 -1
- package/src/command-line/init/implementation/angular/types.d.ts +1 -1
- package/src/command-line/init/implementation/dot-nx/nxw.js +47 -16
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +4 -2
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +4 -2
- package/src/command-line/init/implementation/utils.d.ts +5 -5
- package/src/command-line/init/implementation/utils.js +46 -44
- package/src/command-line/init/{init.js → init-v1.js} +5 -13
- package/src/command-line/init/init-v2.d.ts +7 -0
- package/src/command-line/init/init-v2.js +201 -0
- package/src/command-line/list/list.js +6 -5
- package/src/command-line/migrate/command-object.js +19 -4
- package/src/command-line/migrate/migrate.js +21 -17
- package/src/command-line/new/new.js +1 -1
- package/src/command-line/nx-commands.js +4 -1
- package/src/command-line/release/changelog.d.ts +22 -1
- package/src/command-line/release/changelog.js +459 -257
- package/src/command-line/release/command-object.d.ts +29 -7
- package/src/command-line/release/command-object.js +120 -20
- package/src/command-line/release/config/config.d.ts +26 -21
- package/src/command-line/release/config/config.js +416 -59
- package/src/command-line/release/config/conventional-commits.d.ts +2 -0
- package/src/command-line/release/config/conventional-commits.js +98 -0
- package/src/command-line/release/config/filter-release-groups.d.ts +1 -2
- package/src/command-line/release/config/filter-release-groups.js +38 -1
- package/src/command-line/release/index.d.ts +16 -0
- package/src/command-line/release/index.js +23 -0
- package/src/command-line/release/publish.d.ts +7 -3
- package/src/command-line/release/publish.js +89 -37
- package/src/command-line/release/release.d.ts +4 -0
- package/src/command-line/release/release.js +176 -0
- package/src/command-line/release/utils/batch-projects-by-generator-config.d.ts +7 -0
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +37 -0
- package/src/command-line/release/utils/exec-command.d.ts +1 -0
- package/src/command-line/release/utils/exec-command.js +34 -0
- package/src/command-line/release/utils/git.d.ts +34 -1
- package/src/command-line/release/utils/git.js +238 -34
- package/src/command-line/release/utils/github.d.ts +5 -5
- package/src/command-line/release/utils/github.js +155 -8
- package/src/command-line/release/utils/markdown.js +6 -1
- package/src/command-line/release/utils/print-changes.d.ts +1 -1
- package/src/command-line/release/utils/print-changes.js +3 -3
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +4 -0
- package/src/command-line/release/utils/resolve-semver-specifier.js +58 -0
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +30 -1
- package/src/command-line/release/utils/shared.d.ts +39 -0
- package/src/command-line/release/utils/shared.js +213 -0
- package/src/command-line/release/version.d.ts +37 -3
- package/src/command-line/release/version.js +312 -117
- package/src/command-line/repair/repair.js +13 -9
- package/src/command-line/report/report.js +2 -2
- package/src/command-line/run/command-object.d.ts +4 -0
- package/src/command-line/run/command-object.js +18 -2
- package/src/command-line/run/executor-utils.d.ts +2 -1
- package/src/command-line/run/executor-utils.js +4 -4
- package/src/command-line/run/run-one.js +3 -6
- package/src/command-line/run/run.js +34 -9
- package/src/command-line/run-many/command-object.js +4 -1
- package/src/command-line/run-many/run-many.js +0 -3
- package/src/command-line/show/command-object.d.ts +3 -0
- package/src/command-line/show/command-object.js +29 -2
- package/src/command-line/show/show.js +9 -0
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -1
- package/src/command-line/yargs-utils/shared-options.js +23 -9
- package/src/commands-runner/command-graph.d.ts +13 -0
- package/src/commands-runner/command-graph.js +2 -0
- package/src/commands-runner/create-command-graph.d.ts +4 -0
- package/src/commands-runner/create-command-graph.js +44 -0
- package/src/commands-runner/get-command-projects.d.ts +3 -0
- package/src/commands-runner/get-command-projects.js +19 -0
- package/src/config/nx-json.d.ts +160 -25
- package/src/config/project-graph.d.ts +3 -3
- package/src/config/workspace-json-project-json.d.ts +11 -1
- package/src/config/workspaces.d.ts +1 -1
- package/src/config/workspaces.js +4 -6
- package/src/core/graph/3rdpartylicenses.txt +144 -74
- package/src/core/graph/environment.js +1 -1
- package/src/core/graph/index.html +4 -6
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +3 -3
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +5 -1
- package/src/daemon/client/client.js +27 -8
- package/src/daemon/client/{socket-messenger.d.ts → daemon-socket-messenger.d.ts} +1 -1
- package/src/daemon/client/{socket-messenger.js → daemon-socket-messenger.js} +3 -3
- package/src/daemon/daemon-project-graph-error.d.ts +8 -0
- package/src/daemon/daemon-project-graph-error.js +13 -0
- package/src/daemon/server/handle-hash-tasks.js +12 -2
- package/src/daemon/server/handle-request-project-graph.js +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts +14 -13
- package/src/daemon/server/project-graph-incremental-recomputation.js +98 -33
- package/src/daemon/server/shutdown-utils.js +2 -4
- package/src/daemon/server/watcher.js +0 -3
- package/src/daemon/socket-utils.d.ts +2 -1
- package/src/daemon/socket-utils.js +15 -4
- package/src/daemon/tmp-dir.d.ts +1 -0
- package/src/daemon/tmp-dir.js +4 -4
- package/src/devkit-exports.d.ts +2 -2
- package/src/devkit-exports.js +3 -2
- package/src/devkit-internals.d.ts +3 -0
- package/src/devkit-internals.js +7 -1
- package/src/executors/noop/schema.json +1 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +10 -2
- package/src/executors/run-commands/run-commands.impl.js +152 -48
- package/src/executors/run-commands/schema.json +11 -1
- package/src/executors/run-script/run-script.impl.js +43 -11
- package/src/executors/utils/convert-nx-executor.js +1 -1
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +3 -1
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +4 -2
- package/src/generators/testing-utils/create-tree-with-empty-workspace.js +0 -6
- package/src/generators/tree.d.ts +1 -0
- package/src/generators/utils/glob.js +2 -2
- package/src/generators/utils/project-configuration.js +28 -9
- package/src/hasher/create-task-hasher.d.ts +4 -0
- package/src/hasher/create-task-hasher.js +16 -0
- package/src/hasher/hash-task.js +9 -3
- package/src/hasher/native-task-hasher-impl.d.ts +19 -0
- package/src/hasher/native-task-hasher-impl.js +37 -0
- package/src/hasher/node-task-hasher-impl.d.ts +49 -0
- package/src/hasher/node-task-hasher-impl.js +431 -0
- package/src/hasher/task-hasher.d.ts +33 -21
- package/src/hasher/task-hasher.js +30 -428
- package/src/migrations/update-15-0-0/migrate-to-inputs.js +5 -5
- package/src/migrations/update-15-1-0/set-project-names.js +2 -1
- package/src/migrations/update-15-8-2/update-nxw.js +2 -6
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +49 -13
- package/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
- package/src/migrations/update-17-2-0/move-default-base.js +21 -0
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +3 -0
- package/src/migrations/update-17-3-0/nx-release-path.js +48 -0
- package/src/migrations/update-17-3-0/update-nxw.d.ts +2 -0
- package/src/migrations/update-17-3-0/update-nxw.js +7 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +2 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +9 -0
- package/src/native/index.d.ts +65 -15
- package/src/native/index.js +6 -2
- package/src/native/transform-objects.js +2 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +13 -12
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +6 -1
- package/src/nx-cloud/update-manager.js +2 -1
- package/src/plugins/js/index.d.ts +1 -1
- package/src/plugins/js/index.js +3 -3
- package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
- package/src/plugins/js/lock-file/lock-file.js +15 -3
- package/src/plugins/js/package-json/create-package-json.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +1 -1
- package/src/plugins/js/utils/register.d.ts +1 -1
- package/src/plugins/js/utils/register.js +28 -8
- package/src/plugins/js/versions.d.ts +1 -1
- package/src/plugins/js/versions.js +1 -1
- package/{plugins/package-json-workspaces.d.ts → src/plugins/package-json-workspaces/create-nodes.d.ts} +4 -4
- package/{plugins/package-json-workspaces.js → src/plugins/package-json-workspaces/create-nodes.js} +34 -12
- package/src/plugins/package-json-workspaces/index.d.ts +1 -0
- package/src/plugins/package-json-workspaces/index.js +4 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +47 -0
- package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -5
- package/src/plugins/project-json/build-nodes/project-json.js +6 -44
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +66 -0
- package/src/plugins/target-defaults/target-defaults-plugin.js +182 -0
- package/src/project-graph/affected/locators/project-glob-changes.js +3 -3
- package/src/project-graph/affected/locators/workspace-projects.d.ts +0 -2
- package/src/project-graph/affected/locators/workspace-projects.js +16 -29
- package/src/project-graph/build-project-graph.d.ts +20 -1
- package/src/project-graph/build-project-graph.js +91 -33
- package/src/project-graph/file-map-utils.d.ts +9 -5
- package/src/project-graph/file-map-utils.js +16 -63
- package/src/project-graph/file-utils.d.ts +1 -1
- package/src/project-graph/file-utils.js +44 -2
- package/src/project-graph/nx-deps-cache.js +1 -1
- package/src/project-graph/project-graph-builder.d.ts +1 -1
- package/src/project-graph/project-graph-builder.js +1 -1
- package/src/project-graph/project-graph.d.ts +32 -1
- package/src/project-graph/project-graph.js +147 -23
- package/src/project-graph/utils/build-all-workspace-files.d.ts +2 -0
- package/src/project-graph/utils/build-all-workspace-files.js +15 -0
- package/src/project-graph/utils/normalize-project-nodes.d.ts +2 -3
- package/src/project-graph/utils/normalize-project-nodes.js +7 -33
- package/src/project-graph/utils/project-configuration-utils.d.ts +66 -4
- package/src/project-graph/utils/project-configuration-utils.js +503 -62
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +12 -31
- package/src/project-graph/utils/retrieve-workspace-files.js +27 -90
- package/src/tasks-runner/batch/run-batch.js +3 -3
- package/src/tasks-runner/cache.js +6 -3
- package/src/tasks-runner/create-task-graph.js +1 -1
- package/src/tasks-runner/fork.d.ts +1 -0
- package/src/tasks-runner/fork.js +23 -0
- package/src/tasks-runner/forked-process-task-runner.d.ts +13 -5
- package/src/tasks-runner/forked-process-task-runner.js +111 -21
- package/src/tasks-runner/init-tasks-runner.js +1 -1
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +28 -28
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +19 -22
- package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +1 -3
- package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +1 -3
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +2 -4
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +11 -5
- package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -1
- package/src/tasks-runner/pseudo-ipc.d.ts +49 -0
- package/src/tasks-runner/pseudo-ipc.js +140 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +43 -0
- package/src/tasks-runner/pseudo-terminal.js +159 -0
- package/src/tasks-runner/run-command.d.ts +1 -1
- package/src/tasks-runner/run-command.js +13 -19
- package/src/tasks-runner/task-env.js +1 -2
- package/src/tasks-runner/task-graph-utils.d.ts +7 -3
- package/src/tasks-runner/task-graph-utils.js +15 -15
- package/src/tasks-runner/task-orchestrator.js +66 -12
- package/src/tasks-runner/tasks-schedule.js +3 -3
- package/src/tasks-runner/utils.d.ts +16 -7
- package/src/tasks-runner/utils.js +30 -16
- package/src/utils/ab-testing.d.ts +36 -2
- package/src/utils/ab-testing.js +34 -16
- package/src/utils/assert-workspace-validity.js +1 -1
- package/src/utils/cache-directory.d.ts +1 -0
- package/src/utils/cache-directory.js +5 -1
- package/src/utils/child-process.d.ts +15 -1
- package/src/utils/child-process.js +91 -1
- package/src/utils/command-line-utils.js +2 -1
- package/src/utils/exit-codes.d.ts +6 -0
- package/src/utils/exit-codes.js +20 -0
- package/src/utils/fileutils.d.ts +1 -0
- package/src/utils/find-matching-projects.js +5 -5
- package/src/utils/find-workspace-root.js +1 -0
- package/src/utils/ignore.js +8 -1
- package/src/utils/json-diff.d.ts +1 -0
- package/src/utils/json-diff.js +2 -1
- package/src/utils/json.js +3 -1
- package/src/utils/logger.js +1 -1
- package/src/utils/nx-cloud-utils.d.ts +1 -1
- package/src/utils/nx-cloud-utils.js +9 -4
- package/src/utils/nx-plugin.d.ts +32 -15
- package/src/utils/nx-plugin.deprecated.d.ts +10 -5
- package/src/utils/nx-plugin.deprecated.js +23 -0
- package/src/utils/nx-plugin.js +71 -80
- package/src/utils/output.d.ts +4 -2
- package/src/utils/output.js +44 -9
- package/src/utils/package-json.d.ts +4 -4
- package/src/utils/package-json.js +18 -12
- package/src/utils/package-manager.d.ts +7 -0
- package/src/utils/package-manager.js +24 -4
- package/src/utils/params.d.ts +12 -4
- package/src/utils/params.js +37 -4
- package/src/utils/plugins/core-plugins.js +8 -0
- package/src/utils/plugins/installed-plugins.d.ts +2 -1
- package/src/utils/plugins/installed-plugins.js +2 -2
- package/src/utils/plugins/local-plugins.js +1 -1
- package/src/utils/plugins/plugin-capabilities.d.ts +3 -2
- package/src/utils/plugins/plugin-capabilities.js +7 -7
- package/src/utils/typescript.js +1 -1
- package/src/utils/update-nxw.d.ts +2 -0
- package/src/utils/update-nxw.js +12 -0
- package/src/utils/workspace-configuration-check.js +1 -1
- package/src/utils/workspace-context.d.ts +6 -4
- package/src/utils/workspace-context.js +19 -9
- package/src/core/graph/polyfills.js +0 -1
- /package/src/command-line/init/{init.d.ts → init-v1.d.ts} +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
<p style="text-align: center;"
|
|
1
|
+
<p style="text-align: center;">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
+
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
8
|
<div style="text-align: center;">
|
|
4
9
|
|
|
@@ -15,9 +20,9 @@
|
|
|
15
20
|
|
|
16
21
|
<hr>
|
|
17
22
|
|
|
18
|
-
# Nx: Smart
|
|
23
|
+
# Nx: Smart Monorepos · Fast CI
|
|
19
24
|
|
|
20
|
-
Nx is a
|
|
25
|
+
Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
|
|
21
26
|
|
|
22
27
|
## Getting Started
|
|
23
28
|
|
|
@@ -57,5 +62,5 @@ npx nx@latest init
|
|
|
57
62
|
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
58
63
|
|
|
59
64
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
60
|
-
width="100%" alt="Nx - Smart
|
|
65
|
+
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
|
61
66
|
|
package/bin/init-local.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rewriteTargetsAndProjects = exports.initLocal = void 0;
|
|
4
4
|
const perf_hooks_1 = require("perf_hooks");
|
|
5
|
-
const child_process_1 = require("child_process");
|
|
6
|
-
const package_manager_1 = require("../src/utils/package-manager");
|
|
7
5
|
const nx_commands_1 = require("../src/command-line/nx-commands");
|
|
8
6
|
const strip_indents_1 = require("../src/utils/strip-indents");
|
|
9
7
|
const Mod = require("module");
|
|
@@ -39,8 +37,7 @@ function initLocal(workspace) {
|
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
else {
|
|
42
|
-
|
|
43
|
-
nx_commands_1.commandsObject.parse(newArgs);
|
|
40
|
+
nx_commands_1.commandsObject.parse(process.argv.slice(2));
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
43
|
catch (e) {
|
|
@@ -80,38 +77,6 @@ function rewriteTargetsAndProjects(args) {
|
|
|
80
77
|
return newArgs;
|
|
81
78
|
}
|
|
82
79
|
exports.rewriteTargetsAndProjects = rewriteTargetsAndProjects;
|
|
83
|
-
function rewritePositionalArguments(args) {
|
|
84
|
-
const relevantPositionalArgs = [];
|
|
85
|
-
const rest = [];
|
|
86
|
-
for (let i = 2; i < args.length; i++) {
|
|
87
|
-
if (args[i] === '--') {
|
|
88
|
-
rest.push(...args.slice(i + 1));
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
else if (!args[i].startsWith('-')) {
|
|
92
|
-
relevantPositionalArgs.push(args[i]);
|
|
93
|
-
if (relevantPositionalArgs.length === 2) {
|
|
94
|
-
rest.push(...args.slice(i + 1));
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
rest.push(args[i]);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (relevantPositionalArgs.length === 1) {
|
|
103
|
-
return [
|
|
104
|
-
'run',
|
|
105
|
-
`${wrapIntoQuotesIfNeeded(relevantPositionalArgs[0])}`,
|
|
106
|
-
...rest,
|
|
107
|
-
];
|
|
108
|
-
}
|
|
109
|
-
return [
|
|
110
|
-
'run',
|
|
111
|
-
`${relevantPositionalArgs[1]}:${wrapIntoQuotesIfNeeded(relevantPositionalArgs[0])}`,
|
|
112
|
-
...rest,
|
|
113
|
-
];
|
|
114
|
-
}
|
|
115
80
|
function wrapIntoQuotesIfNeeded(arg) {
|
|
116
81
|
return arg.indexOf(':') > -1 ? `"${arg}"` : arg;
|
|
117
82
|
}
|
|
@@ -135,12 +100,12 @@ function isKnownCommand(command) {
|
|
|
135
100
|
function shouldDelegateToAngularCLI() {
|
|
136
101
|
const command = process.argv[2];
|
|
137
102
|
const commands = [
|
|
138
|
-
'add',
|
|
139
103
|
'analytics',
|
|
104
|
+
'cache',
|
|
105
|
+
'completion',
|
|
140
106
|
'config',
|
|
141
107
|
'doc',
|
|
142
108
|
'update',
|
|
143
|
-
'completion',
|
|
144
109
|
];
|
|
145
110
|
return commands.indexOf(command) > -1;
|
|
146
111
|
}
|
|
@@ -157,36 +122,21 @@ function handleAngularCLIFallbacks(workspace) {
|
|
|
157
122
|
console.log(`Running "ng update" can still be useful in some dev workflows, so we aren't planning to remove it.`);
|
|
158
123
|
console.log(`If you need to use it, run "FORCE_NG_UPDATE=true ng update".`);
|
|
159
124
|
}
|
|
160
|
-
else if (process.argv[2] === 'add') {
|
|
161
|
-
console.log('Ng add is not natively supported by Nx');
|
|
162
|
-
const pkg = process.argv[2] === 'add' ? process.argv[3] : process.argv[4];
|
|
163
|
-
if (!pkg) {
|
|
164
|
-
process.exit(1);
|
|
165
|
-
}
|
|
166
|
-
const pm = (0, package_manager_1.getPackageManagerCommand)();
|
|
167
|
-
const cmd = `${pm.add} ${pkg} && ${pm.exec} nx g ${pkg}:ng-add`;
|
|
168
|
-
console.log(`Instead, we recommend running \`${cmd}\``);
|
|
169
|
-
Promise.resolve().then(() => require('enquirer')).then((x) => x
|
|
170
|
-
.prompt({
|
|
171
|
-
name: 'c',
|
|
172
|
-
type: 'confirm',
|
|
173
|
-
message: 'Run this command?',
|
|
174
|
-
})
|
|
175
|
-
.then(({ c }) => {
|
|
176
|
-
if (c) {
|
|
177
|
-
(0, child_process_1.execSync)(cmd, { stdio: 'inherit' });
|
|
178
|
-
}
|
|
179
|
-
}));
|
|
180
|
-
}
|
|
181
125
|
else if (process.argv[2] === 'completion') {
|
|
182
126
|
if (!process.argv[3]) {
|
|
183
127
|
console.log(`"ng completion" is not natively supported by Nx.
|
|
184
128
|
Instead, you could try an Nx Editor Plugin for a visual tool to run Nx commands. If you're using VSCode, you can use the Nx Console plugin, or if you're using WebStorm, you could use one of the available community plugins.
|
|
185
|
-
For more information, see https://nx.dev/
|
|
129
|
+
For more information, see https://nx.dev/getting-started/editor-setup`);
|
|
186
130
|
}
|
|
187
131
|
}
|
|
132
|
+
else if (process.argv[2] === 'cache') {
|
|
133
|
+
console.log(`"ng cache" is not natively supported by Nx.
|
|
134
|
+
To clear the cache, you can delete the ".angular/cache" directory (or the directory configured by "cli.cache.path" in the "nx.json" file).
|
|
135
|
+
To update the cache configuration, you can directly update the relevant options in your "nx.json" file (https://angular.io/guide/workspace-config#cache-options).`);
|
|
136
|
+
}
|
|
188
137
|
else {
|
|
189
138
|
try {
|
|
139
|
+
// nx-ignore-next-line
|
|
190
140
|
const cli = require.resolve('@angular/cli/lib/init.js', {
|
|
191
141
|
paths: [workspace.dir],
|
|
192
142
|
});
|
package/bin/nx-cloud.js
CHANGED
|
@@ -35,6 +35,12 @@ async function invokeCommandWithNxCloudClient(options) {
|
|
|
35
35
|
catch (e) {
|
|
36
36
|
const body = ['Cannot run commands from the `nx-cloud` CLI.'];
|
|
37
37
|
if (e instanceof update_manager_1.NxCloudEnterpriseOutdatedError) {
|
|
38
|
+
try {
|
|
39
|
+
// TODO: Remove this when all enterprise customers have updated.
|
|
40
|
+
// Try requiring the bin from the `nx-cloud` package.
|
|
41
|
+
return require('nx-cloud/bin/nx-cloud');
|
|
42
|
+
}
|
|
43
|
+
catch { }
|
|
38
44
|
body.push('If you are an Nx Enterprise customer, please reach out to your assigned Developer Productivity Engineer.', 'If you are NOT an Nx Enterprise customer but are seeing this message, please reach out to cloud-support@nrwl.io.');
|
|
39
45
|
}
|
|
40
46
|
if (e instanceof update_manager_1.NxCloudClientUnavailableError) {
|
package/bin/nx.js
CHANGED
|
@@ -38,15 +38,6 @@ function main() {
|
|
|
38
38
|
require('nx/src/command-line/nx-commands').commandsObject.argv;
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
// v8-compile-cache doesn't support ESM. Attempting to import ESM
|
|
42
|
-
// with it enabled results in an error that reads "Invalid host options".
|
|
43
|
-
//
|
|
44
|
-
// Angular CLI, and prettier both use ESM so we need to disable it in these cases.
|
|
45
|
-
if (workspace &&
|
|
46
|
-
workspace.type === 'nx' &&
|
|
47
|
-
!['format', 'format:check', 'format:write', 'g', 'generate'].some((cmd) => process.argv[2] === cmd)) {
|
|
48
|
-
require('v8-compile-cache');
|
|
49
|
-
}
|
|
50
41
|
if (!client_1.daemonClient.enabled() && workspace !== null) {
|
|
51
42
|
(0, workspace_context_1.setupWorkspaceContext)(workspace.dir);
|
|
52
43
|
}
|
|
@@ -156,6 +147,7 @@ function resolveNx(workspace) {
|
|
|
156
147
|
catch {
|
|
157
148
|
// TODO(v17): Remove this
|
|
158
149
|
// fallback for old CLI install setup
|
|
150
|
+
// nx-ignore-next-line
|
|
159
151
|
return require.resolve('@nrwl/cli/bin/nx.js', {
|
|
160
152
|
paths: [workspace ? workspace.dir : globalsRoot],
|
|
161
153
|
});
|
package/bin/post-install.js
CHANGED
|
@@ -10,8 +10,10 @@ const update_manager_1 = require("../src/nx-cloud/update-manager");
|
|
|
10
10
|
const get_cloud_options_1 = require("../src/nx-cloud/utilities/get-cloud-options");
|
|
11
11
|
const nx_cloud_utils_1 = require("../src/utils/nx-cloud-utils");
|
|
12
12
|
const nx_json_1 = require("../src/config/nx-json");
|
|
13
|
+
const workspace_context_1 = require("../src/utils/workspace-context");
|
|
13
14
|
(async () => {
|
|
14
15
|
try {
|
|
16
|
+
(0, workspace_context_1.setupWorkspaceContext)(workspace_root_1.workspaceRoot);
|
|
15
17
|
if (isMainNxPackage() && (0, fileutils_1.fileExists)((0, path_1.join)(workspace_root_1.workspaceRoot, 'nx.json'))) {
|
|
16
18
|
const b = new Date();
|
|
17
19
|
(0, assert_supported_platform_1.assertSupportedPlatform)();
|
|
@@ -19,7 +21,9 @@ const nx_json_1 = require("../src/config/nx-json");
|
|
|
19
21
|
await client_1.daemonClient.stop();
|
|
20
22
|
}
|
|
21
23
|
catch (e) { }
|
|
22
|
-
const tasks = [
|
|
24
|
+
const tasks = [
|
|
25
|
+
(0, project_graph_1.buildProjectGraphAndSourceMapsWithoutDaemon)(),
|
|
26
|
+
];
|
|
23
27
|
if ((0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())) {
|
|
24
28
|
tasks.push((0, update_manager_1.verifyOrUpdateNxCloudClient)((0, get_cloud_options_1.getCloudOptions)()));
|
|
25
29
|
}
|
package/bin/run-executor.js
CHANGED
package/migrations.json
CHANGED
|
@@ -76,6 +76,24 @@
|
|
|
76
76
|
"version": "17.0.0-rc.1",
|
|
77
77
|
"description": "Migration for v17.0.0-rc.1",
|
|
78
78
|
"implementation": "./src/migrations/update-17-0-0/rm-default-collection-npm-scope"
|
|
79
|
+
},
|
|
80
|
+
"17.3.0-update-nx-wrapper": {
|
|
81
|
+
"cli": "nx",
|
|
82
|
+
"version": "17.3.0-beta.6",
|
|
83
|
+
"description": "Updates the nx wrapper.",
|
|
84
|
+
"implementation": "./src/migrations/update-17-3-0/update-nxw"
|
|
85
|
+
},
|
|
86
|
+
"18.0.0-disable-adding-plugins-for-existing-workspaces": {
|
|
87
|
+
"cli": "nx",
|
|
88
|
+
"version": "18.0.0-beta.2",
|
|
89
|
+
"description": "Updates nx.json to disabled adding plugins when generating projects in an existing Nx workspace",
|
|
90
|
+
"implementation": "./src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces",
|
|
91
|
+
"x-repair-skip": true
|
|
92
|
+
},
|
|
93
|
+
"move-default-base-to-nx-json-root": {
|
|
94
|
+
"version": "18.1.0-beta.3",
|
|
95
|
+
"description": "Moves affected.defaultBase to defaultBase in `nx.json`",
|
|
96
|
+
"implementation": "./src/migrations/update-17-2-0/move-default-base"
|
|
79
97
|
}
|
|
80
98
|
}
|
|
81
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.4",
|
|
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": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
37
37
|
"@yarnpkg/parsers": "3.0.0-rc.46",
|
|
38
38
|
"@zkochan/js-yaml": "0.0.6",
|
|
39
|
-
"axios": "^1.
|
|
39
|
+
"axios": "^1.6.0",
|
|
40
40
|
"chalk": "^4.1.0",
|
|
41
41
|
"cli-cursor": "3.1.0",
|
|
42
42
|
"cli-spinners": "2.6.1",
|
|
@@ -47,30 +47,29 @@
|
|
|
47
47
|
"figures": "3.2.0",
|
|
48
48
|
"flat": "^5.0.2",
|
|
49
49
|
"fs-extra": "^11.1.0",
|
|
50
|
-
"glob": "7.1.4",
|
|
51
50
|
"ignore": "^5.0.4",
|
|
52
51
|
"jest-diff": "^29.4.1",
|
|
53
52
|
"js-yaml": "4.1.0",
|
|
54
53
|
"jsonc-parser": "3.2.0",
|
|
55
54
|
"lines-and-columns": "~2.0.3",
|
|
56
|
-
"minimatch": "
|
|
55
|
+
"minimatch": "9.0.3",
|
|
57
56
|
"npm-run-path": "^4.0.1",
|
|
58
57
|
"open": "^8.4.0",
|
|
59
|
-
"semver": "7.5.3",
|
|
58
|
+
"semver": "^7.5.3",
|
|
60
59
|
"string-width": "^4.2.3",
|
|
61
60
|
"strong-log-transformer": "^2.1.0",
|
|
62
61
|
"tar-stream": "~2.2.0",
|
|
63
62
|
"tmp": "~0.2.1",
|
|
64
63
|
"tsconfig-paths": "^4.1.2",
|
|
65
64
|
"tslib": "^2.3.0",
|
|
66
|
-
"v8-compile-cache": "2.3.0",
|
|
67
65
|
"yargs": "^17.6.2",
|
|
68
66
|
"yargs-parser": "21.1.1",
|
|
69
67
|
"node-machine-id": "1.1.12",
|
|
70
|
-
"
|
|
68
|
+
"ora": "5.3.0",
|
|
69
|
+
"@nrwl/tao": "17.0.4"
|
|
71
70
|
},
|
|
72
71
|
"peerDependencies": {
|
|
73
|
-
"@swc-node/register": "^1.
|
|
72
|
+
"@swc-node/register": "^1.8.0",
|
|
74
73
|
"@swc/core": "^1.3.85"
|
|
75
74
|
},
|
|
76
75
|
"peerDependenciesMeta": {
|
|
@@ -82,16 +81,16 @@
|
|
|
82
81
|
}
|
|
83
82
|
},
|
|
84
83
|
"optionalDependencies": {
|
|
85
|
-
"@nx/nx-darwin-x64": "17.0.
|
|
86
|
-
"@nx/nx-darwin-arm64": "17.0.
|
|
87
|
-
"@nx/nx-linux-x64-gnu": "17.0.
|
|
88
|
-
"@nx/nx-linux-x64-musl": "17.0.
|
|
89
|
-
"@nx/nx-win32-x64-msvc": "17.0.
|
|
90
|
-
"@nx/nx-linux-arm64-gnu": "17.0.
|
|
91
|
-
"@nx/nx-linux-arm64-musl": "17.0.
|
|
92
|
-
"@nx/nx-linux-arm-gnueabihf": "17.0.
|
|
93
|
-
"@nx/nx-win32-arm64-msvc": "17.0.
|
|
94
|
-
"@nx/nx-freebsd-x64": "17.0.
|
|
84
|
+
"@nx/nx-darwin-x64": "17.0.4",
|
|
85
|
+
"@nx/nx-darwin-arm64": "17.0.4",
|
|
86
|
+
"@nx/nx-linux-x64-gnu": "17.0.4",
|
|
87
|
+
"@nx/nx-linux-x64-musl": "17.0.4",
|
|
88
|
+
"@nx/nx-win32-x64-msvc": "17.0.4",
|
|
89
|
+
"@nx/nx-linux-arm64-gnu": "17.0.4",
|
|
90
|
+
"@nx/nx-linux-arm64-musl": "17.0.4",
|
|
91
|
+
"@nx/nx-linux-arm-gnueabihf": "17.0.4",
|
|
92
|
+
"@nx/nx-win32-arm64-msvc": "17.0.4",
|
|
93
|
+
"@nx/nx-freebsd-x64": "17.0.4"
|
|
95
94
|
},
|
|
96
95
|
"nx-migrations": {
|
|
97
96
|
"migrations": "./migrations.json",
|
|
@@ -121,12 +120,14 @@
|
|
|
121
120
|
"@nrwl/expo",
|
|
122
121
|
"@nx/express",
|
|
123
122
|
"@nrwl/express",
|
|
123
|
+
"@nx/gradle",
|
|
124
124
|
"@nx/nest",
|
|
125
125
|
"@nrwl/nest",
|
|
126
126
|
"@nx/next",
|
|
127
127
|
"@nrwl/next",
|
|
128
128
|
"@nx/node",
|
|
129
129
|
"@nrwl/node",
|
|
130
|
+
"@nx/nuxt",
|
|
130
131
|
"@nx/playwright",
|
|
131
132
|
"@nx/plugin",
|
|
132
133
|
"@nrwl/nx-plugin",
|
|
@@ -136,6 +137,8 @@
|
|
|
136
137
|
"@nrwl/react-native",
|
|
137
138
|
"@nx/rollup",
|
|
138
139
|
"@nrwl/rollup",
|
|
140
|
+
"@nx/remix",
|
|
141
|
+
"@nrwl/remix",
|
|
139
142
|
"@nx/storybook",
|
|
140
143
|
"@nrwl/storybook",
|
|
141
144
|
"@nrwl/tao",
|
package/plugins/package-json.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const workspace_root_1 = require("../src/utils/workspace-root");
|
|
4
|
-
const package_json_workspaces_1 = require("
|
|
4
|
+
const package_json_workspaces_1 = require("../src/plugins/package-json-workspaces");
|
|
5
5
|
const plugin = {
|
|
6
6
|
name: 'nx-all-package-jsons-plugin',
|
|
7
7
|
createNodes: [
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { NxReleaseConfig } from '../../src/command-line/release/config/config';
|
|
2
|
+
import type { GitCommit } from '../../src/command-line/release/utils/git';
|
|
3
|
+
import { RepoSlug } from '../../src/command-line/release/utils/github';
|
|
4
|
+
import type { ProjectGraph } from '../../src/config/project-graph';
|
|
3
5
|
/**
|
|
4
6
|
* The ChangelogRenderOptions are specific to each ChangelogRenderer implementation, and are taken
|
|
5
7
|
* from the user's nx.json configuration and passed as is into the ChangelogRenderer function.
|
|
@@ -10,6 +12,7 @@ export type ChangelogRenderOptions = Record<string, unknown>;
|
|
|
10
12
|
* and returns a string, or a Promise of a string of changelog contents (usually markdown).
|
|
11
13
|
*
|
|
12
14
|
* @param {Object} config The configuration object for the ChangelogRenderer
|
|
15
|
+
* @param {ProjectGraph} config.projectGraph The project graph for the workspace
|
|
13
16
|
* @param {GitCommit[]} config.commits The collection of extracted commits to generate a changelog for
|
|
14
17
|
* @param {string} config.releaseVersion The version that is being released
|
|
15
18
|
* @param {string | null} config.project The name of specific project to generate a changelog for, or `null` if the overall workspace changelog
|
|
@@ -17,12 +20,14 @@ export type ChangelogRenderOptions = Record<string, unknown>;
|
|
|
17
20
|
* @param {ChangelogRenderOptions} config.changelogRenderOptions The options specific to the ChangelogRenderer implementation
|
|
18
21
|
*/
|
|
19
22
|
export type ChangelogRenderer = (config: {
|
|
23
|
+
projectGraph: ProjectGraph;
|
|
20
24
|
commits: GitCommit[];
|
|
21
25
|
releaseVersion: string;
|
|
22
26
|
project: string | null;
|
|
23
27
|
entryWhenNoChanges: string | false;
|
|
24
28
|
changelogRenderOptions: DefaultChangelogRenderOptions;
|
|
25
29
|
repoSlug?: RepoSlug;
|
|
30
|
+
conventionalCommitsConfig: NxReleaseConfig['conventionalCommits'];
|
|
26
31
|
}) => Promise<string> | string;
|
|
27
32
|
/**
|
|
28
33
|
* The specific options available to the default implementation of the ChangelogRenderer that nx exports
|
|
@@ -33,7 +38,17 @@ export interface DefaultChangelogRenderOptions extends ChangelogRenderOptions {
|
|
|
33
38
|
* Whether or not the commit authors should be added to the bottom of the changelog in a "Thank You"
|
|
34
39
|
* section. Defaults to true.
|
|
35
40
|
*/
|
|
36
|
-
|
|
41
|
+
authors?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether or not the commit references (such as commit and/or PR links) should be included in the changelog.
|
|
44
|
+
* Defaults to true.
|
|
45
|
+
*/
|
|
46
|
+
commitReferences?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether or not to include the date in the version title. It can be set to false to disable it, or true to enable
|
|
49
|
+
* with the default of (YYYY-MM-DD). Defaults to true.
|
|
50
|
+
*/
|
|
51
|
+
versionTitleDate?: boolean;
|
|
37
52
|
}
|
|
38
53
|
/**
|
|
39
54
|
* The default ChangelogRenderer implementation that nx exports for the common case of generating markdown
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const semver_1 = require("semver");
|
|
4
|
+
const github_1 = require("../../src/command-line/release/utils/github");
|
|
5
|
+
const shared_1 = require("../../src/command-line/release/utils/shared");
|
|
4
6
|
// axios types and values don't seem to match
|
|
5
7
|
const _axios = require("axios");
|
|
6
8
|
const axios = _axios;
|
|
@@ -8,40 +10,39 @@ const axios = _axios;
|
|
|
8
10
|
* The default ChangelogRenderer implementation that nx exports for the common case of generating markdown
|
|
9
11
|
* from the given commits and other metadata.
|
|
10
12
|
*/
|
|
11
|
-
const defaultChangelogRenderer = async ({ commits, releaseVersion, project, entryWhenNoChanges, changelogRenderOptions, repoSlug, }) => {
|
|
13
|
+
const defaultChangelogRenderer = async ({ projectGraph, commits, releaseVersion, project, entryWhenNoChanges, changelogRenderOptions, repoSlug, conventionalCommitsConfig, }) => {
|
|
14
|
+
const commitTypes = conventionalCommitsConfig.types;
|
|
12
15
|
const markdownLines = [];
|
|
13
16
|
const breakingChanges = [];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
ci: { title: '🤖 CI' },
|
|
27
|
-
};
|
|
17
|
+
// If the current range of commits contains both a commit and its revert, we strip them both from the final list
|
|
18
|
+
for (const commit of commits) {
|
|
19
|
+
if (commit.type === 'revert') {
|
|
20
|
+
for (const revertedHash of commit.revertedHashes) {
|
|
21
|
+
const revertedCommit = commits.find((c) => revertedHash.startsWith(c.shortHash));
|
|
22
|
+
if (revertedCommit) {
|
|
23
|
+
commits.splice(commits.indexOf(revertedCommit), 1);
|
|
24
|
+
commits.splice(commits.indexOf(commit), 1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
28
29
|
// workspace root level changelog
|
|
29
30
|
if (project === null) {
|
|
30
31
|
// No changes for the workspace
|
|
31
32
|
if (commits.length === 0) {
|
|
32
33
|
if (entryWhenNoChanges) {
|
|
33
|
-
markdownLines.push('',
|
|
34
|
+
markdownLines.push('', `${createVersionTitle(releaseVersion, changelogRenderOptions)}\n\n${entryWhenNoChanges}`, '');
|
|
34
35
|
}
|
|
35
36
|
return markdownLines.join('\n').trim();
|
|
36
37
|
}
|
|
37
38
|
const typeGroups = groupBy(commits, 'type');
|
|
38
|
-
markdownLines.push('',
|
|
39
|
+
markdownLines.push('', createVersionTitle(releaseVersion, changelogRenderOptions), '');
|
|
39
40
|
for (const type of Object.keys(commitTypes)) {
|
|
40
41
|
const group = typeGroups[type];
|
|
41
42
|
if (!group || group.length === 0) {
|
|
42
43
|
continue;
|
|
43
44
|
}
|
|
44
|
-
markdownLines.push('', '### ' + commitTypes[type].title, '');
|
|
45
|
+
markdownLines.push('', '### ' + commitTypes[type].changelog.title, '');
|
|
45
46
|
/**
|
|
46
47
|
* In order to make the final changelog most readable, we organize commits as follows:
|
|
47
48
|
* - By scope, where scopes are in alphabetical order (commits with no scope are listed first)
|
|
@@ -53,10 +54,13 @@ const defaultChangelogRenderer = async ({ commits, releaseVersion, project, entr
|
|
|
53
54
|
for (const scope of scopesSortedAlphabetically) {
|
|
54
55
|
const commits = commitsGroupedByScope[scope];
|
|
55
56
|
for (const commit of commits) {
|
|
56
|
-
const line = formatCommit(commit, repoSlug);
|
|
57
|
+
const line = formatCommit(commit, changelogRenderOptions, repoSlug);
|
|
57
58
|
markdownLines.push(line);
|
|
58
59
|
if (commit.isBreaking) {
|
|
59
|
-
|
|
60
|
+
const breakingChangeExplanation = extractBreakingChangeExplanation(commit.body);
|
|
61
|
+
breakingChanges.push(breakingChangeExplanation
|
|
62
|
+
? `- ${commit.scope ? `**${commit.scope.trim()}:** ` : ''}${breakingChangeExplanation}`
|
|
63
|
+
: line);
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
}
|
|
@@ -64,28 +68,33 @@ const defaultChangelogRenderer = async ({ commits, releaseVersion, project, entr
|
|
|
64
68
|
}
|
|
65
69
|
else {
|
|
66
70
|
// project level changelog
|
|
67
|
-
const
|
|
68
|
-
// Generating for a named project, but that project has no changes in the current set of commits, exit early
|
|
69
|
-
if (
|
|
71
|
+
const relevantCommits = await (0, shared_1.getCommitsRelevantToProjects)(projectGraph, commits, [project]);
|
|
72
|
+
// Generating for a named project, but that project has no relevant changes in the current set of commits, exit early
|
|
73
|
+
if (relevantCommits.length === 0) {
|
|
70
74
|
if (entryWhenNoChanges) {
|
|
71
|
-
markdownLines.push('',
|
|
75
|
+
markdownLines.push('', `${createVersionTitle(releaseVersion, changelogRenderOptions)}\n\n${entryWhenNoChanges}`, '');
|
|
72
76
|
}
|
|
73
77
|
return markdownLines.join('\n').trim();
|
|
74
78
|
}
|
|
75
|
-
markdownLines.push('',
|
|
76
|
-
const typeGroups = groupBy(
|
|
79
|
+
markdownLines.push('', createVersionTitle(releaseVersion, changelogRenderOptions), '');
|
|
80
|
+
const typeGroups = groupBy(
|
|
81
|
+
// Sort the relevant commits to have the unscoped commits first, before grouping by type
|
|
82
|
+
relevantCommits.sort((a, b) => (b.scope ? 1 : 0) - (a.scope ? 1 : 0)), 'type');
|
|
77
83
|
for (const type of Object.keys(commitTypes)) {
|
|
78
84
|
const group = typeGroups[type];
|
|
79
85
|
if (!group || group.length === 0) {
|
|
80
86
|
continue;
|
|
81
87
|
}
|
|
82
|
-
markdownLines.push('', `### ${commitTypes[type].title}`, '');
|
|
88
|
+
markdownLines.push('', `### ${commitTypes[type].changelog.title}`, '');
|
|
83
89
|
const commitsInChronologicalOrder = group.reverse();
|
|
84
90
|
for (const commit of commitsInChronologicalOrder) {
|
|
85
|
-
const line = formatCommit(commit, repoSlug);
|
|
91
|
+
const line = formatCommit(commit, changelogRenderOptions, repoSlug);
|
|
86
92
|
markdownLines.push(line + '\n');
|
|
87
93
|
if (commit.isBreaking) {
|
|
88
|
-
|
|
94
|
+
const breakingChangeExplanation = extractBreakingChangeExplanation(commit.body);
|
|
95
|
+
breakingChanges.push(breakingChangeExplanation
|
|
96
|
+
? `- ${commit.scope ? `**${commit.scope.trim()}:** ` : ''}${breakingChangeExplanation}`
|
|
97
|
+
: line);
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
100
|
}
|
|
@@ -93,7 +102,7 @@ const defaultChangelogRenderer = async ({ commits, releaseVersion, project, entr
|
|
|
93
102
|
if (breakingChanges.length > 0) {
|
|
94
103
|
markdownLines.push('', '#### ⚠️ Breaking Changes', '', ...breakingChanges);
|
|
95
104
|
}
|
|
96
|
-
if (changelogRenderOptions.
|
|
105
|
+
if (changelogRenderOptions.authors) {
|
|
97
106
|
const _authors = new Map();
|
|
98
107
|
for (const commit of commits) {
|
|
99
108
|
if (!commit.author) {
|
|
@@ -168,13 +177,48 @@ function groupBy(items, key) {
|
|
|
168
177
|
}
|
|
169
178
|
return groups;
|
|
170
179
|
}
|
|
171
|
-
function formatCommit(commit, repoSlug) {
|
|
180
|
+
function formatCommit(commit, changelogRenderOptions, repoSlug) {
|
|
172
181
|
let commitLine = '- ' +
|
|
173
|
-
(commit.scope ? `**${commit.scope.trim()}:** ` : '') +
|
|
174
182
|
(commit.isBreaking ? '⚠️ ' : '') +
|
|
183
|
+
(commit.scope ? `**${commit.scope.trim()}:** ` : '') +
|
|
175
184
|
commit.description;
|
|
176
|
-
if (repoSlug) {
|
|
185
|
+
if (repoSlug && changelogRenderOptions.commitReferences) {
|
|
177
186
|
commitLine += (0, github_1.formatReferences)(commit.references, repoSlug);
|
|
178
187
|
}
|
|
179
188
|
return commitLine;
|
|
180
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* It is common to add further information about a breaking change in the commit body,
|
|
192
|
+
* and it is naturally that information that should be included in the BREAKING CHANGES
|
|
193
|
+
* section of changelog, rather than repeating the commit title/description.
|
|
194
|
+
*/
|
|
195
|
+
function extractBreakingChangeExplanation(message) {
|
|
196
|
+
const breakingChangeIdentifier = 'BREAKING CHANGE:';
|
|
197
|
+
const startIndex = message.indexOf(breakingChangeIdentifier);
|
|
198
|
+
if (startIndex === -1) {
|
|
199
|
+
// "BREAKING CHANGE:" not found in the message
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
const startOfBreakingChange = startIndex + breakingChangeIdentifier.length;
|
|
203
|
+
const endOfBreakingChange = message.indexOf('\n', startOfBreakingChange);
|
|
204
|
+
if (endOfBreakingChange === -1) {
|
|
205
|
+
// No newline character found, extract till the end of the message
|
|
206
|
+
return message.substring(startOfBreakingChange).trim();
|
|
207
|
+
}
|
|
208
|
+
// Extract and return the breaking change message
|
|
209
|
+
return message.substring(startOfBreakingChange, endOfBreakingChange).trim();
|
|
210
|
+
}
|
|
211
|
+
function createVersionTitle(version, changelogRenderOptions) {
|
|
212
|
+
// Normalize by removing any leading `v` during comparison
|
|
213
|
+
const isMajorVersion = `${(0, semver_1.major)(version)}.0.0` === version.replace(/^v/, '');
|
|
214
|
+
let maybeDateStr = '';
|
|
215
|
+
if (changelogRenderOptions.versionTitleDate) {
|
|
216
|
+
// YYYY-MM-DD
|
|
217
|
+
const dateStr = new Date().toISOString().slice(0, 10);
|
|
218
|
+
maybeDateStr = ` (${dateStr})`;
|
|
219
|
+
}
|
|
220
|
+
if (isMajorVersion) {
|
|
221
|
+
return `# ${version}${maybeDateStr}`;
|
|
222
|
+
}
|
|
223
|
+
return `## ${version}${maybeDateStr}`;
|
|
224
|
+
}
|
package/release/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.releaseVersion = exports.releasePublish = exports.releaseChangelog = exports.release = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @public Programmatic API for nx release
|
|
6
|
+
*/
|
|
7
|
+
var release_1 = require("../src/command-line/release");
|
|
8
|
+
Object.defineProperty(exports, "release", { enumerable: true, get: function () { return release_1.release; } });
|
|
9
|
+
Object.defineProperty(exports, "releaseChangelog", { enumerable: true, get: function () { return release_1.releaseChangelog; } });
|
|
10
|
+
Object.defineProperty(exports, "releasePublish", { enumerable: true, get: function () { return release_1.releasePublish; } });
|
|
11
|
+
Object.defineProperty(exports, "releaseVersion", { enumerable: true, get: function () { return release_1.releaseVersion; } });
|