nx 21.2.0-beta.1 → 21.2.0-beta.2

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.
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{7148:()=>{}},s=>{var e;e=7148,s(s.s=e)}]);
1
+ "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{932:()=>{}},s=>{var e;e=932,s(s.s=e)}]);
@@ -1,4 +1,5 @@
1
1
  import { ExecutorContext } from '../../config/misc-interfaces';
2
+ import { NoopChildProcess } from '../../tasks-runner/running-tasks/noop-child-process';
2
3
  import { ParallelRunningTasks, SeriallyRunningTasks } from './running-tasks';
3
4
  export declare const LARGE_BUFFER: number;
4
5
  export type Json = {
@@ -54,5 +55,5 @@ export default function (options: RunCommandsOptions, context: ExecutorContext):
54
55
  success: boolean;
55
56
  terminalOutput: string;
56
57
  }>;
57
- export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | ParallelRunningTasks | SeriallyRunningTasks>;
58
+ export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext): Promise<import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | NoopChildProcess | ParallelRunningTasks | SeriallyRunningTasks>;
58
59
  export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean): string;
@@ -7,6 +7,7 @@ exports.interpolateArgsIntoCommand = interpolateArgsIntoCommand;
7
7
  const yargsParser = require("yargs-parser");
8
8
  const is_tui_enabled_1 = require("../../tasks-runner/is-tui-enabled");
9
9
  const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
10
+ const noop_child_process_1 = require("../../tasks-runner/running-tasks/noop-child-process");
10
11
  const running_tasks_1 = require("./running-tasks");
11
12
  exports.LARGE_BUFFER = 1024 * 1000000;
