nx 20.0.0-beta.4 → 20.0.0-beta.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. package/.eslintrc.json +12 -2
  2. package/migrations.json +0 -37
  3. package/package.json +12 -13
  4. package/src/command-line/release/index.d.ts +5 -2
  5. package/src/command-line/release/publish.d.ts +6 -1
  6. package/src/command-line/release/publish.js +31 -25
  7. package/src/command-line/release/utils/print-changes.js +6 -4
  8. package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -3
  9. package/src/command-line/release/version.d.ts +3 -3
  10. package/src/config/workspace-json-project-json.d.ts +14 -0
  11. package/src/core/graph/main.js +1 -1
  12. package/src/daemon/server/handle-hash-tasks.js +1 -1
  13. package/src/executors/run-commands/run-commands.impl.js +15 -22
  14. package/src/hasher/create-task-hasher.js +1 -1
  15. package/src/hasher/task-hasher.d.ts +2 -6
  16. package/src/hasher/task-hasher.js +6 -32
  17. package/src/native/nx.wasm32-wasi.wasm +0 -0
  18. package/src/nx-cloud/utilities/axios.js +1 -2
  19. package/src/nx-cloud/utilities/onboarding.js +2 -2
  20. package/src/nx-cloud/utilities/url-shorten.js +5 -5
  21. package/src/project-graph/file-utils.d.ts +2 -2
  22. package/src/project-graph/file-utils.js +2 -2
  23. package/src/tasks-runner/cache.d.ts +1 -2
  24. package/src/tasks-runner/cache.js +4 -4
  25. package/src/tasks-runner/create-task-graph.d.ts +2 -0
  26. package/src/tasks-runner/create-task-graph.js +35 -1
  27. package/src/tasks-runner/task-orchestrator.js +1 -1
  28. package/src/utils/git-utils.js +2 -2
  29. package/src/utils/plugins/output.js +1 -1
  30. package/src/hasher/node-task-hasher-impl.d.ts +0 -48
  31. package/src/hasher/node-task-hasher-impl.js +0 -449
  32. package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
  33. package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
  34. package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
  35. package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
  36. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
  37. package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
  38. package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
  39. package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
  40. package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
  41. package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
  42. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
  43. package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = removeRunCommandsOutputPath;
