cleanup(core): do not use workspaceRoot when resolving local files
This commit is contained in:
parent
66b759ddc7
commit
e541a8adbe
@ -1,4 +1,5 @@
|
|||||||
import { appendFileSync, openSync, writeFileSync } from 'fs';
|
import { appendFileSync, openSync, writeFileSync } from 'fs';
|
||||||
|
import { run } from '../src/command-line/run';
|
||||||
|
|
||||||
if (process.env.NX_TERMINAL_OUTPUT_PATH) {
|
if (process.env.NX_TERMINAL_OUTPUT_PATH) {
|
||||||
setUpOutputWatching(
|
setUpOutputWatching(
|
||||||
@ -17,10 +18,7 @@ function requireCli() {
|
|||||||
process.env.NX_CLI_SET = 'true';
|
process.env.NX_CLI_SET = 'true';
|
||||||
try {
|
try {
|
||||||
const args = JSON.parse(process.argv[2]);
|
const args = JSON.parse(process.argv[2]);
|
||||||
const e = require(require.resolve('nx/src/command-line/run.js', {
|
run(
|
||||||
paths: [process.env.NX_WORKSPACE_ROOT],
|
|
||||||
}));
|
|
||||||
e.run(
|
|
||||||
process.cwd(),
|
process.cwd(),
|
||||||
process.env.NX_WORKSPACE_ROOT,
|
process.env.NX_WORKSPACE_ROOT,
|
||||||
args.targetDescription,
|
args.targetDescription,
|
||||||
|
|||||||
@ -42,11 +42,7 @@ export class Cache {
|
|||||||
*/
|
*/
|
||||||
const shouldSpawnProcess = Math.floor(Math.random() * 50) === 1;
|
const shouldSpawnProcess = Math.floor(Math.random() * 50) === 1;
|
||||||
if (shouldSpawnProcess) {
|
if (shouldSpawnProcess) {
|
||||||
const scriptPath = require.resolve(
|
const scriptPath = require.resolve('./remove-old-cache-records.js');
|
||||||
'nx/src/tasks-runner/remove-old-cache-records.js',
|
|
||||||
{ paths: [this.root] }
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const p = spawn('node', [scriptPath, `"${this.cachePath}"`], {
|
const p = spawn('node', [scriptPath, `"${this.cachePath}"`], {
|
||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
|
|||||||
@ -23,7 +23,7 @@ const workerPath = join(__dirname, './batch/run-batch.js');
|
|||||||
|
|
||||||
export class ForkedProcessTaskRunner {
|
export class ForkedProcessTaskRunner {
|
||||||
workspaceRoot = workspaceRoot;
|
workspaceRoot = workspaceRoot;
|
||||||
cliPath = getCliPath(this.workspaceRoot);
|
cliPath = getCliPath();
|
||||||
|
|
||||||
private processes = new Set<ChildProcess>();
|
private processes = new Set<ChildProcess>();
|
||||||
|
|
||||||
|
|||||||
@ -246,11 +246,8 @@ export function calculateReverseDeps(
|
|||||||
return reverseTaskDeps;
|
return reverseTaskDeps;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCliPath(workspaceRoot: string) {
|
export function getCliPath() {
|
||||||
const cli = require.resolve(`nx/bin/run-executor.js`, {
|
return require.resolve(`../../bin/run-executor.js`);
|
||||||
paths: [workspaceRoot],
|
|
||||||
});
|
|
||||||
return `${cli}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPrintableCommandArgsForTask(task: Task) {
|
export function getPrintableCommandArgsForTask(task: Task) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user