nx 19.5.0-beta.0 → 19.5.0-beta.2
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/init-local.js +2 -3
- package/package.json +12 -12
- package/schemas/project-schema.json +26 -0
- package/src/adapter/angular-json.js +6 -6
- package/src/adapter/decorate-cli.js +1 -2
- package/src/adapter/ngcli-adapter.js +8 -8
- package/src/adapter/rxjs-for-await.js +5 -5
- package/src/command-line/add/add.js +2 -2
- package/src/command-line/affected/affected.js +2 -3
- package/src/command-line/connect/connect-to-nx-cloud.js +5 -6
- package/src/command-line/connect/view-logs.js +1 -2
- package/src/command-line/daemon/daemon.js +1 -2
- package/src/command-line/exec/exec.js +1 -2
- package/src/command-line/format/format.js +1 -2
- package/src/command-line/generate/generate.js +4 -5
- package/src/command-line/generate/generator-utils.js +2 -3
- package/src/command-line/graph/command-object.js +2 -2
- package/src/command-line/graph/graph.js +2 -3
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +1 -2
- package/src/command-line/init/implementation/add-nx-to-nest.js +1 -2
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +1 -2
- package/src/command-line/init/implementation/angular/index.js +1 -2
- package/src/command-line/init/implementation/angular/integrated-workspace.js +1 -2
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +1 -2
- package/src/command-line/init/implementation/angular/standalone-workspace.js +1 -2
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.d.ts +1 -1
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +7 -7
- package/src/command-line/init/implementation/react/add-craco-commands-to-package-scripts.js +1 -2
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +1 -2
- package/src/command-line/init/implementation/react/check-for-custom-webpack-setup.js +1 -2
- package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +1 -2
- package/src/command-line/init/implementation/react/clean-up-files.js +1 -2
- package/src/command-line/init/implementation/react/index.js +1 -2
- package/src/command-line/init/implementation/react/read-name-from-package-json.js +1 -2
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +1 -2
- package/src/command-line/init/implementation/react/tsconfig-setup.js +1 -2
- package/src/command-line/init/implementation/react/write-craco-config.js +1 -2
- package/src/command-line/init/implementation/react/write-vite-config.js +1 -2
- package/src/command-line/init/implementation/react/write-vite-index-html.js +1 -2
- package/src/command-line/init/implementation/utils.js +10 -11
- package/src/command-line/init/init-v1.js +1 -2
- package/src/command-line/init/init-v2.js +1 -2
- package/src/command-line/list/list.js +1 -2
- package/src/command-line/migrate/migrate.d.ts +1 -1
- package/src/command-line/migrate/migrate.js +5 -5
- package/src/command-line/new/new.js +1 -2
- package/src/command-line/release/changelog.js +3 -3
- package/src/command-line/release/config/config.js +3 -3
- package/src/command-line/release/config/filter-release-groups.js +1 -2
- package/src/command-line/release/config/version-plans.js +3 -4
- package/src/command-line/release/plan.js +2 -2
- package/src/command-line/release/publish.js +2 -2
- package/src/command-line/release/release.js +2 -2
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +1 -2
- package/src/command-line/release/utils/exec-command.js +1 -2
- package/src/command-line/release/utils/git.js +11 -12
- package/src/command-line/release/utils/github.js +5 -6
- package/src/command-line/release/utils/launch-editor.js +1 -2
- package/src/command-line/release/utils/markdown.js +1 -2
- package/src/command-line/release/utils/print-changes.d.ts +0 -1
- package/src/command-line/release/utils/print-changes.js +2 -3
- package/src/command-line/release/utils/resolve-changelog-renderer.js +1 -2
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +1 -2
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -3
- package/src/command-line/release/utils/semver.js +4 -5
- package/src/command-line/release/utils/shared.js +6 -6
- package/src/command-line/release/version.js +2 -2
- package/src/command-line/repair/repair.js +1 -2
- package/src/command-line/report/report.js +27 -19
- package/src/command-line/reset/reset.js +1 -2
- package/src/command-line/run/executor-utils.js +2 -3
- package/src/command-line/run/run-one.js +1 -2
- package/src/command-line/run/run.js +5 -6
- package/src/command-line/run-many/run-many.js +2 -3
- package/src/command-line/show/project.js +1 -2
- package/src/command-line/show/projects.js +1 -2
- package/src/command-line/watch/watch.js +2 -2
- package/src/command-line/yargs-utils/documentation.js +1 -2
- package/src/command-line/yargs-utils/shared-options.js +12 -13
- package/src/commands-runner/create-command-graph.js +1 -2
- package/src/commands-runner/get-command-projects.js +1 -2
- package/src/config/calculate-default-project-name.js +2 -3
- package/src/config/configuration.js +2 -2
- package/src/config/nx-json.js +2 -3
- package/src/config/project-graph.js +3 -3
- package/src/config/schema-utils.js +3 -4
- package/src/config/task-graph.d.ts +4 -0
- package/src/config/to-project-name.js +1 -2
- package/src/config/workspace-json-project-json.d.ts +5 -0
- package/src/core/graph/main.js +1 -1
- package/src/daemon/cache.js +6 -6
- package/src/daemon/client/client.d.ts +0 -2
- package/src/daemon/client/client.js +2 -2
- package/src/daemon/client/daemon-socket-messenger.d.ts +0 -1
- package/src/daemon/client/generate-help-output.js +1 -2
- package/src/daemon/is-on-daemon.js +1 -2
- package/src/daemon/message-types/get-context-file-data.js +2 -2
- package/src/daemon/message-types/get-files-in-directory.js +2 -2
- package/src/daemon/message-types/get-nx-workspace-files.js +2 -2
- package/src/daemon/message-types/glob.js +2 -2
- package/src/daemon/message-types/hash-glob.js +2 -2
- package/src/daemon/message-types/task-history.js +3 -3
- package/src/daemon/message-types/update-context-files.js +2 -2
- package/src/daemon/server/file-watching/changed-projects.js +1 -2
- package/src/daemon/server/file-watching/file-watcher-sockets.d.ts +0 -1
- package/src/daemon/server/file-watching/file-watcher-sockets.js +4 -4
- package/src/daemon/server/handle-context-file-data.js +1 -2
- package/src/daemon/server/handle-get-files-in-directory.js +1 -2
- package/src/daemon/server/handle-get-task-history.js +1 -2
- package/src/daemon/server/handle-glob.js +1 -2
- package/src/daemon/server/handle-hash-glob.js +1 -2
- package/src/daemon/server/handle-hash-tasks.js +1 -2
- package/src/daemon/server/handle-nx-workspace-files.js +1 -2
- package/src/daemon/server/handle-outputs-tracking.js +2 -3
- package/src/daemon/server/handle-process-in-background.js +1 -2
- package/src/daemon/server/handle-request-project-graph.js +1 -2
- package/src/daemon/server/handle-request-shutdown.d.ts +0 -1
- package/src/daemon/server/handle-request-shutdown.js +1 -2
- package/src/daemon/server/handle-write-task-runs-to-history.js +1 -2
- package/src/daemon/server/outputs-tracking.js +7 -8
- package/src/daemon/server/plugins.js +2 -3
- package/src/daemon/server/project-graph-incremental-recomputation.js +3 -3
- package/src/daemon/server/server.d.ts +0 -1
- package/src/daemon/server/server.js +2 -3
- package/src/daemon/server/shutdown-utils.d.ts +0 -1
- package/src/daemon/server/shutdown-utils.js +9 -9
- package/src/daemon/server/watcher.d.ts +0 -1
- package/src/daemon/server/watcher.js +3 -4
- package/src/daemon/socket-utils.js +3 -3
- package/src/daemon/tmp-dir.js +6 -6
- package/src/executors/noop/noop.impl.js +1 -1
- package/src/executors/run-commands/run-commands.impl.js +3 -3
- package/src/executors/run-script/run-script.impl.js +1 -1
- package/src/executors/utils/convert-nx-executor.js +1 -2
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +1 -2
- package/src/generators/testing-utils/create-tree-with-empty-workspace.d.ts +1 -1
- package/src/generators/testing-utils/create-tree-with-empty-workspace.js +2 -3
- package/src/generators/testing-utils/create-tree.js +1 -2
- package/src/generators/tree.d.ts +0 -2
- package/src/generators/tree.js +3 -3
- package/src/generators/utils/glob.js +2 -3
- package/src/generators/utils/json.js +3 -4
- package/src/generators/utils/nx-json.js +2 -3
- package/src/generators/utils/project-configuration.js +7 -7
- package/src/hasher/create-task-hasher.js +1 -2
- package/src/hasher/file-hasher.js +2 -3
- package/src/hasher/hash-task.d.ts +0 -1
- package/src/hasher/hash-task.js +2 -3
- package/src/hasher/native-task-hasher-impl.d.ts +0 -1
- package/src/hasher/node-task-hasher-impl.d.ts +0 -1
- package/src/hasher/task-hasher.d.ts +0 -1
- package/src/hasher/task-hasher.js +10 -10
- package/src/migrations/update-15-0-0/migrate-to-inputs.js +1 -1
- package/src/migrations/update-15-0-0/prefix-outputs.js +1 -1
- package/src/migrations/update-16-0-0/remove-nrwl-cli.js +1 -1
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +1 -1
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +1 -1
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +1 -1
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +1 -1
- package/src/migrations/update-16-9-0/remove-project-name-and-root-format.js +1 -1
- package/src/migrations/update-17-0-0/move-cache-directory.js +1 -1
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +1 -1
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +1 -1
- package/src/migrations/update-17-2-0/move-default-base.js +1 -1
- package/src/migrations/update-17-3-0/nx-release-path.js +2 -3
- package/src/migrations/update-17-3-0/update-nxw.js +1 -1
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +1 -1
- package/src/migrations/update-19-2-0/move-workspace-data-directory.js +3 -4
- package/src/migrations/update-19-2-4/set-project-name.js +1 -1
- package/src/native/assert-supported-platform.js +1 -2
- package/src/native/index.d.ts +1 -0
- package/src/native/native-file-cache-location.js +1 -2
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/native/transform-objects.js +2 -2
- package/src/nx-cloud/debug-logger.js +1 -2
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +1 -2
- package/src/nx-cloud/resolution-helpers.js +1 -2
- package/src/nx-cloud/update-manager.js +2 -2
- package/src/nx-cloud/utilities/axios.js +1 -2
- package/src/nx-cloud/utilities/get-cloud-options.js +1 -2
- package/src/nx-cloud/utilities/url-shorten.js +8 -9
- package/src/plugins/js/hasher/hasher.js +1 -2
- package/src/plugins/js/lock-file/lock-file.js +6 -6
- package/src/plugins/js/lock-file/npm-parser.js +3 -4
- package/src/plugins/js/lock-file/pnpm-parser.js +3 -4
- package/src/plugins/js/lock-file/project-graph-pruning.js +1 -2
- package/src/plugins/js/lock-file/utils/package-json.js +2 -3
- package/src/plugins/js/lock-file/utils/pnpm-normalizer.js +5 -6
- package/src/plugins/js/lock-file/yarn-parser.js +3 -4
- package/src/plugins/js/package-json/create-package-json.js +2 -3
- package/src/plugins/js/project-graph/build-dependencies/build-dependencies.js +1 -2
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +1 -2
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -2
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -2
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +2 -2
- package/src/plugins/js/project-graph/build-nodes/build-npm-package-nodes.js +1 -2
- package/src/plugins/js/utils/config.js +1 -2
- package/src/plugins/js/utils/register.d.ts +1 -0
- package/src/plugins/js/utils/register.js +7 -8
- package/src/plugins/js/utils/resolve-relative-to-dir.js +1 -2
- package/src/plugins/js/utils/typescript.js +5 -6
- package/src/plugins/js/versions.d.ts +1 -1
- package/src/plugins/js/versions.js +1 -1
- package/src/plugins/package-json-workspaces/create-nodes.js +5 -5
- package/src/plugins/project-json/build-nodes/project-json.js +3 -3
- package/src/project-graph/affected/affected-project-graph.js +1 -2
- package/src/project-graph/build-project-graph.js +3 -4
- package/src/project-graph/error-types.js +11 -11
- package/src/project-graph/file-map-utils.js +4 -5
- package/src/project-graph/file-utils.d.ts +1 -1
- package/src/project-graph/file-utils.js +7 -7
- package/src/project-graph/nx-deps-cache.js +8 -8
- package/src/project-graph/operators.js +5 -5
- package/src/project-graph/plugins/internal-api.d.ts +1 -1
- package/src/project-graph/plugins/internal-api.js +13 -9
- package/src/project-graph/plugins/isolation/index.js +1 -2
- package/src/project-graph/plugins/isolation/messaging.d.ts +1 -3
- package/src/project-graph/plugins/isolation/messaging.js +4 -5
- package/src/project-graph/plugins/isolation/plugin-pool.js +1 -2
- package/src/project-graph/plugins/isolation/plugin-worker.js +6 -2
- package/src/project-graph/plugins/loader.js +7 -7
- package/src/project-graph/plugins/utils.js +4 -5
- package/src/project-graph/project-graph-builder.js +2 -2
- package/src/project-graph/project-graph.js +7 -8
- package/src/project-graph/utils/build-all-workspace-files.js +1 -2
- package/src/project-graph/utils/find-project-for-path.js +4 -5
- package/src/project-graph/utils/implicit-project-dependencies.js +1 -2
- package/src/project-graph/utils/normalize-project-nodes.js +2 -3
- package/src/project-graph/utils/project-configuration-utils.js +30 -14
- package/src/project-graph/utils/retrieve-workspace-files.js +6 -7
- package/src/tasks-runner/create-task-graph.d.ts +2 -1
- package/src/tasks-runner/create-task-graph.js +18 -33
- package/src/tasks-runner/forked-process-task-runner.d.ts +0 -1
- package/src/tasks-runner/init-tasks-runner.js +1 -2
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +1 -2
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +1 -2
- package/src/tasks-runner/life-cycles/formatting-utils.js +2 -3
- package/src/tasks-runner/life-cycles/pretty-time.js +1 -2
- package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -2
- package/src/tasks-runner/pseudo-ipc.d.ts +0 -1
- package/src/tasks-runner/pseudo-terminal.d.ts +0 -1
- package/src/tasks-runner/pseudo-terminal.js +2 -2
- package/src/tasks-runner/run-command.js +4 -5
- package/src/tasks-runner/task-env.d.ts +0 -1
- package/src/tasks-runner/task-env.js +5 -6
- package/src/tasks-runner/task-graph-utils.js +2 -3
- package/src/tasks-runner/task-orchestrator.js +8 -0
- package/src/tasks-runner/tasks-schedule.d.ts +1 -0
- package/src/tasks-runner/tasks-schedule.js +28 -4
- package/src/tasks-runner/utils.d.ts +15 -2
- package/src/tasks-runner/utils.js +107 -43
- package/src/utils/ab-testing.js +2 -2
- package/src/utils/all-file-data.js +1 -2
- package/src/utils/assert-workspace-validity.js +1 -2
- package/src/utils/async-iterator.js +2 -3
- package/src/utils/cache-directory.js +2 -2
- package/src/utils/child-process.d.ts +0 -1
- package/src/utils/child-process.js +3 -3
- package/src/utils/chunkify.js +1 -2
- package/src/utils/code-frames.js +1 -2
- package/src/utils/collapse-expanded-outputs.js +1 -2
- package/src/utils/command-line-utils.js +5 -6
- package/src/utils/consume-messages-from-socket.js +1 -2
- package/src/utils/default-base.js +1 -2
- package/src/utils/dotenv.js +1 -2
- package/src/utils/exit-codes.d.ts +0 -1
- package/src/utils/exit-codes.js +1 -2
- package/src/utils/fileutils.d.ts +0 -1
- package/src/utils/fileutils.js +9 -10
- package/src/utils/find-matching-projects.js +5 -5
- package/src/utils/find-workspace-root.js +1 -2
- package/src/utils/get-package-name-from-import-path.js +1 -2
- package/src/utils/git-utils.js +4 -5
- package/src/utils/globs.d.ts +2 -0
- package/src/utils/globs.js +12 -2
- package/src/utils/ignore.js +4 -4
- package/src/utils/installation-directory.js +2 -3
- package/src/utils/is-ci.js +1 -2
- package/src/utils/json-diff.js +5 -5
- package/src/utils/json.js +3 -3
- package/src/utils/logger.js +2 -2
- package/src/utils/nx-cloud-utils.js +3 -4
- package/src/utils/nx-plugin.deprecated.js +1 -2
- package/src/utils/object-sort.js +1 -2
- package/src/utils/package-json.js +8 -9
- package/src/utils/package-manager.js +13 -14
- package/src/utils/params.js +14 -14
- package/src/utils/path.js +3 -4
- package/src/utils/plugins/community-plugins.js +1 -2
- package/src/utils/plugins/core-plugins.js +2 -3
- package/src/utils/plugins/installed-plugins.js +3 -4
- package/src/utils/plugins/local-plugins.js +2 -3
- package/src/utils/plugins/plugin-capabilities.js +2 -3
- package/src/utils/plugins/shared.js +1 -2
- package/src/utils/print-help.js +1 -2
- package/src/utils/project-graph-utils.js +4 -5
- package/src/utils/serializable-error.js +7 -2
- package/src/utils/serialize-overrides-into-command-line.js +1 -2
- package/src/utils/serialize-target.js +1 -2
- package/src/utils/split-target.js +2 -3
- package/src/utils/strip-indents.js +1 -2
- package/src/utils/task-history.js +3 -3
- package/src/utils/update-nxw.js +1 -2
- package/src/utils/workspace-configuration-check.js +1 -2
- package/src/utils/workspace-context.js +10 -11
- package/src/utils/workspace-root.js +3 -3
package/src/utils/fileutils.js
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.readJsonFile = readJsonFile;
|
4
|
+
exports.readYamlFile = readYamlFile;
|
5
|
+
exports.writeJsonFile = writeJsonFile;
|
6
|
+
exports.directoryExists = directoryExists;
|
7
|
+
exports.fileExists = fileExists;
|
8
|
+
exports.createDirectory = createDirectory;
|
9
|
+
exports.isRelativePath = isRelativePath;
|
10
|
+
exports.extractFileFromTarball = extractFileFromTarball;
|
11
|
+
exports.readFileIfExisting = readFileIfExisting;
|
4
12
|
const json_1 = require("./json");
|
5
13
|
const fs_1 = require("fs");
|
6
14
|
const path_1 = require("path");
|
@@ -26,7 +34,6 @@ function readJsonFile(path, options) {
|
|
26
34
|
throw e;
|
27
35
|
}
|
28
36
|
}
|
29
|
-
exports.readJsonFile = readJsonFile;
|
30
37
|
/**
|
31
38
|
* Reads a YAML file and returns the object the YAML content represents.
|
32
39
|
*
|
@@ -38,7 +45,6 @@ function readYamlFile(path, options) {
|
|
38
45
|
const { load } = require('@zkochan/js-yaml');
|
39
46
|
return load(content, { ...options, filename: path });
|
40
47
|
}
|
41
|
-
exports.readYamlFile = readYamlFile;
|
42
48
|
/**
|
43
49
|
* Serializes the given data to JSON and writes it to a file.
|
44
50
|
*
|
@@ -54,7 +60,6 @@ function writeJsonFile(path, data, options) {
|
|
54
60
|
: serializedJson;
|
55
61
|
(0, fs_1.writeFileSync)(path, content, { encoding: 'utf-8' });
|
56
62
|
}
|
57
|
-
exports.writeJsonFile = writeJsonFile;
|
58
63
|
/**
|
59
64
|
* Check if a directory exists
|
60
65
|
* @param path Path to directory
|
@@ -67,7 +72,6 @@ function directoryExists(path) {
|
|
67
72
|
return false;
|
68
73
|
}
|
69
74
|
}
|
70
|
-
exports.directoryExists = directoryExists;
|
71
75
|
/**
|
72
76
|
* Check if a file exists.
|
73
77
|
* @param path Path to file
|
@@ -80,18 +84,15 @@ function fileExists(path) {
|
|
80
84
|
return false;
|
81
85
|
}
|
82
86
|
}
|
83
|
-
exports.fileExists = fileExists;
|
84
87
|
function createDirectory(path) {
|
85
88
|
(0, fs_1.mkdirSync)(path, { recursive: true });
|
86
89
|
}
|
87
|
-
exports.createDirectory = createDirectory;
|
88
90
|
function isRelativePath(path) {
|
89
91
|
return (path === '.' ||
|
90
92
|
path === '..' ||
|
91
93
|
path.startsWith('./') ||
|
92
94
|
path.startsWith('../'));
|
93
95
|
}
|
94
|
-
exports.isRelativePath = isRelativePath;
|
95
96
|
/**
|
96
97
|
* Extracts a file from a given tarball to the specified destination.
|
97
98
|
* @param tarballPath The path to the tarball from where the file should be extracted.
|
@@ -128,8 +129,6 @@ async function extractFileFromTarball(tarballPath, file, destinationFilePath) {
|
|
128
129
|
(0, fs_1.createReadStream)(tarballPath).pipe((0, zlib_1.createGunzip)()).pipe(tarExtractStream);
|
129
130
|
});
|
130
131
|
}
|
131
|
-
exports.extractFileFromTarball = extractFileFromTarball;
|
132
132
|
function readFileIfExisting(path) {
|
133
133
|
return (0, fs_1.existsSync)(path) ? (0, fs_1.readFileSync)(path, 'utf-8') : '';
|
134
134
|
}
|
135
|
-
exports.readFileIfExisting = readFileIfExisting;
|
@@ -1,14 +1,15 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getMatchingStringsWithCache =
|
3
|
+
exports.getMatchingStringsWithCache = void 0;
|
4
|
+
exports.findMatchingProjects = findMatchingProjects;
|
4
5
|
const minimatch_1 = require("minimatch");
|
6
|
+
const globs_1 = require("./globs");
|
5
7
|
const validPatternTypes = [
|
6
8
|
'name', // Pattern is based on the project's name
|
7
9
|
'tag', // Pattern is based on the project's tags
|
8
10
|
'directory', // Pattern is based on the project's root directory
|
9
11
|
'unlabeled', // Pattern was passed without specifying a type
|
10
12
|
];
|
11
|
-
const globCharacters = ['*', '|', '{', '}', '(', ')'];
|
12
13
|
/**
|
13
14
|
* Find matching project names given a list of potential project names or globs.
|
14
15
|
*
|
@@ -86,7 +87,6 @@ function findMatchingProjects(patterns = [], projects) {
|
|
86
87
|
}
|
87
88
|
return Array.from(matchedProjects);
|
88
89
|
}
|
89
|
-
exports.findMatchingProjects = findMatchingProjects;
|
90
90
|
function addMatchingProjectsByDirectory(projectNames, projects, pattern, matchedProjects) {
|
91
91
|
for (const projectName of projectNames) {
|
92
92
|
const root = projects[projectName].data.root;
|
@@ -110,7 +110,7 @@ function addMatchingProjectsByName(projectNames, projects, pattern, matchedProje
|
|
110
110
|
}
|
111
111
|
return;
|
112
112
|
}
|
113
|
-
if (!
|
113
|
+
if (!(0, globs_1.isGlobPattern)(pattern.value)) {
|
114
114
|
return;
|
115
115
|
}
|
116
116
|
const matchedProjectNames = (0, exports.getMatchingStringsWithCache)(pattern.value, projectNames);
|
@@ -135,7 +135,7 @@ function addMatchingProjectsByTag(projectNames, projects, pattern, matchedProjec
|
|
135
135
|
}
|
136
136
|
continue;
|
137
137
|
}
|
138
|
-
if (!
|
138
|
+
if (!(0, globs_1.isGlobPattern)(pattern.value)) {
|
139
139
|
continue;
|
140
140
|
}
|
141
141
|
if ((0, exports.getMatchingStringsWithCache)(pattern.value, tags).length) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.findWorkspaceRoot =
|
3
|
+
exports.findWorkspaceRoot = findWorkspaceRoot;
|
4
4
|
const workspace_root_1 = require("./workspace-root");
|
5
5
|
/**
|
6
6
|
* Recursive function that walks back up the directory
|
@@ -19,7 +19,6 @@ function findWorkspaceRoot(dir) {
|
|
19
19
|
return { type: 'nx', dir: r };
|
20
20
|
}
|
21
21
|
}
|
22
|
-
exports.findWorkspaceRoot = findWorkspaceRoot;
|
23
22
|
function isAngularCliInstalled(root) {
|
24
23
|
try {
|
25
24
|
// nx-ignore-next-line
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getPackageNameFromImportPath =
|
3
|
+
exports.getPackageNameFromImportPath = getPackageNameFromImportPath;
|
4
4
|
//# Converts import paths to package names.
|
5
5
|
//# e.g. - `@nx/workspace` -> `@nx/workspace`
|
6
6
|
//# - `@nx/workspace/plugin` -> `@nx/workspace`
|
@@ -15,4 +15,3 @@ function getPackageNameFromImportPath(importExpression) {
|
|
15
15
|
// For unscoped packages, the package name is up to the first '/'
|
16
16
|
return importExpression.split('/')[0];
|
17
17
|
}
|
18
|
-
exports.getPackageNameFromImportPath = getPackageNameFromImportPath;
|
package/src/utils/git-utils.js
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.getGithubSlugOrNull = getGithubSlugOrNull;
|
4
|
+
exports.extractUserAndRepoFromGitHubUrl = extractUserAndRepoFromGitHubUrl;
|
5
|
+
exports.commitChanges = commitChanges;
|
6
|
+
exports.getLatestCommitSha = getLatestCommitSha;
|
4
7
|
const child_process_1 = require("child_process");
|
5
8
|
const devkit_exports_1 = require("../devkit-exports");
|
6
9
|
function getGithubSlugOrNull() {
|
@@ -12,7 +15,6 @@ function getGithubSlugOrNull() {
|
|
12
15
|
return null;
|
13
16
|
}
|
14
17
|
}
|
15
|
-
exports.getGithubSlugOrNull = getGithubSlugOrNull;
|
16
18
|
function extractUserAndRepoFromGitHubUrl(gitRemotes) {
|
17
19
|
const regex = /^\s*(\w+)\s+(git@github\.com:|https:\/\/github\.com\/)([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/gm;
|
18
20
|
let firstGitHubUrl = null;
|
@@ -29,7 +31,6 @@ function extractUserAndRepoFromGitHubUrl(gitRemotes) {
|
|
29
31
|
}
|
30
32
|
return firstGitHubUrl ? parseGitHubUrl(firstGitHubUrl) : null;
|
31
33
|
}
|
32
|
-
exports.extractUserAndRepoFromGitHubUrl = extractUserAndRepoFromGitHubUrl;
|
33
34
|
function parseGitHubUrl(url) {
|
34
35
|
const sshPattern = /git@github\.com:([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/;
|
35
36
|
const httpsPattern = /https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/;
|
@@ -63,7 +64,6 @@ function commitChanges(commitMessage, directory) {
|
|
63
64
|
}
|
64
65
|
return getLatestCommitSha();
|
65
66
|
}
|
66
|
-
exports.commitChanges = commitChanges;
|
67
67
|
function getLatestCommitSha() {
|
68
68
|
try {
|
69
69
|
return (0, child_process_1.execSync)('git rev-parse HEAD', {
|
@@ -75,4 +75,3 @@ function getLatestCommitSha() {
|
|
75
75
|
return null;
|
76
76
|
}
|
77
77
|
}
|
78
|
-
exports.getLatestCommitSha = getLatestCommitSha;
|
package/src/utils/globs.d.ts
CHANGED
package/src/utils/globs.js
CHANGED
@@ -1,8 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.GLOB_CHARACTERS = void 0;
|
4
|
+
exports.combineGlobPatterns = combineGlobPatterns;
|
5
|
+
exports.isGlobPattern = isGlobPattern;
|
4
6
|
function combineGlobPatterns(...patterns) {
|
5
7
|
const p = patterns.flat();
|
6
8
|
return p.length > 1 ? '{' + p.join(',') + '}' : p.length === 1 ? p[0] : '';
|
7
9
|
}
|
8
|
-
exports.
|
10
|
+
exports.GLOB_CHARACTERS = new Set(['*', '|', '{', '}', '(', ')', '[']);
|
11
|
+
function isGlobPattern(pattern) {
|
12
|
+
for (const c of pattern) {
|
13
|
+
if (exports.GLOB_CHARACTERS.has(c)) {
|
14
|
+
return true;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
return false;
|
18
|
+
}
|
package/src/utils/ignore.js
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.ALWAYS_IGNORE = void 0;
|
4
|
+
exports.getIgnoredGlobs = getIgnoredGlobs;
|
5
|
+
exports.getAlwaysIgnore = getAlwaysIgnore;
|
6
|
+
exports.getIgnoreObject = getIgnoreObject;
|
4
7
|
const fs_extra_1 = require("fs-extra");
|
5
8
|
const ignore_1 = require("ignore");
|
6
9
|
const fileutils_1 = require("./fileutils");
|
@@ -25,7 +28,6 @@ function getIgnoredGlobs(root = workspace_root_1.workspaceRoot, prependRoot = tr
|
|
25
28
|
];
|
26
29
|
}
|
27
30
|
}
|
28
|
-
exports.getIgnoredGlobs = getIgnoredGlobs;
|
29
31
|
function getAlwaysIgnore(root) {
|
30
32
|
const paths = [
|
31
33
|
'node_modules',
|
@@ -37,14 +39,12 @@ function getAlwaysIgnore(root) {
|
|
37
39
|
];
|
38
40
|
return root ? paths.map((x) => (0, path_1.joinPathFragments)(root, x)) : paths;
|
39
41
|
}
|
40
|
-
exports.getAlwaysIgnore = getAlwaysIgnore;
|
41
42
|
function getIgnoreObject(root = workspace_root_1.workspaceRoot) {
|
42
43
|
const ig = (0, ignore_1.default)();
|
43
44
|
ig.add((0, fileutils_1.readFileIfExisting)(`${root}/.gitignore`));
|
44
45
|
ig.add((0, fileutils_1.readFileIfExisting)(`${root}/.nxignore`));
|
45
46
|
return ig;
|
46
47
|
}
|
47
|
-
exports.getIgnoreObject = getIgnoreObject;
|
48
48
|
function getIgnoredGlobsFromFile(file, root) {
|
49
49
|
try {
|
50
50
|
const results = [];
|
@@ -1,13 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.getNxInstallationPath = getNxInstallationPath;
|
4
|
+
exports.getNxRequirePaths = getNxRequirePaths;
|
4
5
|
const path_1 = require("path");
|
5
6
|
const workspace_root_1 = require("./workspace-root");
|
6
7
|
function getNxInstallationPath(root = workspace_root_1.workspaceRoot) {
|
7
8
|
return (0, path_1.join)(root, '.nx', 'installation');
|
8
9
|
}
|
9
|
-
exports.getNxInstallationPath = getNxInstallationPath;
|
10
10
|
function getNxRequirePaths(root = workspace_root_1.workspaceRoot) {
|
11
11
|
return [root, getNxInstallationPath(root)];
|
12
12
|
}
|
13
|
-
exports.getNxRequirePaths = getNxRequirePaths;
|
package/src/utils/is-ci.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isCI =
|
3
|
+
exports.isCI = isCI;
|
4
4
|
function isCI() {
|
5
5
|
return ((process.env.CI && process.env.CI !== 'false') ||
|
6
6
|
process.env.TF_BUILD === 'true' ||
|
@@ -18,4 +18,3 @@ function isCI() {
|
|
18
18
|
!!process.env.BUILD_BUILDID ||
|
19
19
|
!!process.env.TEAMCITY_VERSION);
|
20
20
|
}
|
21
|
-
exports.isCI = isCI;
|
package/src/utils/json-diff.js
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.JsonDiffType = void 0;
|
4
|
+
exports.isJsonChange = isJsonChange;
|
5
|
+
exports.jsonDiff = jsonDiff;
|
6
|
+
exports.walkJsonTree = walkJsonTree;
|
7
|
+
exports.deepEquals = deepEquals;
|
4
8
|
var JsonDiffType;
|
5
9
|
(function (JsonDiffType) {
|
6
10
|
JsonDiffType["Deleted"] = "JsonPropertyDeleted";
|
@@ -12,7 +16,6 @@ function isJsonChange(change) {
|
|
12
16
|
change.type === JsonDiffType.Deleted ||
|
13
17
|
change.type === JsonDiffType.Modified);
|
14
18
|
}
|
15
|
-
exports.isJsonChange = isJsonChange;
|
16
19
|
function jsonDiff(lhs, rhs) {
|
17
20
|
const result = [];
|
18
21
|
const seenInLhs = new Set();
|
@@ -57,7 +60,6 @@ function jsonDiff(lhs, rhs) {
|
|
57
60
|
});
|
58
61
|
return result;
|
59
62
|
}
|
60
|
-
exports.jsonDiff = jsonDiff;
|
61
63
|
// Depth-first walk down JSON tree.
|
62
64
|
function walkJsonTree(json, currPath, visitor) {
|
63
65
|
if (!json || typeof json !== 'object') {
|
@@ -71,7 +73,6 @@ function walkJsonTree(json, currPath, visitor) {
|
|
71
73
|
}
|
72
74
|
});
|
73
75
|
}
|
74
|
-
exports.walkJsonTree = walkJsonTree;
|
75
76
|
function hashArray(ary) {
|
76
77
|
return JSON.stringify(ary);
|
77
78
|
}
|
@@ -109,4 +110,3 @@ function deepEquals(a, b) {
|
|
109
110
|
return deepEquals(aValue, b[key]);
|
110
111
|
}, true);
|
111
112
|
}
|
112
|
-
exports.deepEquals = deepEquals;
|
package/src/utils/json.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.stripJsonComments = void 0;
|
4
|
+
exports.parseJson = parseJson;
|
5
|
+
exports.serializeJson = serializeJson;
|
4
6
|
const jsonc_parser_1 = require("jsonc-parser");
|
5
7
|
Object.defineProperty(exports, "stripJsonComments", { enumerable: true, get: function () { return jsonc_parser_1.stripComments; } });
|
6
8
|
const lines_and_columns_1 = require("lines-and-columns");
|
@@ -28,7 +30,6 @@ function parseJson(input, options) {
|
|
28
30
|
}
|
29
31
|
return result;
|
30
32
|
}
|
31
|
-
exports.parseJson = parseJson;
|
32
33
|
/**
|
33
34
|
* Nicely formats a JSON error with context
|
34
35
|
*
|
@@ -59,4 +60,3 @@ function formatParseError(input, parseError) {
|
|
59
60
|
function serializeJson(input, options) {
|
60
61
|
return JSON.stringify(input, null, options?.spaces ?? 2);
|
61
62
|
}
|
62
|
-
exports.serializeJson = serializeJson;
|
package/src/utils/logger.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.logger = exports.NX_ERROR = exports.NX_PREFIX = void 0;
|
4
|
+
exports.stripIndent = stripIndent;
|
4
5
|
const chalk = require("chalk");
|
5
6
|
exports.NX_PREFIX = chalk.inverse(chalk.bold(chalk.cyan(' NX ')));
|
6
7
|
exports.NX_ERROR = chalk.inverse(chalk.bold(chalk.red(' ERROR ')));
|
@@ -49,4 +50,3 @@ function stripIndent(str) {
|
|
49
50
|
const regex = new RegExp(`^[ \\t]{${indent}}`, 'gm');
|
50
51
|
return str.replace(regex, '');
|
51
52
|
}
|
52
|
-
exports.stripIndent = stripIndent;
|
@@ -1,12 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.isNxCloudUsed = isNxCloudUsed;
|
4
|
+
exports.getNxCloudUrl = getNxCloudUrl;
|
5
|
+
exports.getNxCloudToken = getNxCloudToken;
|
4
6
|
function isNxCloudUsed(nxJson) {
|
5
7
|
return (!!process.env.NX_CLOUD_ACCESS_TOKEN ||
|
6
8
|
!!nxJson.nxCloudAccessToken ||
|
7
9
|
!!Object.values(nxJson.tasksRunnerOptions ?? {}).find((r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud'));
|
8
10
|
}
|
9
|
-
exports.isNxCloudUsed = isNxCloudUsed;
|
10
11
|
function getNxCloudUrl(nxJson) {
|
11
12
|
const cloudRunner = Object.values(nxJson.tasksRunnerOptions ?? {}).find((r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud');
|
12
13
|
if (!cloudRunner &&
|
@@ -14,7 +15,6 @@ function getNxCloudUrl(nxJson) {
|
|
14
15
|
throw new Error('nx-cloud runner not found in nx.json');
|
15
16
|
return cloudRunner?.options?.url ?? nxJson.nxCloudUrl ?? 'https://nx.app';
|
16
17
|
}
|
17
|
-
exports.getNxCloudUrl = getNxCloudUrl;
|
18
18
|
function getNxCloudToken(nxJson) {
|
19
19
|
const cloudRunner = Object.values(nxJson.tasksRunnerOptions ?? {}).find((r) => r.runner == '@nrwl/nx-cloud' || r.runner == 'nx-cloud');
|
20
20
|
if (!cloudRunner &&
|
@@ -24,4 +24,3 @@ function getNxCloudToken(nxJson) {
|
|
24
24
|
cloudRunner?.options.accessToken ??
|
25
25
|
nxJson.nxCloudAccessToken);
|
26
26
|
}
|
27
|
-
exports.getNxCloudToken = getNxCloudToken;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getDefaultPluginsSync =
|
3
|
+
exports.getDefaultPluginsSync = getDefaultPluginsSync;
|
4
4
|
const angular_json_1 = require("../adapter/angular-json");
|
5
5
|
const project_json_1 = require("../plugins/project-json/build-nodes/project-json");
|
6
6
|
const PackageJsonWorkspacesPlugin = require("../plugins/package-json-workspaces");
|
@@ -18,4 +18,3 @@ function getDefaultPluginsSync(root) {
|
|
18
18
|
];
|
19
19
|
return plugins;
|
20
20
|
}
|
21
|
-
exports.getDefaultPluginsSync = getDefaultPluginsSync;
|
package/src/utils/object-sort.js
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.sortObjectByKeys =
|
3
|
+
exports.sortObjectByKeys = sortObjectByKeys;
|
4
4
|
function sortObjectByKeys(originalObject) {
|
5
5
|
const keys = Object.keys(originalObject).sort();
|
6
6
|
const sortedObject = {};
|
7
7
|
keys.forEach((key) => (sortedObject[key] = originalObject[key]));
|
8
8
|
return sortedObject;
|
9
9
|
}
|
10
|
-
exports.sortObjectByKeys = sortObjectByKeys;
|
@@ -1,6 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.normalizePackageGroup = normalizePackageGroup;
|
4
|
+
exports.readNxMigrateConfig = readNxMigrateConfig;
|
5
|
+
exports.buildTargetFromScript = buildTargetFromScript;
|
6
|
+
exports.getMetadataFromPackageJson = getMetadataFromPackageJson;
|
7
|
+
exports.getTagsFromPackageJson = getTagsFromPackageJson;
|
8
|
+
exports.readTargetsFromPackageJson = readTargetsFromPackageJson;
|
9
|
+
exports.readModulePackageJsonWithoutFallbacks = readModulePackageJsonWithoutFallbacks;
|
10
|
+
exports.readModulePackageJson = readModulePackageJson;
|
4
11
|
const fs_1 = require("fs");
|
5
12
|
const path_1 = require("path");
|
6
13
|
const project_configuration_utils_1 = require("../project-graph/utils/project-configuration-utils");
|
@@ -15,7 +22,6 @@ function normalizePackageGroup(packageGroup) {
|
|
15
22
|
version,
|
16
23
|
}));
|
17
24
|
}
|
18
|
-
exports.normalizePackageGroup = normalizePackageGroup;
|
19
25
|
function readNxMigrateConfig(json) {
|
20
26
|
const parseNxMigrationsConfig = (fromJson) => {
|
21
27
|
if (!fromJson) {
|
@@ -38,7 +44,6 @@ function readNxMigrateConfig(json) {
|
|
38
44
|
...parseNxMigrationsConfig(json),
|
39
45
|
};
|
40
46
|
}
|
41
|
-
exports.readNxMigrateConfig = readNxMigrateConfig;
|
42
47
|
function buildTargetFromScript(script, scripts = {}, packageManagerCommand) {
|
43
48
|
return {
|
44
49
|
executor: 'nx:run-script',
|
@@ -51,7 +56,6 @@ function buildTargetFromScript(script, scripts = {}, packageManagerCommand) {
|
|
51
56
|
},
|
52
57
|
};
|
53
58
|
}
|
54
|
-
exports.buildTargetFromScript = buildTargetFromScript;
|
55
59
|
let packageManagerCommand;
|
56
60
|
function getMetadataFromPackageJson(packageJson) {
|
57
61
|
const { scripts, nx, description } = packageJson ?? {};
|
@@ -63,7 +67,6 @@ function getMetadataFromPackageJson(packageJson) {
|
|
63
67
|
description,
|
64
68
|
};
|
65
69
|
}
|
66
|
-
exports.getMetadataFromPackageJson = getMetadataFromPackageJson;
|
67
70
|
function getTagsFromPackageJson(packageJson) {
|
68
71
|
const tags = packageJson.private ? ['npm:private'] : ['npm:public'];
|
69
72
|
if (packageJson.keywords?.length) {
|
@@ -74,7 +77,6 @@ function getTagsFromPackageJson(packageJson) {
|
|
74
77
|
}
|
75
78
|
return tags;
|
76
79
|
}
|
77
|
-
exports.getTagsFromPackageJson = getTagsFromPackageJson;
|
78
80
|
function readTargetsFromPackageJson(packageJson) {
|
79
81
|
const { scripts, nx, private: isPrivate } = packageJson ?? {};
|
80
82
|
const res = {};
|
@@ -100,7 +102,6 @@ function readTargetsFromPackageJson(packageJson) {
|
|
100
102
|
}
|
101
103
|
return res;
|
102
104
|
}
|
103
|
-
exports.readTargetsFromPackageJson = readTargetsFromPackageJson;
|
104
105
|
/**
|
105
106
|
* Uses `require.resolve` to read the package.json for a module.
|
106
107
|
*
|
@@ -118,7 +119,6 @@ function readModulePackageJsonWithoutFallbacks(moduleSpecifier, requirePaths = (
|
|
118
119
|
packageJson,
|
119
120
|
};
|
120
121
|
}
|
121
|
-
exports.readModulePackageJsonWithoutFallbacks = readModulePackageJsonWithoutFallbacks;
|
122
122
|
/**
|
123
123
|
* Reads the package.json file for a specified module.
|
124
124
|
*
|
@@ -160,4 +160,3 @@ function readModulePackageJson(moduleSpecifier, requirePaths = (0, installation_
|
|
160
160
|
path: packageJsonPath,
|
161
161
|
};
|
162
162
|
}
|
163
|
-
exports.readModulePackageJson = readModulePackageJson;
|
@@ -1,6 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.detectPackageManager = detectPackageManager;
|
4
|
+
exports.isWorkspacesEnabled = isWorkspacesEnabled;
|
5
|
+
exports.getPackageManagerCommand = getPackageManagerCommand;
|
6
|
+
exports.getPackageManagerVersion = getPackageManagerVersion;
|
7
|
+
exports.findFileInPackageJsonDirectory = findFileInPackageJsonDirectory;
|
8
|
+
exports.modifyYarnRcYmlToFitNewDirectory = modifyYarnRcYmlToFitNewDirectory;
|
9
|
+
exports.modifyYarnRcToFitNewDirectory = modifyYarnRcToFitNewDirectory;
|
10
|
+
exports.copyPackageManagerConfigurationFiles = copyPackageManagerConfigurationFiles;
|
11
|
+
exports.createTempNpmDirectory = createTempNpmDirectory;
|
12
|
+
exports.resolvePackageVersionUsingRegistry = resolvePackageVersionUsingRegistry;
|
13
|
+
exports.resolvePackageVersionUsingInstallation = resolvePackageVersionUsingInstallation;
|
14
|
+
exports.packageRegistryView = packageRegistryView;
|
15
|
+
exports.packageRegistryPack = packageRegistryPack;
|
4
16
|
const child_process_1 = require("child_process");
|
5
17
|
const fs_1 = require("fs");
|
6
18
|
const fs_extra_1 = require("fs-extra");
|
@@ -28,7 +40,6 @@ function detectPackageManager(dir = '') {
|
|
28
40
|
? 'pnpm'
|
29
41
|
: 'npm'));
|
30
42
|
}
|
31
|
-
exports.detectPackageManager = detectPackageManager;
|
32
43
|
/**
|
33
44
|
* Returns true if the workspace is using npm workspaces, yarn workspaces, or pnpm workspaces.
|
34
45
|
* @param packageManager The package manager to use. If not provided, it will be detected based on the lock file.
|
@@ -42,7 +53,6 @@ function isWorkspacesEnabled(packageManager = detectPackageManager(), root = wor
|
|
42
53
|
const packageJson = (0, file_utils_1.readPackageJson)();
|
43
54
|
return !!packageJson?.workspaces;
|
44
55
|
}
|
45
|
-
exports.isWorkspacesEnabled = isWorkspacesEnabled;
|
46
56
|
/**
|
47
57
|
* Returns commands for the package manager used in the workspace.
|
48
58
|
* By default, the package manager is derived based on the lock file,
|
@@ -155,7 +165,6 @@ function getPackageManagerCommand(packageManager = detectPackageManager(), root
|
|
155
165
|
};
|
156
166
|
return commands[packageManager]();
|
157
167
|
}
|
158
|
-
exports.getPackageManagerCommand = getPackageManagerCommand;
|
159
168
|
/**
|
160
169
|
* Returns the version of the package manager used in the workspace.
|
161
170
|
* By default, the package manager is derived based on the lock file,
|
@@ -186,7 +195,6 @@ function getPackageManagerVersion(packageManager = detectPackageManager(), cwd =
|
|
186
195
|
}
|
187
196
|
return version;
|
188
197
|
}
|
189
|
-
exports.getPackageManagerVersion = getPackageManagerVersion;
|
190
198
|
/**
|
191
199
|
* Checks for a project level npmrc file by crawling up the file tree until
|
192
200
|
* hitting a package.json file, as this is how npm finds them as well.
|
@@ -198,7 +206,6 @@ function findFileInPackageJsonDirectory(file, directory = process.cwd()) {
|
|
198
206
|
const path = (0, path_1.join)(directory, file);
|
199
207
|
return (0, fs_1.existsSync)(path) ? path : null;
|
200
208
|
}
|
201
|
-
exports.findFileInPackageJsonDirectory = findFileInPackageJsonDirectory;
|
202
209
|
/**
|
203
210
|
* We copy yarnrc.yml to the temporary directory to ensure things like the specified
|
204
211
|
* package registry are still used. However, there are a few relative paths that can
|
@@ -224,7 +231,6 @@ function modifyYarnRcYmlToFitNewDirectory(contents) {
|
|
224
231
|
}
|
225
232
|
return stringifySyml(parsed);
|
226
233
|
}
|
227
|
-
exports.modifyYarnRcYmlToFitNewDirectory = modifyYarnRcYmlToFitNewDirectory;
|
228
234
|
/**
|
229
235
|
* We copy .yarnrc to the temporary directory to ensure things like the specified
|
230
236
|
* package registry are still used. However, there are a few relative paths that can
|
@@ -243,7 +249,6 @@ function modifyYarnRcToFitNewDirectory(contents) {
|
|
243
249
|
}
|
244
250
|
return lines.join('\n');
|
245
251
|
}
|
246
|
-
exports.modifyYarnRcToFitNewDirectory = modifyYarnRcToFitNewDirectory;
|
247
252
|
function copyPackageManagerConfigurationFiles(root, destination) {
|
248
253
|
for (const packageManagerConfigFile of [
|
249
254
|
'.npmrc',
|
@@ -281,7 +286,6 @@ function copyPackageManagerConfigurationFiles(root, destination) {
|
|
281
286
|
}
|
282
287
|
}
|
283
288
|
}
|
284
|
-
exports.copyPackageManagerConfigurationFiles = copyPackageManagerConfigurationFiles;
|
285
289
|
/**
|
286
290
|
* Creates a temporary directory where you can run package manager commands safely.
|
287
291
|
*
|
@@ -304,7 +308,6 @@ function createTempNpmDirectory() {
|
|
304
308
|
};
|
305
309
|
return { dir, cleanup };
|
306
310
|
}
|
307
|
-
exports.createTempNpmDirectory = createTempNpmDirectory;
|
308
311
|
/**
|
309
312
|
* Returns the resolved version for a given package and version tag using the
|
310
313
|
* NPM registry (when using Yarn it will fall back to NPM to fetch the info).
|
@@ -337,7 +340,6 @@ async function resolvePackageVersionUsingRegistry(packageName, version) {
|
|
337
340
|
throw new Error(`Unable to resolve version ${packageName}@${version}.`);
|
338
341
|
}
|
339
342
|
}
|
340
|
-
exports.resolvePackageVersionUsingRegistry = resolvePackageVersionUsingRegistry;
|
341
343
|
/**
|
342
344
|
* Return the resolved version for a given package and version tag using by
|
343
345
|
* installing it in a temporary directory and fetching the version from the
|
@@ -355,7 +357,6 @@ async function resolvePackageVersionUsingInstallation(packageName, version) {
|
|
355
357
|
await cleanup();
|
356
358
|
}
|
357
359
|
}
|
358
|
-
exports.resolvePackageVersionUsingInstallation = resolvePackageVersionUsingInstallation;
|
359
360
|
async function packageRegistryView(pkg, version, args) {
|
360
361
|
let pm = detectPackageManager();
|
361
362
|
if (pm === 'yarn' || pm === 'bun') {
|
@@ -374,7 +375,6 @@ async function packageRegistryView(pkg, version, args) {
|
|
374
375
|
const { stdout } = await execAsync(`${pm} view ${pkg}@${version} ${args}`);
|
375
376
|
return stdout.toString().trim();
|
376
377
|
}
|
377
|
-
exports.packageRegistryView = packageRegistryView;
|
378
378
|
async function packageRegistryPack(cwd, pkg, version) {
|
379
379
|
let pm = detectPackageManager();
|
380
380
|
if (pm === 'yarn' || pm === 'bun') {
|
@@ -393,4 +393,3 @@ async function packageRegistryPack(cwd, pkg, version) {
|
|
393
393
|
const tarballPath = stdout.trim();
|
394
394
|
return { tarballPath };
|
395
395
|
}
|
396
|
-
exports.packageRegistryPack = packageRegistryPack;
|