4
- const path_1 = require("../../utils/path");
5
- const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
6
- const json_1 = require("../../generators/utils/json");
7
- const project_configuration_1 = require("../../generators/utils/project-configuration");
8
- async function removeRunCommandsOutputPath(tree) {
9
- for (const [project, configuration] of (0, project_configuration_1.getProjects)(tree).entries()) {
10
- const targets = configuration.targets ?? {};
11
- let changed = false;
12
- for (const [, target] of Object.entries(targets)) {
13
- changed ||= updateTargetBlock(target);
14
- }
15
- if (changed) {
16
- (0, project_configuration_1.updateProjectConfiguration)(tree, project, configuration);
17
- }
18
- }
19
- if (tree.exists('nx.json')) {
20
- (0, json_1.updateJson)(tree, 'nx.json', (json) => {
21
- for (const [, target] of Object.entries(json.targetDefaults ?? {})) {
22
- updateTargetBlock(target);
23
- }
24
- return json;
25
- });
26
- }
27
- await (0, format_changed_files_with_prettier_if_available_1.formatChangedFilesWithPrettierIfAvailable)(tree);
28
- }
29
- function updateTargetBlock(target) {
30
- let changed = false;
31
- if (target.executor === 'nx:run-commands' && target.options?.outputPath) {
32
- changed = true;
33
- const outputs = new Set(target.outputs ?? []);
34
- outputs.delete('{options.outputPath}');
35
- const newOutputs = Array.isArray(target.options.outputPath)
36
- ? target.options.outputPath.map((p) => (0, path_1.joinPathFragments)('{workspaceRoot}', p))
37
- : [(0, path_1.joinPathFragments)('{workspaceRoot}', target.options.outputPath)];
38
- for (const outputPath of newOutputs) {
39
- outputs.add(outputPath);
40
- }
41
- delete target.options.outputPath;
42
- target.outputs = Array.from(outputs);
43
- }
44
- return changed;
45
- }
@@ -1,12 +0,0 @@
1
- import { Tree } from '../../generators/tree';
2
- /**
3
- * This function escapes dollar sign in env variables
4
- * It will go through:
5
- * - '.env', '.local.env', '.env.local'
6
- * - .env.[target-name], .[target-name].env
7
- * - .env.[target-name].[configuration-name], .[target-name].[configuration-name].env
8
- * - .env.[configuration-name], .[configuration-name].env
9
- * at each project root and workspace root
10
- * @param tree
11
- */
12
- export default function escapeDollarSignEnvVariables(tree: Tree): void;
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = escapeDollarSignEnvVariables;
4
- const logger_1 = require("../../utils/logger");
5
- const project_configuration_1 = require("../../generators/utils/project-configuration");
6
- /**
7
- * This function escapes dollar sign in env variables
8
- * It will go through:
9
- * - '.env', '.local.env', '.env.local'
10
- * - .env.[target-name], .[target-name].env
11
- * - .env.[target-name].[configuration-name], .[target-name].[configuration-name].env
12
- * - .env.[configuration-name], .[configuration-name].env
13
- * at each project root and workspace root
14
- * @param tree
15
- */
16
- function escapeDollarSignEnvVariables(tree) {
17
- const envFiles = ['.env', '.local.env', '.env.local'];
18
- for (const [_, configuration] of (0, project_configuration_1.getProjects)(tree).entries()) {
19
- envFiles.push(`${configuration.root}/.env`, `${configuration.root}/.local.env`, `${configuration.root}/.env.local`);
20
- for (const targetName in configuration.targets) {
21
- const task = configuration.targets[targetName];
22
- envFiles.push(`.env.${targetName}`, `.${targetName}.env`, `${configuration.root}/.env.${targetName}`, `${configuration.root}/.${targetName}.env`);
23
- if (task.configurations) {
24
- for (const configurationName in task.configurations) {
25
- envFiles.push(`.env.${targetName}.${configurationName}`, `.${targetName}.${configurationName}.env`, `.env.${configurationName}`, `.${configurationName}.env`, `${configuration.root}/.env.${targetName}.${configurationName}`, `${configuration.root}/.${targetName}.${configurationName}.env`, `${configuration.root}/.env.${configurationName}`, `${configuration.root}/.${configurationName}.env`);
26
- }
27
- }
28
- }
29
- }
30
- for (const envFile of new Set(envFiles)) {
31
- parseEnvFile(tree, envFile);
32
- }
33
- }
34
- /**
35
- * This function parse the env file and escape dollar sign
36
- * @param tree
37
- * @param envFilePath
38
- * @returns
39
- */
40
- function parseEnvFile(tree, envFilePath) {
41
- if (!tree.exists(envFilePath)) {
42
- return;
43
- }
44
- let envFileContent = tree.read(envFilePath, 'utf-8');
45
- if (!envFileContent) {
46
- // envFileContent is null if we fail to read the file for any reason
47
- // e.g. the file is not utf-8 encoded
48
- logger_1.logger.info(`Unable to update ${envFilePath}. Nx interpolates environment variables in the form of $VAR_NAME. To escape the dollar sign, use \\$VAR_NAME.`);
49
- return;
50
- }
51
- envFileContent = envFileContent
52
- .split('\n')
53
- .map((line) => {
54
- line = line.trim();
55
- if (!line || !line.includes('$')) {
56
- return line;
57
- }
58
- const declarations = line.split('=');
59
- if (declarations[1].includes('$') && !declarations[1].includes(`\\$`)) {
60
- declarations[1] = declarations[1].replace('$', `\\$`);
61
- line = declarations.join('=');
62
- }
63
- return line;
64
- })
65
- .join('\n');
66
- tree.write(envFilePath, envFileContent);
67
- }