nx 24.0.0-beta.2 → 24.0.0-beta.3
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/dist/bin/post-install.js +5 -3
- package/dist/src/adapter/ngcli-adapter.js +1 -2
- package/dist/src/command-line/add/add.d.ts +2 -0
- package/dist/src/command-line/add/add.js +23 -5
- package/dist/src/command-line/affected/affected.js +2 -2
- package/dist/src/command-line/init/implementation/add-nx-to-nest.js +21 -62
- package/dist/src/command-line/migrate/agentic/definitions.d.ts +1 -3
- package/dist/src/command-line/migrate/agentic/definitions.js +5 -97
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.d.ts +7 -41
- package/dist/src/command-line/migrate/agentic/handoff-gitignore.js +9 -48
- package/dist/src/command-line/migrate/agentic/handoff.d.ts +1 -43
- package/dist/src/command-line/migrate/agentic/handoff.js +3 -119
- package/dist/src/command-line/migrate/agentic/instruction-files.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/instruction-files.js +6 -27
- package/dist/src/command-line/migrate/agentic/master/run-master-session.d.ts +19 -1
- package/dist/src/command-line/migrate/agentic/master/run-master-session.js +63 -36
- package/dist/src/command-line/migrate/agentic/master/spawn-master.d.ts +1 -0
- package/dist/src/command-line/migrate/agentic/master/spawn-master.js +7 -5
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.d.ts +2 -2
- package/dist/src/command-line/migrate/agentic/print-dropped-agent-context.js +2 -2
- package/dist/src/command-line/migrate/agentic/prompts/fragments.d.ts +1 -12
- package/dist/src/command-line/migrate/agentic/prompts/fragments.js +8 -17
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.d.ts +0 -15
- package/dist/src/command-line/migrate/agentic/prompts/shared-rendering.js +3 -100
- package/dist/src/command-line/migrate/agentic/select.d.ts +12 -6
- package/dist/src/command-line/migrate/agentic/select.js +35 -5
- package/dist/src/command-line/migrate/agentic/types.d.ts +9 -68
- package/dist/src/command-line/migrate/agentic/types.js +5 -5
- package/dist/src/command-line/migrate/command-object.js +3 -3
- package/dist/src/command-line/migrate/migrate-analytics.d.ts +12 -1
- package/dist/src/command-line/migrate/migrate-analytics.js +26 -0
- package/dist/src/command-line/migrate/migrate-commits.d.ts +9 -10
- package/dist/src/command-line/migrate/migrate-commits.js +25 -18
- package/dist/src/command-line/migrate/migrate-output.d.ts +1 -6
- package/dist/src/command-line/migrate/migrate-output.js +1 -10
- package/dist/src/command-line/migrate/migrate.js +16 -27
- package/dist/src/command-line/migrate/run/agent-output.d.ts +1 -0
- package/dist/src/command-line/migrate/run/agent-output.js +4 -0
- package/dist/src/command-line/migrate/run/broker.js +1 -1
- package/dist/src/command-line/migrate/run/give-up.d.ts +4 -3
- package/dist/src/command-line/migrate/run/give-up.js +8 -5
- package/dist/src/command-line/migrate/run/index.d.ts +2 -1
- package/dist/src/command-line/migrate/run/index.js +5 -1
- package/dist/src/command-line/migrate/run/issues.js +7 -2
- package/dist/src/command-line/migrate/run/orchestrator.d.ts +40 -4
- package/dist/src/command-line/migrate/run/orchestrator.js +233 -92
- package/dist/src/command-line/migrate/run/run-state.d.ts +4 -1
- package/dist/src/command-line/migrate/run/run-state.js +20 -2
- package/dist/src/command-line/migrate/run/runbook.d.ts +1 -0
- package/dist/src/command-line/migrate/run/runbook.js +99 -21
- package/dist/src/command-line/migrate/run/state-lock.d.ts +29 -4
- package/dist/src/command-line/migrate/run/state-lock.js +102 -10
- package/dist/src/command-line/migrate/run/util.d.ts +4 -2
- package/dist/src/command-line/migrate/run/util.js +23 -2
- package/dist/src/command-line/migrate/run/worker.d.ts +1 -1
- package/dist/src/command-line/migrate/run/worker.js +252 -250
- package/dist/src/command-line/release/changelog.js +9 -6
- package/dist/src/command-line/release/config/config.d.ts +1 -0
- package/dist/src/command-line/release/config/config.js +48 -9
- package/dist/src/command-line/release/release.js +2 -2
- package/dist/src/command-line/release/utils/git.js +8 -7
- package/dist/src/command-line/release/utils/interpolate-release-config.d.ts +6 -0
- package/dist/src/command-line/release/utils/interpolate-release-config.js +39 -0
- package/dist/src/command-line/release/utils/release-graph.d.ts +5 -0
- package/dist/src/command-line/release/utils/release-graph.js +1 -0
- package/dist/src/command-line/release/utils/resolve-changelog-renderer.js +2 -2
- package/dist/src/command-line/release/utils/shared.js +10 -10
- package/dist/src/command-line/release/utils/version-plan-utils.d.ts +3 -12
- package/dist/src/command-line/release/utils/version-plan-utils.js +33 -55
- package/dist/src/command-line/release/version/version-actions.js +2 -1
- package/dist/src/command-line/release/version.js +5 -2
- package/dist/src/command-line/show/projects.js +5 -3
- package/dist/src/command-line/yargs-utils/shared-options.js +1 -1
- package/dist/src/config/nx-json.d.ts +8 -5
- package/dist/src/config/workspace-json-project-json.d.ts +12 -9
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/devkit-exports.d.ts +4 -0
- package/dist/src/devkit-exports.js +6 -1
- package/dist/src/devkit-internals.d.ts +1 -1
- package/dist/src/devkit-internals.js +4 -3
- package/dist/src/executors/run-commands/run-commands.impl.d.ts +2 -2
- package/dist/src/executors/run-commands/run-commands.impl.js +20 -10
- package/dist/src/executors/run-commands/running-tasks.d.ts +12 -3
- package/dist/src/executors/run-commands/running-tasks.js +22 -18
- package/dist/src/hasher/check-task-files.js +1 -4
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.d.ts +1 -2
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.js +6 -11
- package/dist/src/migrations/update-23-2-0/set-cache-on-executor-target-defaults.md +2 -2
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.js +15 -0
- package/dist/src/migrations/update-24-0-0/enable-legacy-affected.md +30 -0
- package/dist/src/migrations/update-24-0-0/move-custom-hashers-to-inputs.md +7 -6
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.d.ts +3 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.js +130 -0
- package/dist/src/migrations/update-24-0-0/rename-ultracache-ignore-options.md +62 -0
- package/dist/src/native/index.d.ts +3 -3
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +1 -3
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +2 -2
- package/dist/src/plugins/js/lock-file/pruned-output.js +4 -4
- package/dist/src/project-graph/affected/affected-tasks.d.ts +6 -5
- package/dist/src/project-graph/affected/affected-tasks.js +16 -6
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +7 -133
- package/dist/src/project-graph/utils/project-configuration-utils.js +2 -2
- package/dist/src/tasks-runner/readiness/probes.js +30 -1
- package/dist/src/tasks-runner/readiness/ready-when.d.ts +31 -10
- package/dist/src/tasks-runner/readiness/ready-when.js +178 -41
- package/dist/src/tasks-runner/task-orchestrator.d.ts +4 -0
- package/dist/src/tasks-runner/task-orchestrator.js +113 -38
- package/dist/src/tasks-runner/tokens.d.ts +54 -0
- package/dist/src/tasks-runner/tokens.js +161 -0
- package/dist/src/tasks-runner/utils.d.ts +15 -1
- package/dist/src/tasks-runner/utils.js +79 -33
- package/dist/src/utils/acknowledge-build-scripts.d.ts +34 -1
- package/dist/src/utils/acknowledge-build-scripts.js +171 -32
- package/dist/src/utils/long-running-target.d.ts +1 -3
- package/dist/src/utils/long-running-target.js +1 -3
- package/migrations.json +13 -6
- package/package.json +11 -11
- package/schemas/nx-schema.json +17 -11
- package/schemas/project-schema.json +8 -7
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.d.ts +0 -56
- package/dist/src/command-line/migrate/agentic/prompts/generic-validation.js +0 -67
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.d.ts +0 -49
- package/dist/src/command-line/migrate/agentic/prompts/hybrid-prompt-migration.js +0 -53
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.d.ts +0 -26
- package/dist/src/command-line/migrate/agentic/prompts/prompt-migration.js +0 -27
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.d.ts +0 -70
- package/dist/src/command-line/migrate/agentic/prompts/system-prompt.js +0 -113
- package/dist/src/command-line/migrate/agentic/run-step.d.ts +0 -68
- package/dist/src/command-line/migrate/agentic/run-step.js +0 -148
- package/dist/src/command-line/migrate/agentic/runner.d.ts +0 -21
- package/dist/src/command-line/migrate/agentic/runner.js +0 -262
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.d.ts +0 -9
- package/dist/src/migrations/update-23-0-0/consolidate-release-tag-config.js +0 -18
|
@@ -46,6 +46,10 @@ export type { PackageManager } from './utils/package-manager';
|
|
|
46
46
|
* @category Package Manager
|
|
47
47
|
*/
|
|
48
48
|
export { detectPackageManager, getPackageManagerCommand, getPackageManagerVersion, isWorkspacesEnabled, } from './utils/package-manager';
|
|
49
|
+
/**
|
|
50
|
+
* @category Package Manager
|
|
51
|
+
*/
|
|
52
|
+
export { acknowledgeBuildScripts } from './utils/acknowledge-build-scripts';
|
|
49
53
|
/**
|
|
50
54
|
* @category Commands
|
|
51
55
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Try hard to not add to this API to reduce the surface area we need to maintain.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.isDaemonEnabled = exports.createProjectFileMapUsingProjectGraph = exports.cacheDir = exports.hashArray = exports.defaultTasksRunner = exports.getOutputsForTargetAndConfiguration = exports.readProjectsConfigurationFromProjectGraph = exports.readCachedProjectGraph = exports.createProjectGraphAsync = exports.reverse = exports.workspaceRoot = exports.normalizePath = exports.joinPathFragments = exports.stripIndents = exports.writeJsonFile = exports.readJsonFile = exports.stripJsonComments = exports.serializeJson = exports.parseJson = exports.writeJson = exports.updateJson = exports.readJson = exports.validateDependency = exports.DependencyType = exports.updateNxJson = exports.readNxJson = exports.globAsync = exports.glob = exports.updateProjectConfiguration = exports.removeProjectConfiguration = exports.readProjectConfiguration = exports.getProjects = exports.addProjectConfiguration = exports.runExecutor = exports.isWorkspacesEnabled = exports.getPackageManagerVersion = exports.getPackageManagerCommand = exports.detectPackageManager = exports.output = exports.logger = exports.createNodesFromFiles = exports.StaleProjectGraphCacheError = exports.AggregateCreateNodesError = exports.workspaceLayout = void 0;
|
|
7
|
+
exports.isDaemonEnabled = exports.createProjectFileMapUsingProjectGraph = exports.cacheDir = exports.hashArray = exports.defaultTasksRunner = exports.getOutputsForTargetAndConfiguration = exports.readProjectsConfigurationFromProjectGraph = exports.readCachedProjectGraph = exports.createProjectGraphAsync = exports.reverse = exports.workspaceRoot = exports.normalizePath = exports.joinPathFragments = exports.stripIndents = exports.writeJsonFile = exports.readJsonFile = exports.stripJsonComments = exports.serializeJson = exports.parseJson = exports.writeJson = exports.updateJson = exports.readJson = exports.validateDependency = exports.DependencyType = exports.updateNxJson = exports.readNxJson = exports.globAsync = exports.glob = exports.updateProjectConfiguration = exports.removeProjectConfiguration = exports.readProjectConfiguration = exports.getProjects = exports.addProjectConfiguration = exports.runExecutor = exports.acknowledgeBuildScripts = exports.isWorkspacesEnabled = exports.getPackageManagerVersion = exports.getPackageManagerCommand = exports.detectPackageManager = exports.output = exports.logger = exports.createNodesFromFiles = exports.StaleProjectGraphCacheError = exports.AggregateCreateNodesError = exports.workspaceLayout = void 0;
|
|
8
8
|
var configuration_1 = require("./config/configuration");
|
|
9
9
|
Object.defineProperty(exports, "workspaceLayout", { enumerable: true, get: function () { return configuration_1.workspaceLayout; } });
|
|
10
10
|
var error_types_1 = require("./project-graph/error-types");
|
|
@@ -30,6 +30,11 @@ Object.defineProperty(exports, "detectPackageManager", { enumerable: true, get:
|
|
|
30
30
|
Object.defineProperty(exports, "getPackageManagerCommand", { enumerable: true, get: function () { return package_manager_1.getPackageManagerCommand; } });
|
|
31
31
|
Object.defineProperty(exports, "getPackageManagerVersion", { enumerable: true, get: function () { return package_manager_1.getPackageManagerVersion; } });
|
|
32
32
|
Object.defineProperty(exports, "isWorkspacesEnabled", { enumerable: true, get: function () { return package_manager_1.isWorkspacesEnabled; } });
|
|
33
|
+
/**
|
|
34
|
+
* @category Package Manager
|
|
35
|
+
*/
|
|
36
|
+
var acknowledge_build_scripts_1 = require("./utils/acknowledge-build-scripts");
|
|
37
|
+
Object.defineProperty(exports, "acknowledgeBuildScripts", { enumerable: true, get: function () { return acknowledge_build_scripts_1.acknowledgeBuildScripts; } });
|
|
33
38
|
/**
|
|
34
39
|
* @category Commands
|
|
35
40
|
*/
|
|
@@ -63,7 +63,7 @@ export { resolveImplementation, resolveSchema, ImplementationResolutionError, Sc
|
|
|
63
63
|
export { resolvePrompt, PromptResolutionError, } from './command-line/migrate/prompt-files';
|
|
64
64
|
export { checkFilesAreInputs, checkFilesAreOutputs, } from './hasher/check-task-files';
|
|
65
65
|
export { getCatalogManager, getCatalogDependenciesFromPackageJson, } from './utils/catalog';
|
|
66
|
-
export { acknowledgeBuildScripts } from './utils/acknowledge-build-scripts';
|
|
66
|
+
export { acknowledgeBuildScripts, acknowledgeDeclaredBuildScripts, } from './utils/acknowledge-build-scripts';
|
|
67
67
|
export { default as runCommandsExecutor } from './executors/run-commands/run-commands.impl';
|
|
68
68
|
export type { TaskResult } from './config/misc-interfaces';
|
|
69
69
|
export { toNewFormat, toOldFormat } from './adapter/angular-json';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDaemonClientEnvGeneration = exports.hashDaemonClientEnv = exports.getEnvPathsForTask = exports.getGraphTimeDotEnvForTask = exports.getEnvFilesForTask = exports.interpolate = exports.requireWithTsconfigFallback = exports.isTsEsmNamedExportLinkageError = exports.isRequireInEsmScopeError = exports.forceRegisterEsmLoader = exports.loadTsFile = exports.registerTsProject = exports.LoadedNxPlugin = exports.retrieveProjectConfigurations = exports.findProjectForPath = exports.createProjectRootMappings = exports.createProjectRootMappingsFromProjectConfigurations = exports.hashMultiGlobWithWorkspaceContext = exports.hashWithWorkspaceContext = exports.hashObject = exports.splitByColons = exports.installPackageToTmpAsync = exports.installPackageToTmp = exports.readModulePackageJson = exports.stripIndent = exports.sortObjectByKeys = exports.combineOptionsForExecutor = exports.confirmationPrompt = exports.textPrompt = exports.multiselectPrompt = exports.selectPrompt = exports.splitTarget = exports.createPrettierIgnoreChecker = exports.createOxfmtIgnoreChecker = exports.createGitIgnoreChecker = exports.readTargetDefaultsForTarget = exports.createTargetDefaultsResults = exports.findMatchingProjects = exports.findMatchingConfigFiles = exports.readProjectConfigurationsFromRootMap = exports.findMatchingTargetNames = exports.resolveCommandSyntacticSugar = exports.mergeTargetConfigurations = exports.retrieveProjectConfigurationsWithAngularProjects = exports.calculateDefaultProjectName = exports.readNxJsonFromDisk = exports.parseExecutor = exports.getExecutorInformation = exports.parseVersionFromPackageManagerField = exports.createTempNpmDirectory = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.safeSpawn = exports.safeExecFileSync = exports.workspaceRootInner = exports.setWorkspaceRoot = exports.setupWorkspaceContext = exports.resetWorkspaceContext = exports.globWithWorkspaceContext = exports.getFilesInDirectoryUsingContext = exports.nxVersion = exports.SyncError = exports.quoteShellArg = exports.getSourceDirOfDependentProjects = exports.findAllProjectNodeDependencies = exports.findInstalledPlugins = exports.deriveGroupNameFromTarget = exports.warnUnshippableLocalPathSpec = exports.relocatePrunedLocalPathSpec = exports.movePeerDependencyToDependencies = exports.dropEmptyPeerDependencySections = exports.readNxMigrateConfig = exports.isNxCloudUsed = exports.getNxCloudUrl = exports.orange = exports.NX_PREFIX = exports.getNxRequirePaths = exports.isGlobPattern = exports.combineGlobPatterns = exports.getLatestCommitSha = exports.readFileIfExisting = exports.isRelativePath = exports.fileExists = exports.directoryExists = exports.createDirectory = exports.deduceDefaultBase = exports.codeFrameColumns = exports.runNxSync = exports.workspaceDataDirectory = exports.getLastValueFromAsyncIterableIterator = exports.validateOutputs = exports.unparse = exports.transformLegacyOutputs = exports.shouldStreamOutput = exports.removeTasksFromTaskGraph = exports.readProjectAndTargetFromTargetString = exports.normalizeTargetDependencyWithStringProjects = exports.normalizeDependencyConfigProjects = exports.normalizeDependencyConfigDefinition = exports.isCacheableTask = exports.getUnparsedOverrideArgs = void 0;
|
|
4
|
+
exports.killChildOnHostExit = exports.killProcessTreeGraceful = exports.isAiAgent = exports.getTargetInputs = exports.filterUsingGlobPatterns = exports.hashFile = exports.getRelativeProjectJsonSchemaPath = exports.FsTree = exports.LARGE_BUFFER = exports.daemonClient = exports.isProjectGraphProjectNode = exports.isProjectGraphExternalNode = exports.fileDataDepType = exports.fileDataDepTarget = exports.BatchFunctionRunner = exports.getGeneratorInformation = exports.setupAiAgentsGenerator = exports.toOldFormat = exports.toNewFormat = exports.runCommandsExecutor = exports.acknowledgeDeclaredBuildScripts = exports.acknowledgeBuildScripts = exports.getCatalogDependenciesFromPackageJson = exports.getCatalogManager = exports.checkFilesAreOutputs = exports.checkFilesAreInputs = exports.PromptResolutionError = exports.resolvePrompt = exports.SchemaResolutionError = exports.ImplementationResolutionError = exports.resolveSchema = exports.resolveImplementation = exports.emitPluginWorkerLog = exports.safeWriteFileCache = exports.PluginCache = exports.handleImport = exports.signalToCode = exports.globalSpinner = exports.readYamlFile = exports.oxfmtConfigFiles = exports.formatFilesWithOxfmt = exports.detectFormatterInTree = exports.detectFormatter = exports.prettierConfigFiles = exports.isUsingPrettierInTree = exports.createOverrides = exports.createCliOptions = exports.isCI = exports.applyDaemonEnvFromClient = exports.getAppliedDaemonClientEnv = void 0;
|
|
5
|
+
exports.getSerializedArgsForTask = exports.getPrintableCommandArgsForTask = exports.getOutputs = exports.getExecutorNameForTask = exports.getExecutorForTask = exports.getDependencyConfigs = exports.getCustomHasher = exports.getCliPath = exports.expandWildcardTargetConfiguration = exports.expandInitiatingTasksThroughNoop = exports.expandDependencyConfigSyntaxSugar = exports.createTaskId = exports.calculateReverseDeps = exports.createRunManyDynamicOutputRenderer = exports.CompositeLifeCycle = exports.RemoteCacheV2 = exports.Cache = exports.readCachedProjectConfiguration = exports.preventRecursionInGraphConstruction = exports.handleProjectGraphError = exports.createProjectGraphAndSourceMapsAsync = exports.buildProjectGraphAndSourceMapsWithoutDaemon = exports.isNpmProject = exports.readFileMapCache = exports.readPackageJson = exports.isWholeFileChange = exports.isLockFileChange = exports.isDeletedFileChange = exports.defaultFileRead = exports.calculateFileChanges = exports.WholeFileChange = exports.TEN_MEGABYTES = exports.LockFileChange = exports.DeletedFileChange = exports.buildPackageJsonWorkspacesMatcher = exports.buildPackageJsonPatterns = exports.getGlobPatternsFromPackageManagerWorkspaces = exports.registerTsConfigPaths = exports.getWorkspacePackagesFromGraph = exports.isBuiltinModuleImport = exports.TargetProjectLocator = exports.findProjectsNpmDependencies = exports.createPackageJson = exports.getLockFileName = exports.generatePrunedDeployOutput = exports.createLockFile = exports.createNxCloudOnboardingURL = exports.getNxCloudAppOnBoardingUrl = exports.createNxCloudOnboardingURLForWelcomeApp = exports.connectToNxCloud = void 0;
|
|
6
|
+
exports.safeSpawn = exports.safeExecFileSync = exports.workspaceRootInner = exports.setWorkspaceRoot = exports.setupWorkspaceContext = exports.resetWorkspaceContext = exports.globWithWorkspaceContext = exports.getFilesInDirectoryUsingContext = exports.nxVersion = exports.SyncError = exports.quoteShellArg = exports.getSourceDirOfDependentProjects = exports.findAllProjectNodeDependencies = exports.findInstalledPlugins = exports.deriveGroupNameFromTarget = exports.warnUnshippableLocalPathSpec = exports.relocatePrunedLocalPathSpec = exports.movePeerDependencyToDependencies = exports.dropEmptyPeerDependencySections = exports.readNxMigrateConfig = exports.isNxCloudUsed = exports.getNxCloudUrl = exports.orange = exports.NX_PREFIX = exports.getNxRequirePaths = exports.isGlobPattern = exports.combineGlobPatterns = exports.getLatestCommitSha = exports.readFileIfExisting = exports.isRelativePath = exports.fileExists = exports.directoryExists = exports.createDirectory = exports.deduceDefaultBase = exports.codeFrameColumns = exports.runNxSync = exports.workspaceDataDirectory = exports.getLastValueFromAsyncIterableIterator = exports.validateOutputs = exports.unparse = exports.transformLegacyOutputs = exports.shouldStreamOutput = exports.removeTasksFromTaskGraph = exports.readProjectAndTargetFromTargetString = exports.normalizeTargetDependencyWithStringProjects = exports.normalizeDependencyConfigProjects = exports.normalizeDependencyConfigDefinition = exports.isCacheableTask = exports.getUnparsedOverrideArgs = exports.getTargetConfigurationForTask = void 0;
|
|
7
7
|
const tslib_1 = require("tslib");
|
|
8
8
|
/**
|
|
9
9
|
* Note to developers: STOP! These are nx internals, not part of the public
|
|
@@ -154,6 +154,7 @@ Object.defineProperty(exports, "getCatalogManager", { enumerable: true, get: fun
|
|
|
154
154
|
Object.defineProperty(exports, "getCatalogDependenciesFromPackageJson", { enumerable: true, get: function () { return catalog_1.getCatalogDependenciesFromPackageJson; } });
|
|
155
155
|
var acknowledge_build_scripts_1 = require("./utils/acknowledge-build-scripts");
|
|
156
156
|
Object.defineProperty(exports, "acknowledgeBuildScripts", { enumerable: true, get: function () { return acknowledge_build_scripts_1.acknowledgeBuildScripts; } });
|
|
157
|
+
Object.defineProperty(exports, "acknowledgeDeclaredBuildScripts", { enumerable: true, get: function () { return acknowledge_build_scripts_1.acknowledgeDeclaredBuildScripts; } });
|
|
157
158
|
// Exposed for first-party plugins in this repo (imported via @nx/devkit/internal).
|
|
158
159
|
var run_commands_impl_1 = require("./executors/run-commands/run-commands.impl");
|
|
159
160
|
Object.defineProperty(exports, "runCommandsExecutor", { enumerable: true, get: function () { return tslib_1.__importDefault(run_commands_impl_1).default; } });
|
|
@@ -56,5 +56,5 @@ export default function (options: RunCommandsOptions, context: ExecutorContext):
|
|
|
56
56
|
success: boolean;
|
|
57
57
|
terminalOutput: string;
|
|
58
58
|
}>;
|
|
59
|
-
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext, task?: Pick<Task, 'id' | 'ultracache'
|
|
60
|
-
export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean): string;
|
|
59
|
+
export declare function runCommands(options: RunCommandsOptions, context: ExecutorContext, task?: Pick<Task, 'id' | 'ultracache'>, baseEnv?: NodeJS.ProcessEnv): Promise<NoopChildProcess | ParallelRunningTasks | import("../../tasks-runner/pseudo-terminal").PseudoTtyProcess | SeriallyRunningTasks>;
|
|
60
|
+
export declare function interpolateArgsIntoCommand(command: string, opts: Pick<NormalizedRunCommandsOptions, 'args' | 'parsedArgs' | '__unparsed__' | 'unknownOptions' | 'unparsedCommandArgs'>, forwardAllArgs: boolean, env?: () => NodeJS.ProcessEnv): string;
|
|
@@ -8,6 +8,7 @@ const tslib_1 = require("tslib");
|
|
|
8
8
|
const yargs_parser_1 = tslib_1.__importDefault(require("yargs-parser"));
|
|
9
9
|
const is_tui_enabled_1 = require("../../tasks-runner/is-tui-enabled");
|
|
10
10
|
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
|
11
|
+
const tokens_1 = require("../../tasks-runner/tokens");
|
|
11
12
|
const utils_1 = require("../../tasks-runner/utils");
|
|
12
13
|
const noop_child_process_1 = require("../../tasks-runner/running-tasks/noop-child-process");
|
|
13
14
|
const running_tasks_1 = require("./running-tasks");
|
|
@@ -40,8 +41,9 @@ async function default_1(options, context) {
|
|
|
40
41
|
success: results.code === 0,
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
|
-
async function runCommands(options, context, task) {
|
|
44
|
-
|
|
44
|
+
async function runCommands(options, context, task, baseEnv) {
|
|
45
|
+
let env;
|
|
46
|
+
const normalized = normalizeOptions(options, () => (env ??= (0, running_tasks_1.processEnv)(options.color, (0, running_tasks_1.calculateCwd)(options.cwd, context), options.env ?? {}, options.envFile, baseEnv)));
|
|
45
47
|
if (normalized.readyWhenStatus.length && !normalized.parallel) {
|
|
46
48
|
throw new Error('ERROR: Bad executor config for run-commands - "readyWhen" can only be used when "parallel=true".');
|
|
47
49
|
}
|
|
@@ -79,10 +81,10 @@ async function runCommands(options, context, task) {
|
|
|
79
81
|
: undefined,
|
|
80
82
|
};
|
|
81
83
|
const runningTask = isSingleCommandAndCanUsePseudoTerminal
|
|
82
|
-
? await (0, running_tasks_1.runSingleCommandWithPseudoTerminal)(normalized, context, resolvedTask)
|
|
84
|
+
? await (0, running_tasks_1.runSingleCommandWithPseudoTerminal)(normalized, context, resolvedTask, baseEnv)
|
|
83
85
|
: options.parallel
|
|
84
|
-
? new running_tasks_1.ParallelRunningTasks(normalized, context, resolvedTask)
|
|
85
|
-
: new running_tasks_1.SeriallyRunningTasks(normalized, context, tuiEnabled, resolvedTask);
|
|
86
|
+
? new running_tasks_1.ParallelRunningTasks(normalized, context, resolvedTask, baseEnv)
|
|
87
|
+
: new running_tasks_1.SeriallyRunningTasks(normalized, context, tuiEnabled, resolvedTask, baseEnv);
|
|
86
88
|
return runningTask;
|
|
87
89
|
}
|
|
88
90
|
catch (e) {
|
|
@@ -92,7 +94,7 @@ async function runCommands(options, context, task) {
|
|
|
92
94
|
throw new Error(`ERROR: Something went wrong in run-commands - ${e.message}`);
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
|
-
function normalizeOptions(options) {
|
|
97
|
+
function normalizeOptions(options, env) {
|
|
96
98
|
if (options.readyWhen && typeof options.readyWhen === 'string') {
|
|
97
99
|
options.readyWhenStatus = [
|
|
98
100
|
{ stringToMatch: options.readyWhen, found: false },
|
|
@@ -135,17 +137,25 @@ function normalizeOptions(options) {
|
|
|
135
137
|
options.parsedArgs = parseArgs(unparsedCommandArgs, options.unknownOptions, options.args);
|
|
136
138
|
options.unparsedCommandArgs = unparsedCommandArgs;
|
|
137
139
|
options.commands.forEach((c) => {
|
|
138
|
-
c.command = interpolateArgsIntoCommand(c.command, options, c.forwardAllArgs ?? options.forwardAllArgs ?? true);
|
|
140
|
+
c.command = interpolateArgsIntoCommand(c.command, options, c.forwardAllArgs ?? options.forwardAllArgs ?? true, env);
|
|
139
141
|
});
|
|
140
142
|
return options;
|
|
141
143
|
}
|
|
142
|
-
function interpolateArgsIntoCommand(command, opts, forwardAllArgs) {
|
|
144
|
+
function interpolateArgsIntoCommand(command, opts, forwardAllArgs, env = () => process.env) {
|
|
143
145
|
if (command.indexOf('{args.') > -1 && command.indexOf('{args}') > -1) {
|
|
144
146
|
throw new Error('Command should not contain both {args} and {args.*} values. Please choose one to use.');
|
|
145
147
|
}
|
|
146
148
|
if (command.indexOf('{args.') > -1) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
return (0, tokens_1.resolveTokens)(command, {
|
|
150
|
+
isToken: (name) => name === 'args',
|
|
151
|
+
// Overrides are parsed without dot-notation, so `{args.a.b}` reads the
|
|
152
|
+
// `--a.b` override
|
|
153
|
+
read: (_, path) => Object.hasOwn(opts.parsedArgs, path)
|
|
154
|
+
? opts.parsedArgs[path]
|
|
155
|
+
: undefined,
|
|
156
|
+
env: { read: env },
|
|
157
|
+
noValue: () => '',
|
|
158
|
+
});
|
|
149
159
|
}
|
|
150
160
|
else if (command.indexOf('{args}') > -1) {
|
|
151
161
|
const regex = /{args}/g;
|
|
@@ -13,7 +13,7 @@ export declare class ParallelRunningTasks implements RunningTask {
|
|
|
13
13
|
private exited;
|
|
14
14
|
private exitCode;
|
|
15
15
|
private exitTerminalOutput;
|
|
16
|
-
constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, task: Pick<Task, 'id' | 'ultracache'
|
|
16
|
+
constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, task: Pick<Task, 'id' | 'ultracache'>, baseEnv?: NodeJS.ProcessEnv);
|
|
17
17
|
getResults(): Promise<{
|
|
18
18
|
code: number;
|
|
19
19
|
terminalOutput: string;
|
|
@@ -29,6 +29,7 @@ export declare class ParallelRunningTasks implements RunningTask {
|
|
|
29
29
|
export declare class SeriallyRunningTasks implements RunningTask {
|
|
30
30
|
private readonly tuiEnabled;
|
|
31
31
|
private readonly task;
|
|
32
|
+
private readonly baseEnv?;
|
|
32
33
|
private terminalOutputChunks;
|
|
33
34
|
private currentProcess;
|
|
34
35
|
private exitCallbacks;
|
|
@@ -37,7 +38,7 @@ export declare class SeriallyRunningTasks implements RunningTask {
|
|
|
37
38
|
private outputCallbacks;
|
|
38
39
|
private exited;
|
|
39
40
|
private exitTerminalOutput;
|
|
40
|
-
constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, tuiEnabled: boolean, task: Pick<Task, 'id' | 'ultracache'
|
|
41
|
+
constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, tuiEnabled: boolean, task: Pick<Task, 'id' | 'ultracache'>, baseEnv?: NodeJS.ProcessEnv);
|
|
41
42
|
private emitExit;
|
|
42
43
|
getResults(): Promise<{
|
|
43
44
|
code: number;
|
|
@@ -50,4 +51,12 @@ export declare class SeriallyRunningTasks implements RunningTask {
|
|
|
50
51
|
private run;
|
|
51
52
|
private createProcess;
|
|
52
53
|
}
|
|
53
|
-
export declare function runSingleCommandWithPseudoTerminal(normalized: NormalizedRunCommandsOptions, context: ExecutorContext, task: Pick<Task, 'id' | 'ultracache'
|
|
54
|
+
export declare function runSingleCommandWithPseudoTerminal(normalized: NormalizedRunCommandsOptions, context: ExecutorContext, task: Pick<Task, 'id' | 'ultracache'>, baseEnv?: NodeJS.ProcessEnv): Promise<PseudoTtyProcess>;
|
|
55
|
+
export declare function calculateCwd(cwd: string | undefined, context: ExecutorContext): string;
|
|
56
|
+
/**
|
|
57
|
+
* Env variables are processed in the following order:
|
|
58
|
+
* - env option from executor options
|
|
59
|
+
* - env file from envFile option if provided
|
|
60
|
+
* - local env variables, read from `baseEnv`
|
|
61
|
+
*/
|
|
62
|
+
export declare function processEnv(color: boolean, cwd: string, envOptionFromExecutor: Record<string, string>, envFile?: string, baseEnv?: NodeJS.ProcessEnv): Record<string, string>;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SeriallyRunningTasks = exports.ParallelRunningTasks = void 0;
|
|
4
4
|
exports.runSingleCommandWithPseudoTerminal = runSingleCommandWithPseudoTerminal;
|
|
5
|
+
exports.calculateCwd = calculateCwd;
|
|
6
|
+
exports.processEnv = processEnv;
|
|
5
7
|
const tslib_1 = require("tslib");
|
|
6
8
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
7
9
|
const child_process_1 = require("child_process");
|
|
@@ -10,6 +12,7 @@ const path_1 = require("path");
|
|
|
10
12
|
const native_1 = require("../../native");
|
|
11
13
|
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
|
12
14
|
const task_env_1 = require("../../tasks-runner/task-env");
|
|
15
|
+
const tokens_1 = require("../../tasks-runner/tokens");
|
|
13
16
|
const task_io_service_1 = require("../../tasks-runner/task-io-service");
|
|
14
17
|
const exit_codes_1 = require("../../utils/exit-codes");
|
|
15
18
|
const output_1 = require("../../utils/output");
|
|
@@ -39,14 +42,14 @@ function commandExitedNonZeroWarning(command) {
|
|
|
39
42
|
return `Warning: command "${command}" exited with non-zero status code`;
|
|
40
43
|
}
|
|
41
44
|
class ParallelRunningTasks {
|
|
42
|
-
constructor(options, context, task) {
|
|
45
|
+
constructor(options, context, task, baseEnv) {
|
|
43
46
|
this.exitCallbacks = [];
|
|
44
47
|
this.outputCallbacks = [];
|
|
45
48
|
// Memoized exit so late getResults()/onExit() callers don't hang.
|
|
46
49
|
this.exited = false;
|
|
47
50
|
this.exitCode = 0;
|
|
48
51
|
this.exitTerminalOutput = '';
|
|
49
|
-
this.childProcesses = options.commands.map((commandConfig) => new RunningNodeProcess(commandConfig, options.color, calculateCwd(options.cwd, context), options.env ?? {}, options.readyWhenStatus, options.streamOutput, options.envFile, task));
|
|
52
|
+
this.childProcesses = options.commands.map((commandConfig) => new RunningNodeProcess(commandConfig, options.color, calculateCwd(options.cwd, context), options.env ?? {}, options.readyWhenStatus, options.streamOutput, options.envFile, task, baseEnv));
|
|
50
53
|
this.readyWhenStatus = options.readyWhenStatus;
|
|
51
54
|
this.streamOutput = options.streamOutput;
|
|
52
55
|
this.run();
|
|
@@ -156,9 +159,10 @@ class ParallelRunningTasks {
|
|
|
156
159
|
}
|
|
157
160
|
exports.ParallelRunningTasks = ParallelRunningTasks;
|
|
158
161
|
class SeriallyRunningTasks {
|
|
159
|
-
constructor(options, context, tuiEnabled, task) {
|
|
162
|
+
constructor(options, context, tuiEnabled, task, baseEnv) {
|
|
160
163
|
this.tuiEnabled = tuiEnabled;
|
|
161
164
|
this.task = task;
|
|
165
|
+
this.baseEnv = baseEnv;
|
|
162
166
|
this.terminalOutputChunks = [];
|
|
163
167
|
this.currentProcess = null;
|
|
164
168
|
this.exitCallbacks = [];
|
|
@@ -225,7 +229,7 @@ class SeriallyRunningTasks {
|
|
|
225
229
|
}
|
|
226
230
|
async run(options, context) {
|
|
227
231
|
for (const c of options.commands) {
|
|
228
|
-
const childProcess = await this.createProcess(c, options.color, calculateCwd(options.cwd, context), options.processEnv ?? options.env ?? {}, this.task, options.usePty, options.streamOutput, options.tty, options.envFile);
|
|
232
|
+
const childProcess = await this.createProcess(c, options.color, calculateCwd(options.cwd, context), options.processEnv ?? options.env ?? {}, this.task, options.usePty, options.streamOutput, options.tty, options.envFile, this.baseEnv);
|
|
229
233
|
this.currentProcess = childProcess;
|
|
230
234
|
childProcess.onOutput((output) => {
|
|
231
235
|
for (const cb of this.outputCallbacks) {
|
|
@@ -244,7 +248,7 @@ class SeriallyRunningTasks {
|
|
|
244
248
|
}
|
|
245
249
|
}
|
|
246
250
|
}
|
|
247
|
-
async createProcess(commandConfig, color, cwd, env, task, usePty = true, streamOutput = true, tty, envFile) {
|
|
251
|
+
async createProcess(commandConfig, color, cwd, env, task, usePty = true, streamOutput = true, tty, envFile, baseEnv) {
|
|
248
252
|
// The rust runCommand is always a tty, so it will not look nice in parallel and if we need prefixes
|
|
249
253
|
// currently does not work properly in windows
|
|
250
254
|
if (process.env.NX_NATIVE_COMMAND_RUNNER !== 'false' &&
|
|
@@ -253,7 +257,7 @@ class SeriallyRunningTasks {
|
|
|
253
257
|
pseudo_terminal_1.PseudoTerminal.isSupported()) {
|
|
254
258
|
const pseudoTerminal = (0, pseudo_terminal_1.createPseudoTerminal)();
|
|
255
259
|
registerProcessListener(this, pseudoTerminal);
|
|
256
|
-
const pseudoTtyProcess = await createProcessWithPseudoTty(pseudoTerminal, commandConfig, color, cwd, env, streamOutput, tty, envFile);
|
|
260
|
+
const pseudoTtyProcess = await createProcessWithPseudoTty(pseudoTerminal, commandConfig, color, cwd, env, streamOutput, tty, envFile, baseEnv);
|
|
257
261
|
// Register process for metrics collection (direct run-commands execution)
|
|
258
262
|
// Skip registration if we're in a forked executor - the fork wrapper already registered
|
|
259
263
|
const pid = pseudoTtyProcess.getPid();
|
|
@@ -262,7 +266,7 @@ class SeriallyRunningTasks {
|
|
|
262
266
|
}
|
|
263
267
|
return pseudoTtyProcess;
|
|
264
268
|
}
|
|
265
|
-
return new RunningNodeProcess(commandConfig, color, cwd, env, [], streamOutput, envFile, task);
|
|
269
|
+
return new RunningNodeProcess(commandConfig, color, cwd, env, [], streamOutput, envFile, task, baseEnv);
|
|
266
270
|
}
|
|
267
271
|
}
|
|
268
272
|
exports.SeriallyRunningTasks = SeriallyRunningTasks;
|
|
@@ -271,7 +275,7 @@ class RunningNodeProcess {
|
|
|
271
275
|
stream(chunk, target = process.stdout) {
|
|
272
276
|
streamChunk(chunk, this.streamOutput, target);
|
|
273
277
|
}
|
|
274
|
-
constructor(commandConfig, color, cwd, env, readyWhenStatus, streamOutput = true, envFile, task) {
|
|
278
|
+
constructor(commandConfig, color, cwd, env, readyWhenStatus, streamOutput = true, envFile, task, baseEnv) {
|
|
275
279
|
this.readyWhenStatus = readyWhenStatus;
|
|
276
280
|
this.streamOutput = streamOutput;
|
|
277
281
|
this.task = task;
|
|
@@ -283,7 +287,7 @@ class RunningNodeProcess {
|
|
|
283
287
|
this.exited = false;
|
|
284
288
|
this.exitCode = 0;
|
|
285
289
|
this.exitTerminalOutput = '';
|
|
286
|
-
env = processEnv(color, cwd, env, envFile);
|
|
290
|
+
env = processEnv(color, cwd, env, envFile, baseEnv);
|
|
287
291
|
this.command = commandConfig.command;
|
|
288
292
|
const header = pc.dim('> ') + commandConfig.command + '\r\n\r\n';
|
|
289
293
|
this.terminalOutputChunks.push(header);
|
|
@@ -458,9 +462,9 @@ class RunningNodeProcess {
|
|
|
458
462
|
}
|
|
459
463
|
}
|
|
460
464
|
}
|
|
461
|
-
async function runSingleCommandWithPseudoTerminal(normalized, context, task) {
|
|
465
|
+
async function runSingleCommandWithPseudoTerminal(normalized, context, task, baseEnv) {
|
|
462
466
|
const pseudoTerminal = (0, pseudo_terminal_1.createPseudoTerminal)();
|
|
463
|
-
const pseudoTtyProcess = await createProcessWithPseudoTty(pseudoTerminal, normalized.commands[0], normalized.color, calculateCwd(normalized.cwd, context), normalized.env, normalized.streamOutput, pseudoTerminal ? normalized.isTTY : false, normalized.envFile);
|
|
467
|
+
const pseudoTtyProcess = await createProcessWithPseudoTty(pseudoTerminal, normalized.commands[0], normalized.color, calculateCwd(normalized.cwd, context), normalized.env, normalized.streamOutput, pseudoTerminal ? normalized.isTTY : false, normalized.envFile, baseEnv);
|
|
464
468
|
// Register process for metrics collection (direct run-commands execution)
|
|
465
469
|
// Skip registration if we're in a forked executor - the fork wrapper already registered
|
|
466
470
|
const pid = pseudoTtyProcess.getPid();
|
|
@@ -470,10 +474,10 @@ async function runSingleCommandWithPseudoTerminal(normalized, context, task) {
|
|
|
470
474
|
registerProcessListener(pseudoTtyProcess, pseudoTerminal);
|
|
471
475
|
return pseudoTtyProcess;
|
|
472
476
|
}
|
|
473
|
-
async function createProcessWithPseudoTty(pseudoTerminal, commandConfig, color, cwd, env, streamOutput = true, tty, envFile) {
|
|
477
|
+
async function createProcessWithPseudoTty(pseudoTerminal, commandConfig, color, cwd, env, streamOutput = true, tty, envFile, baseEnv) {
|
|
474
478
|
return pseudoTerminal.runCommand(commandConfig.command, {
|
|
475
479
|
cwd,
|
|
476
|
-
jsEnv: processEnv(color, cwd, env, envFile),
|
|
480
|
+
jsEnv: processEnv(color, cwd, env, envFile, baseEnv),
|
|
477
481
|
quiet: !streamOutput,
|
|
478
482
|
tty,
|
|
479
483
|
});
|
|
@@ -511,15 +515,15 @@ function calculateCwd(cwd, context) {
|
|
|
511
515
|
* Env variables are processed in the following order:
|
|
512
516
|
* - env option from executor options
|
|
513
517
|
* - env file from envFile option if provided
|
|
514
|
-
* - local env variables
|
|
518
|
+
* - local env variables, read from `baseEnv`
|
|
515
519
|
*/
|
|
516
|
-
function processEnv(color, cwd, envOptionFromExecutor, envFile) {
|
|
517
|
-
let localEnv = (0, npm_run_path_1.env)({ cwd: cwd ?? process.cwd() });
|
|
520
|
+
function processEnv(color, cwd, envOptionFromExecutor, envFile, baseEnv = process.env) {
|
|
521
|
+
let localEnv = (0, npm_run_path_1.env)({ cwd: cwd ?? process.cwd(), env: baseEnv });
|
|
518
522
|
localEnv = {
|
|
519
|
-
...
|
|
523
|
+
...baseEnv,
|
|
520
524
|
...localEnv,
|
|
521
525
|
};
|
|
522
|
-
if (
|
|
526
|
+
if ((0, tokens_1.readEnv)(baseEnv, 'NX_LOAD_DOT_ENV_FILES') !== 'false' && envFile) {
|
|
523
527
|
loadEnvVarsFile(envFile, localEnv);
|
|
524
528
|
}
|
|
525
529
|
let res = {
|
|
@@ -128,10 +128,7 @@ function getUnresolvedOutputs(taskId, projectGraph) {
|
|
|
128
128
|
? targetConfig.configurations?.[configuration]
|
|
129
129
|
: undefined),
|
|
130
130
|
};
|
|
131
|
-
return (targetConfig.outputs ?? []).filter((output) =>
|
|
132
|
-
const value = key.split('.').reduce((acc, k) => acc?.[k], options);
|
|
133
|
-
return value === undefined;
|
|
134
|
-
}));
|
|
131
|
+
return (targetConfig.outputs ?? []).filter((output) => /{options.*}/.test((0, utils_1.interpolateOutput)(output, projectNode, options)));
|
|
135
132
|
}
|
|
136
133
|
function getTaskGraph(taskId, projectGraph) {
|
|
137
134
|
const cached = taskGraphCache.get(taskId);
|
|
@@ -6,7 +6,6 @@ import { Tree } from '../../generators/tree';
|
|
|
6
6
|
* via `cacheableOperations`; Nx 23 removed that derivation and those targets
|
|
7
7
|
* silently stopped being cacheable.
|
|
8
8
|
*
|
|
9
|
-
* Write the intent into the executor key
|
|
10
|
-
* deprecated fallback that restores the old behavior at run time.
|
|
9
|
+
* Write the intent into the executor key, which is where Nx reads `cache` from.
|
|
11
10
|
*/
|
|
12
11
|
export default function update(tree: Tree): Promise<void>;
|
|
@@ -6,9 +6,6 @@ const format_changed_files_1 = require("../../generators/internal-utils/format-c
|
|
|
6
6
|
const json_1 = require("../../generators/utils/json");
|
|
7
7
|
const project_configuration_1 = require("../../generators/utils/project-configuration");
|
|
8
8
|
const path_1 = require("../../utils/path");
|
|
9
|
-
// TODO(v24): remove this migration alongside the runtime fallback it exists to
|
|
10
|
-
// retire (`isLegacyCachedTarget` in `target-normalization.ts`), along with its
|
|
11
|
-
// registration in `packages/nx/migrations.json`.
|
|
12
9
|
/**
|
|
13
10
|
* Target defaults resolve to a single key rather than merging, so an executor
|
|
14
11
|
* key hides the target name key entirely. Before Nx 23 a hidden `cache: true`
|
|
@@ -16,8 +13,7 @@ const path_1 = require("../../utils/path");
|
|
|
16
13
|
* via `cacheableOperations`; Nx 23 removed that derivation and those targets
|
|
17
14
|
* silently stopped being cacheable.
|
|
18
15
|
*
|
|
19
|
-
* Write the intent into the executor key
|
|
20
|
-
* deprecated fallback that restores the old behavior at run time.
|
|
16
|
+
* Write the intent into the executor key, which is where Nx reads `cache` from.
|
|
21
17
|
*/
|
|
22
18
|
async function update(tree) {
|
|
23
19
|
const nxJson = (0, project_configuration_1.readNxJson)(tree);
|
|
@@ -77,8 +73,8 @@ async function update(tree) {
|
|
|
77
73
|
* `targets` — including any that is continuous, which makes `nx.json` fail graph
|
|
78
74
|
* construction outright. The key is only safe when every target through it
|
|
79
75
|
* independently wants caching and none of them can be continuous. Anything else
|
|
80
|
-
* is left
|
|
81
|
-
*
|
|
76
|
+
* is left unchanged, so those targets stay uncached until someone sets `cache`
|
|
77
|
+
* on the key by hand.
|
|
82
78
|
*/
|
|
83
79
|
function canEnableCache(targetDefaults, key, targets, workspaceRoot, projectsMap) {
|
|
84
80
|
// Targets written with `command` are rewritten to `nx:run-commands` and
|
|
@@ -126,9 +122,9 @@ function canEnableCache(targetDefaults, key, targets, workspaceRoot, projectsMap
|
|
|
126
122
|
}
|
|
127
123
|
/**
|
|
128
124
|
* Whether the target name key declares `cache: true` on an entry that always
|
|
129
|
-
* applies.
|
|
130
|
-
*
|
|
131
|
-
*
|
|
125
|
+
* applies. A filtered entry declaring `cache` makes the value unknowable
|
|
126
|
+
* without project context, so nothing is claimed. Among unfiltered entries the
|
|
127
|
+
* last wins.
|
|
132
128
|
*/
|
|
133
129
|
function declaresCacheTrue(value) {
|
|
134
130
|
if (!value) {
|
|
@@ -239,7 +235,6 @@ function executorDeclaresContinuous(executor, workspaceRoot, projectsMap) {
|
|
|
239
235
|
}
|
|
240
236
|
/**
|
|
241
237
|
* Target names the pre-23 `longRunningTask` guard excluded from caching.
|
|
242
|
-
* Mirrors `isLongRunningTarget` in `target-normalization.ts`.
|
|
243
238
|
*/
|
|
244
239
|
function isLongRunningTargetName(targetName) {
|
|
245
240
|
return (targetName.endsWith(':watch') ||
|
|
@@ -8,9 +8,9 @@ This migration copies `cache` onto each executor key that applies to a target wh
|
|
|
8
8
|
|
|
9
9
|
An executor key applies to every target that resolves through it, so the migration updates a key only when it can establish that caching is right for all of them. It leaves the key unchanged when the key already declares `cache`, when it declares `continuous: true`, when every entry on the key is filtered so none of them always applies, when a target through it is continuous or is a long-running target such as `serve`, `dev`, or `start`, when the executor's own schema marks its targets continuous, or when a target through it has no target name key enabling `cache`. It never updates the `nx:run-commands` or `nx:run-script` keys, because targets written with `command` and targets derived from `package.json` scripts resolve through those keys without naming them.
|
|
10
10
|
|
|
11
|
-
Where the migration makes no change,
|
|
11
|
+
Where the migration makes no change, the targets resolving through that key are not cached. Nx 24 reads `cache` from the key that wins resolution and nothing else, so `cache` on a target name key has no effect once an executor key applies. That leaves the keys the migration skips, the keys whose only `cache` declaration is filtered, the targets passed over because a sibling target through the same key does not opt in, and the targets reaching the `nx:run-commands` and `nx:run-script` keys. Set `cache` on the key those targets resolve through, or on the targets themselves.
|
|
12
12
|
|
|
13
|
-
Targets are read from each project's `project.json` and from the `nx.targets` block of its `package.json`. Targets inferred by a plugin, and targets derived from `package.json` scripts, are not visible to the migration — the latter is why the `nx:run-script` key is never updated. A key that looks safe here may still serve an inferred target. Set `cache` on the executor key by hand only after checking that no target reaching it is continuous; Nx rejects a target that is both cacheable and continuous.
|
|
13
|
+
Targets are read from each project's `project.json` and from the `nx.targets` block of its `package.json`. Targets inferred by a plugin, and targets derived from `package.json` scripts, are not visible to the migration — the latter is why the `nx:run-script` key is never updated. A key that looks safe here may still serve an inferred target. Set `cache` on the executor key by hand only after checking that no target reaching it is continuous; Nx rejects a target that is both cacheable and continuous.
|
|
14
14
|
|
|
15
15
|
#### Sample code changes
|
|
16
16
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = enableLegacyAffected;
|
|
4
|
+
const format_changed_files_1 = require("../../generators/internal-utils/format-changed-files");
|
|
5
|
+
const nx_json_1 = require("../../generators/utils/nx-json");
|
|
6
|
+
async function enableLegacyAffected(tree) {
|
|
7
|
+
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
|
8
|
+
if (!nxJson || nxJson.affected?.legacy !== undefined) {
|
|
9
|
+
return { skipAgentic: true };
|
|
10
|
+
}
|
|
11
|
+
nxJson.affected = { ...nxJson.affected, legacy: true };
|
|
12
|
+
(0, nx_json_1.updateNxJson)(tree, nxJson);
|
|
13
|
+
await (0, format_changed_files_1.formatChangedFiles)(tree);
|
|
14
|
+
return { skipAgentic: true };
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#### Keep legacy `nx affected` selection
|
|
2
|
+
|
|
3
|
+
In Nx 24, `nx affected -t` selects only the tasks whose inputs a change reaches, instead of every task of each affected project.
|
|
4
|
+
This migration sets `affected.legacy` to `true` in `nx.json`, so existing workspaces keep selecting whole projects after upgrading.
|
|
5
|
+
|
|
6
|
+
To switch to task selection, remove the setting or set it to `false`.
|
|
7
|
+
The `NX_LEGACY_AFFECTED` environment variable overrides the setting for a single run: `false` selects tasks and `true` selects projects.
|
|
8
|
+
|
|
9
|
+
The migration skips workspaces that already set `affected.legacy`.
|
|
10
|
+
|
|
11
|
+
#### Sample code changes
|
|
12
|
+
|
|
13
|
+
##### Before
|
|
14
|
+
|
|
15
|
+
```json title="nx.json"
|
|
16
|
+
{
|
|
17
|
+
"defaultBase": "main"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
##### After
|
|
22
|
+
|
|
23
|
+
```json title="nx.json"
|
|
24
|
+
{
|
|
25
|
+
"defaultBase": "main",
|
|
26
|
+
"affected": {
|
|
27
|
+
"legacy": true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
@@ -6,10 +6,11 @@ that hash the same things, so the targets keep caching correctly once the hasher
|
|
|
6
6
|
is gone.
|
|
7
7
|
|
|
8
8
|
The generator half of this migration only scans. It edits no files, and it lists
|
|
9
|
-
every executor that declares a hasher in the
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
every executor that declares a hasher in the `impl.agentContext` field of the
|
|
10
|
+
step's `nx_migrate_prompt` block, one line each, with the executor name, the
|
|
11
|
+
hasher path, and the `executors.json` path. Lines starting with
|
|
12
|
+
`Could not parse` name files the scan skipped, and lines starting with `Entry`
|
|
13
|
+
name executor entries it could not read.
|
|
13
14
|
|
|
14
15
|
Do not touch executors that declare no hasher, executors installed from
|
|
15
16
|
`node_modules`, or any other caching configuration.
|
|
@@ -18,13 +19,13 @@ Do not touch executors that declare no hasher, executors installed from
|
|
|
18
19
|
|
|
19
20
|
Confirm this before changing anything. If it fails, make no changes and stop:
|
|
20
21
|
|
|
21
|
-
1.
|
|
22
|
+
1. `impl.agentContext` lists at least one executor that declares a custom
|
|
22
23
|
hasher, or at least one file or entry it could not read. Read each of those
|
|
23
24
|
yourself; if it declares no `hasher`, drop it from the list.
|
|
24
25
|
|
|
25
26
|
## Step 1: Read what each hasher hashes
|
|
26
27
|
|
|
27
|
-
Open the hasher module named in
|
|
28
|
+
Open the hasher module named in `impl.agentContext`. Work out every value it
|
|
28
29
|
feeds into the hash it returns:
|
|
29
30
|
|
|
30
31
|
- `context.hasher.hashTask(task, ...)` alone is Nx default hashing.
|