12
13
  const propKeys = [
@@ -45,6 +46,10 @@ async function runCommands(options, context) {
45
46
  !options.parallel) {
46
47
  throw new Error('ERROR: Bad executor config for run-commands - "prefix", "prefixColor", "color" and "bgColor" can only be set when "parallel=true".');
47
48
  }
49
+ // Handle empty commands array - return immediately with success
50
+ if (normalized.commands.length === 0) {
51
+ return new noop_child_process_1.NoopChildProcess({ code: 0, terminalOutput: '' });
52
+ }
48
53
  const isSingleCommand = normalized.commands.length === 1;
49
54
  const usePseudoTerminal = (isSingleCommand || !options.parallel) && pseudo_terminal_1.PseudoTerminal.isSupported();
50
55
  const isSingleCommandAndCanUsePseudoTerminal = isSingleCommand &&
Binary file
@@ -7,4 +7,4 @@ export declare function getURLifShortenFailed(usesGithub: boolean, githubSlug: s
7
7
  export declare function getNxCloudVersion(apiUrl: string): Promise<string | null>;
8
8
  export declare function removeVersionModifier(versionString: string): string;
9
9
  export declare function versionIsValid(version: string): boolean;
10
- export declare function compareCleanCloudVersions(version1: string, version2: string): number;
10
+ export declare function isOldNxCloudVersion(version: string): boolean;
@@ -6,7 +6,7 @@ exports.getURLifShortenFailed = getURLifShortenFailed;
6
6
  exports.getNxCloudVersion = getNxCloudVersion;
7
7
  exports.removeVersionModifier = removeVersionModifier;
8
8
  exports.versionIsValid = versionIsValid;
9
- exports.compareCleanCloudVersions = compareCleanCloudVersions;
9
+ exports.isOldNxCloudVersion = isOldNxCloudVersion;
10
10
  const logger_1 = require("../../utils/logger");
11
11
  const git_utils_1 = require("../../utils/git-utils");
12
12
  const get_cloud_options_1 = require("./get-cloud-options");
@@ -21,8 +21,7 @@ async function createNxCloudOnboardingURL(onboardingSource, accessToken, usesGit
21
21
  }
22
22
  try {
23
23
  const version = await getNxCloudVersion(apiUrl);
24
- if ((version && compareCleanCloudVersions(version, '2406.11.5') < 0) ||
25
- !version) {
24
+ if (!version || isOldNxCloudVersion(version)) {
26
25
  return apiUrl;
27
26
  }
28
27
  }
@@ -96,7 +95,7 @@ async function getInstallationSupportsGitHub(apiUrl) {
96
95
  }
97
96
  catch (e) {
98
97
  if (process.env.NX_VERBOSE_LOGGING === 'true') {
99
- logger_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
98
+ logger_1.logger.warn(`Failed to access system features. GitHub integration assumed to be disabled.
100
99
  ${e}`);
101
100
  }
102
101
  return false;
@@ -131,26 +130,28 @@ function versionIsValid(version) {
131
130
  const pattern = /^\d{4}\.\d{2}\.\d+$/;
132
131
  return pattern.test(version);
133
132
  }
134
- function compareCleanCloudVersions(version1, version2) {
135
- const parseVersion = (version) => {
136
- // The format we're using is YYMM.DD.BuildNumber
137
- const parts = version.split('.').map((part) => parseInt(part, 10));
138
- return {
139
- yearMonth: parts[0],
140
- day: parts[1],
141
- buildNumber: parts[2],
142
- };
143
- };
144
- const v1 = parseVersion(version1);
145
- const v2 = parseVersion(version2);
146
- if (v1.yearMonth !== v2.yearMonth) {
147
- return v1.yearMonth > v2.yearMonth ? 1 : -1;
148
- }
149
- if (v1.day !== v2.day) {
150
- return v1.day > v2.day ? 1 : -1;
151
- }
152
- if (v1.buildNumber !== v2.buildNumber) {
153
- return v1.buildNumber > v2.buildNumber ? 1 : -1;
154
- }
155
- return 0;
133
+ function isOldNxCloudVersion(version) {
134
+ const [major, minor, buildNumber] = version
135
+ .split('.')
136
+ .map((part) => parseInt(part, 10));
137
+ // for on-prem images we are using YYYY.MM.BuildNumber format
138
+ // the first year is 2025
139
+ if (major >= 2025 && major < 2300) {
140
+ return false;
141
+ }
142
+ // Previously we used YYMM.DD.BuildNumber
143
+ // All versions before '2406.11.5' had different URL shortening logic
144
+ const newVersionMajor = 2406;
145
+ const newVersionMinor = 11;
146
+ const newVersionBuildNumber = 5;
147
+ if (major !== newVersionMajor) {
148
+ return major < newVersionMajor;
149
+ }
150
+ if (minor !== newVersionMinor) {
151
+ return minor < newVersionMinor;
152
+ }
153
+ if (buildNumber !== newVersionBuildNumber) {
154
+ return buildNumber < newVersionBuildNumber;
155
+ }
156
+ return false;
156
157
  }
@@ -51,10 +51,13 @@ const getProjectPathsAffectedByDependencyUpdates = (changedLockFile) => {
51
51
  return Array.from(changedProjectPaths);
52
52
  };
53
53
  const getProjectsNamesFromPaths = (projectGraphNodes, projectPaths) => {
54
+ if (!projectPaths.length) {
55
+ return [];
56
+ }
54
57
  const lookup = new RootPathLookup(projectGraphNodes);
55
- return projectPaths.map((path) => {
56
- return lookup.findNodeNameByRoot(path);
57
- });
58
+ return projectPaths
59
+ .map((path) => lookup.findNodeNameByRoot(path))
60
+ .filter(Boolean);
58
61
  };
59
62
  class RootPathLookup {
60
63
  constructor(nodes) {
@@ -772,6 +772,17 @@ function getRunner(nxArgs, nxJson) {
772
772
  }
773
773
  const defaultTasksRunnerPath = require.resolve('./default-tasks-runner');
774
774
  function getTasksRunnerPath(runner, nxJson) {
775
+ // If running inside of Codex, there will be no internet access, so we cannot use the cloud runner, regardless of other config.
776
+ // We can infer this scenario by checking for certain environment variables defined in their base image: https://github.com/openai/codex-universal
777
+ if (process.env.CODEX_ENV_NODE_VERSION) {
778
+ output_1.output.warn({
779
+ title: 'Codex environment detected, using default tasks runner',
780
+ bodyLines: [
781
+ 'Codex does not have internet access when it runs tasks, so Nx will use the default tasks runner and only leverage local caching.',
782
+ ],
783
+ });
784
+ return defaultTasksRunnerPath;
785
+ }
775
786
  const isCloudRunner =
776
787
  // No tasksRunnerOptions for given --runner
777
788
  nxJson.nxCloudAccessToken ||
@@ -11,5 +11,6 @@ export declare class NoopChildProcess implements RunningTask {
11
11
  terminalOutput: string;
12
12
  }>;
13
13
  kill(): void;
14
- onExit(cb: (code: number) => void): void;
14
+ onExit(cb: (code: number, terminalOutput: string) => void): void;
15
+ onOutput(cb: (terminalOutput: string) => void): void;
15
16
  }
@@ -13,7 +13,10 @@ class NoopChildProcess {
13
13
  return;
14
14
  }
15
15
  onExit(cb) {
16
- cb(this.results.code);
16
+ cb(this.results.code, this.results.terminalOutput);
17
+ }
18
+ onOutput(cb) {
19
+ cb(this.results.terminalOutput);
17
20
  }
18
21
  }
19
22
  exports.NoopChildProcess = NoopChildProcess;