nx 18.0.3 → 18.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.
@@ -65,7 +65,7 @@ async function runInParallel(options, context) {
65
65
  if (options.readyWhen) {
66
66
  const r = await Promise.race(procs);
67
67
  if (!r.result) {
68
- process.stderr.write(`Warning: run-commands command "${r.command}" exited with non-zero status code`);
68
+ process.stderr.write(`Warning: command "${r.command}" exited with non-zero status code`);
69
69
  return false;
70
70
  }
71
71
  else {
@@ -77,7 +77,7 @@ async function runInParallel(options, context) {
77
77
  const failed = r.filter((v) => !v.result);
78
78
  if (failed.length > 0) {
79
79
  failed.forEach((f) => {
80
- process.stderr.write(`Warning: run-commands command "${f.command}" exited with non-zero status code`);
80
+ process.stderr.write(`Warning: command "${f.command}" exited with non-zero status code`);
81
81
  });
82
82
  return false;
83
83
  }
@@ -107,7 +107,7 @@ async function runSerially(options, context) {
107
107
  for (const c of options.commands) {
108
108
  const success = await createProcess(c, undefined, options.color, calculateCwd(options.cwd, context), options.env ?? {}, false);
109
109
  if (!success) {
110
- process.stderr.write(`Warning: run-commands command "${c.command}" exited with non-zero status code`);
110
+ process.stderr.write(`Warning: command "${c.command}" exited with non-zero status code`);
111
111
  return false;
112
112
  }
113
113
  }
@@ -21,14 +21,10 @@ export declare function registerTsProject(tsConfigPath: string): () => void;
21
21
  * @returns cleanup function
22
22
  * @deprecated This signature will be removed in Nx v19. You should pass the full path to the tsconfig in the first argument.
23
23
  */
24
- export declare function registerTsProject(path: string, configFilename: string,
25
- /**
26
- * @deprecated Do not use this.. it's a 1-off exception
27
- */
28
- useForSwcEnvironmentVariable?: boolean): any;
29
- export declare function getSwcTranspiler(compilerOptions: CompilerOptions, tsConfigPath?: string): (...args: unknown[]) => unknown;
24
+ export declare function registerTsProject(path: string, configFilename: string): any;
25
+ export declare function getSwcTranspiler(compilerOptions: CompilerOptions): (...args: unknown[]) => unknown;
30
26
  export declare function getTsNodeTranspiler(compilerOptions: CompilerOptions): (...args: unknown[]) => unknown;
31
- export declare function getTranspiler(compilerOptions: CompilerOptions, tsConfigPath?: string): () => (...args: unknown[]) => unknown;
27
+ export declare function getTranspiler(compilerOptions: CompilerOptions): () => (...args: unknown[]) => unknown;
32
28
  /**
33
29
  * Register ts-node or swc-node given a set of compiler options.
34
30
  *
@@ -37,7 +33,7 @@ export declare function getTranspiler(compilerOptions: CompilerOptions, tsConfig
37
33
  *
38
34
  * @returns cleanup method
39
35
  */
40
- export declare function registerTranspiler(compilerOptions: CompilerOptions, tsConfigPath?: string): () => void;
36
+ export declare function registerTranspiler(compilerOptions: CompilerOptions): () => void;
41
37
  /**
42
38
  * @param tsConfigPath Adds the paths from a tsconfig file into node resolutions
43
39
  * @returns cleanup function
@@ -3,22 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTsNodeCompilerOptions = exports.registerTsConfigPaths = exports.registerTranspiler = exports.getTranspiler = exports.getTsNodeTranspiler = exports.getSwcTranspiler = exports.registerTsProject = void 0;
4
4
  const path_1 = require("path");
5
5
  const logger_1 = require("../../../utils/logger");
6
- const fs_1 = require("fs");
7
- const workspace_root_1 = require("../../../utils/workspace-root");
8
6
  const swcNodeInstalled = packageIsInstalled('@swc-node/register');
9
7
  const tsNodeInstalled = packageIsInstalled('ts-node/register');
10
8
  let ts;
11
9
  let isTsEsmLoaderRegistered = false;
12
- function registerTsProject(path, configFilename,
13
- /**
14
- * @deprecated Do not use this.. it's a 1-off exception
15
- */
16
- useForSwcEnvironmentVariable) {
10
+ function registerTsProject(path, configFilename) {
17
11
  const tsConfigPath = configFilename ? (0, path_1.join)(path, configFilename) : path;
18
12
  const compilerOptions = readCompilerOptions(tsConfigPath);
19
13
  const cleanupFunctions = [
20
14
  registerTsConfigPaths(tsConfigPath),
21
- registerTranspiler(compilerOptions, useForSwcEnvironmentVariable ? tsConfigPath : undefined),
15
+ registerTranspiler(compilerOptions),
22
16
  ];
23
17
  // Add ESM support for `.ts` files.
24
18
  // NOTE: There is no cleanup function for this, as it's not possible to unregister the loader.
@@ -39,19 +33,10 @@ useForSwcEnvironmentVariable) {
39
33
  };
40
34
  }
41
35
  exports.registerTsProject = registerTsProject;
42
- function getSwcTranspiler(compilerOptions, tsConfigPath) {
36
+ function getSwcTranspiler(compilerOptions) {
43
37
  // These are requires to prevent it from registering when it shouldn't
44
38
  const register = require('@swc-node/register/register')
45
39
  .register;
46
- if (tsConfigPath) {
47
- process.env.SWC_NODE_PROJECT = tsConfigPath;
48
- }
49
- else {
50
- let rootTsConfig = (0, path_1.join)(workspace_root_1.workspaceRoot, 'tsconfig.base.json');
51
- if ((0, fs_1.existsSync)(rootTsConfig)) {
52
- process.env.SWC_NODE_PROJECT = rootTsConfig;
53
- }
54
- }
55
40
  const cleanupFn = register(compilerOptions);
56
41
  return typeof cleanupFn === 'function' ? cleanupFn : () => { };
57
42
  }
@@ -75,7 +60,7 @@ function getTsNodeTranspiler(compilerOptions) {
75
60
  };
76
61
  }
77
62
  exports.getTsNodeTranspiler = getTsNodeTranspiler;
78
- function getTranspiler(compilerOptions, tsConfigPath) {
63
+ function getTranspiler(compilerOptions) {
79
64
  const preferTsNode = process.env.NX_PREFER_TS_NODE === 'true';
80
65
  if (!ts) {
81
66
  ts = require('typescript');
@@ -86,7 +71,7 @@ function getTranspiler(compilerOptions, tsConfigPath) {
86
71
  compilerOptions.inlineSourceMap = true;
87
72
  compilerOptions.skipLibCheck = true;
88
73
  if (swcNodeInstalled && !preferTsNode) {
89
- return () => getSwcTranspiler(compilerOptions, tsConfigPath);
74
+ return () => getSwcTranspiler(compilerOptions);
90
75
  }
91
76
  // We can fall back on ts-node if it's available
92
77
  if (tsNodeInstalled) {
@@ -102,9 +87,9 @@ exports.getTranspiler = getTranspiler;
102
87
  *
103
88
  * @returns cleanup method
104
89
  */
105
- function registerTranspiler(compilerOptions, tsConfigPath) {
90
+ function registerTranspiler(compilerOptions) {
106
91
  // Function to register transpiler that returns cleanup function
107
- const transpiler = getTranspiler(compilerOptions, tsConfigPath);
92
+ const transpiler = getTranspiler(compilerOptions);
108
93
  if (!transpiler) {
109
94
  warnNoTranspiler();
110
95
  return () => { };
@@ -19,6 +19,7 @@ export declare class StaticRunOneTerminalOutputLifeCycle implements LifeCycle {
19
19
  constructor(initiatingProject: string, projectNames: string[], tasks: Task[], args: {
20
20
  targets?: string[];
21
21
  configuration?: string;
22
+ verbose?: boolean;
22
23
  });
23
24
  startCommand(): void;
24
25
  endCommand(): void;
@@ -78,12 +78,20 @@ class StaticRunOneTerminalOutputLifeCycle {
78
78
  }
79
79
  }
80
80
  printTaskTerminalOutput(task, status, terminalOutput) {
81
- if (status === 'success' ||
81
+ const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
82
+ if (this.args.verbose ||
83
+ status === 'success' ||
82
84
  status === 'failure' ||
83
85
  task.target.project === this.initiatingProject) {
84
- const args = (0, utils_1.getPrintableCommandArgsForTask)(task);
85
86
  output_1.output.logCommandOutput(args.join(' '), status, terminalOutput);
86
87
  }
88
+ else {
89
+ /**
90
+ * Do not show the terminal output in the case where it is not the initiating project and verbose is not set,
91
+ * but still print the command that was run and its status (so that cache hits can still be traced).
92
+ */
93
+ output_1.output.logCommandOutput(args.join(' '), status, '');
94
+ }
87
95
  }
88
96
  }
89
97
  exports.StaticRunOneTerminalOutputLifeCycle = StaticRunOneTerminalOutputLifeCycle;