fix(core): set windowsHide: true wherever possible (#28073)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
This commit is contained in:
parent
8290969cb7
commit
b73f1e0e00
@ -273,6 +273,7 @@ export function runCommandUntil(
|
|||||||
...opts.env,
|
...opts.env,
|
||||||
FORCE_COLOR: 'false',
|
FORCE_COLOR: 'false',
|
||||||
},
|
},
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
let output = '';
|
let output = '';
|
||||||
|
|||||||
@ -62,11 +62,17 @@ export default async function (globalConfig: Config.ConfigGlobals) {
|
|||||||
function getPublishedVersion(): Promise<string | undefined> {
|
function getPublishedVersion(): Promise<string | undefined> {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
// Resolve the published nx version from verdaccio
|
// Resolve the published nx version from verdaccio
|
||||||
exec('npm view nx@latest version', (error, stdout, stderr) => {
|
exec(
|
||||||
if (error) {
|
'npm view nx@latest version',
|
||||||
return resolve(undefined);
|
{
|
||||||
|
windowsHide: true,
|
||||||
|
},
|
||||||
|
(error, stdout, stderr) => {
|
||||||
|
if (error) {
|
||||||
|
return resolve(undefined);
|
||||||
|
}
|
||||||
|
return resolve(stdout.trim());
|
||||||
}
|
}
|
||||||
return resolve(stdout.trim());
|
);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ export function execAndWait(command: string, cwd: string) {
|
|||||||
return new Promise<{ code: number; stdout: string }>((res, rej) => {
|
return new Promise<{ code: number; stdout: string }>((res, rej) => {
|
||||||
exec(
|
exec(
|
||||||
command,
|
command,
|
||||||
{ cwd, env: { ...process.env, NX_DAEMON: 'false' } },
|
{ cwd, env: { ...process.env, NX_DAEMON: 'false' }, windowsHide: true },
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
const logFile = join(cwd, 'error.log');
|
const logFile = join(cwd, 'error.log');
|
||||||
|
|||||||
@ -43,6 +43,7 @@ export async function initializeGitRepo(
|
|||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
},
|
},
|
||||||
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
spawn('git', args, spawnOptions).on('close', (code) => {
|
spawn('git', args, spawnOptions).on('close', (code) => {
|
||||||
|
|||||||
@ -78,12 +78,15 @@ function startWebServer(webServerCommand: string) {
|
|||||||
// Windows is fine so we leave it attached to this process
|
// Windows is fine so we leave it attached to this process
|
||||||
detached: process.platform !== 'win32',
|
detached: process.platform !== 'win32',
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
try {
|
try {
|
||||||
execSync('taskkill /pid ' + serverProcess.pid + ' /T /F');
|
execSync('taskkill /pid ' + serverProcess.pid + ' /T /F', {
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|||||||
@ -43,6 +43,7 @@ export function installPackagesTask(
|
|||||||
const execSyncOptions: ExecSyncOptions = {
|
const execSyncOptions: ExecSyncOptions = {
|
||||||
cwd: join(tree.root, cwd),
|
cwd: join(tree.root, cwd),
|
||||||
stdio: process.env.NX_GENERATE_QUIET === 'true' ? 'ignore' : 'inherit',
|
stdio: process.env.NX_GENERATE_QUIET === 'true' ? 'ignore' : 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
// ensure local registry from process is not interfering with the install
|
// ensure local registry from process is not interfering with the install
|
||||||
// when we start the process from temp folder the local registry would override the custom registry
|
// when we start the process from temp folder the local registry would override the custom registry
|
||||||
|
|||||||
@ -497,6 +497,7 @@ export function ensurePackage<T extends any = any>(
|
|||||||
execSync(preInstallCommand, {
|
execSync(preInstallCommand, {
|
||||||
cwd: tempDir,
|
cwd: tempDir,
|
||||||
stdio: isVerbose ? 'inherit' : 'ignore',
|
stdio: isVerbose ? 'inherit' : 'ignore',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let addCommand = getPackageManagerCommand(packageManager).addDev;
|
let addCommand = getPackageManagerCommand(packageManager).addDev;
|
||||||
@ -507,6 +508,7 @@ export function ensurePackage<T extends any = any>(
|
|||||||
execSync(`${addCommand} ${pkg}@${requiredVersion}`, {
|
execSync(`${addCommand} ${pkg}@${requiredVersion}`, {
|
||||||
cwd: tempDir,
|
cwd: tempDir,
|
||||||
stdio: isVerbose ? 'inherit' : 'ignore',
|
stdio: isVerbose ? 'inherit' : 'ignore',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
addToNodePath(join(workspaceRoot, 'node_modules'));
|
addToNodePath(join(workspaceRoot, 'node_modules'));
|
||||||
|
|||||||
@ -68,6 +68,7 @@ export function podInstall(
|
|||||||
execSync('touch .xcode.env', {
|
execSync('touch .xcode.env', {
|
||||||
cwd: iosDirectory,
|
cwd: iosDirectory,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
execSync(
|
execSync(
|
||||||
@ -77,6 +78,7 @@ export function podInstall(
|
|||||||
{
|
{
|
||||||
cwd: iosDirectory,
|
cwd: iosDirectory,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@ -11,13 +11,13 @@ export function resolveEas(workspaceRoot: string): string {
|
|||||||
|
|
||||||
let npmGlobalPath: string, yarnGlobalPath: string;
|
let npmGlobalPath: string, yarnGlobalPath: string;
|
||||||
try {
|
try {
|
||||||
npmGlobalPath = execSync('npm root -g')
|
npmGlobalPath = execSync('npm root -g', { windowsHide: true })
|
||||||
?.toString()
|
?.toString()
|
||||||
?.trim()
|
?.trim()
|
||||||
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
||||||
} catch {}
|
} catch {}
|
||||||
try {
|
try {
|
||||||
yarnGlobalPath = execSync('yarn global dir')
|
yarnGlobalPath = execSync('yarn global dir', { windowsHide: true })
|
||||||
?.toString()
|
?.toString()
|
||||||
?.trim()
|
?.trim()
|
||||||
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
?.replace('\u001b[2K\u001b[1G', ''); // strip out ansi codes
|
||||||
|
|||||||
@ -18,11 +18,17 @@ export async function killTree(pid: number, signal: NodeJS.Signals) {
|
|||||||
|
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
case 'win32':
|
||||||
exec('taskkill /pid ' + pid + ' /T /F', (error) => {
|
exec(
|
||||||
// Ignore Fatal errors (128) because it might be due to the process already being killed.
|
'taskkill /pid ' + pid + ' /T /F',
|
||||||
// On Linux/Mac we can check ESRCH (no such process), but on Windows we can't.
|
{
|
||||||
callback(error?.code !== 128 ? error : null);
|
windowsHide: true,
|
||||||
});
|
},
|
||||||
|
(error) => {
|
||||||
|
// Ignore Fatal errors (128) because it might be due to the process already being killed.
|
||||||
|
// On Linux/Mac we can check ESRCH (no such process), but on Windows we can't.
|
||||||
|
callback(error?.code !== 128 ? error : null);
|
||||||
|
}
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
buildProcessTree(
|
buildProcessTree(
|
||||||
@ -30,7 +36,9 @@ export async function killTree(pid: number, signal: NodeJS.Signals) {
|
|||||||
tree,
|
tree,
|
||||||
pidsToProcess,
|
pidsToProcess,
|
||||||
function (parentPid) {
|
function (parentPid) {
|
||||||
return spawn('pgrep', ['-P', parentPid]);
|
return spawn('pgrep', ['-P', parentPid], {
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
killAll(tree, signal, callback);
|
killAll(tree, signal, callback);
|
||||||
@ -43,13 +51,13 @@ export async function killTree(pid: number, signal: NodeJS.Signals) {
|
|||||||
tree,
|
tree,
|
||||||
pidsToProcess,
|
pidsToProcess,
|
||||||
function (parentPid) {
|
function (parentPid) {
|
||||||
return spawn('ps', [
|
return spawn(
|
||||||
'-o',
|
'ps',
|
||||||
'pid',
|
['-o', 'pid', '--no-headers', '--ppid', parentPid],
|
||||||
'--no-headers',
|
{
|
||||||
'--ppid',
|
windowsHide: true,
|
||||||
parentPid,
|
}
|
||||||
]);
|
);
|
||||||
},
|
},
|
||||||
function () {
|
function () {
|
||||||
killAll(tree, signal, callback);
|
killAll(tree, signal, callback);
|
||||||
|
|||||||
@ -128,6 +128,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|||||||
env: processEnv(true),
|
env: processEnv(true),
|
||||||
cwd: context.root,
|
cwd: context.root,
|
||||||
stdio: ['ignore', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const resultJson = JSON.parse(result.toString());
|
const resultJson = JSON.parse(result.toString());
|
||||||
@ -153,6 +154,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|||||||
env: processEnv(true),
|
env: processEnv(true),
|
||||||
cwd: context.root,
|
cwd: context.root,
|
||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
console.log(
|
console.log(
|
||||||
`Added the dist-tag ${tag} to v${currentVersion} for registry ${registry}.\n`
|
`Added the dist-tag ${tag} to v${currentVersion} for registry ${registry}.\n`
|
||||||
@ -267,6 +269,7 @@ Please update the local dependency on "${depName}" to be a valid semantic versio
|
|||||||
env: processEnv(true),
|
env: processEnv(true),
|
||||||
cwd: context.root,
|
cwd: context.root,
|
||||||
stdio: ['ignore', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -136,7 +136,7 @@ function createVerdaccioOptions(
|
|||||||
|
|
||||||
function setupNpm(options: VerdaccioExecutorSchema) {
|
function setupNpm(options: VerdaccioExecutorSchema) {
|
||||||
try {
|
try {
|
||||||
execSync('npm --version', { env });
|
execSync('npm --version', { env, windowsHide: true });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return () => {};
|
return () => {};
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ function setupNpm(options: VerdaccioExecutorSchema) {
|
|||||||
npmRegistryPaths.push(
|
npmRegistryPaths.push(
|
||||||
execSync(
|
execSync(
|
||||||
`npm config get ${registryName} --location ${options.location}`,
|
`npm config get ${registryName} --location ${options.location}`,
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
)
|
)
|
||||||
?.toString()
|
?.toString()
|
||||||
?.trim()
|
?.trim()
|
||||||
@ -159,12 +159,12 @@ function setupNpm(options: VerdaccioExecutorSchema) {
|
|||||||
);
|
);
|
||||||
execSync(
|
execSync(
|
||||||
`npm config set ${registryName} http://localhost:${options.port}/ --location ${options.location}`,
|
`npm config set ${registryName} http://localhost:${options.port}/ --location ${options.location}`,
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
execSync(
|
execSync(
|
||||||
`npm config set //localhost:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}`,
|
`npm config set //localhost:${options.port}/:_authToken="secretVerdaccioToken" --location ${options.location}`,
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
@ -181,7 +181,7 @@ function setupNpm(options: VerdaccioExecutorSchema) {
|
|||||||
try {
|
try {
|
||||||
const currentNpmRegistryPath = execSync(
|
const currentNpmRegistryPath = execSync(
|
||||||
`npm config get registry --location ${options.location}`,
|
`npm config get registry --location ${options.location}`,
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
)
|
)
|
||||||
?.toString()
|
?.toString()
|
||||||
?.trim()
|
?.trim()
|
||||||
@ -194,7 +194,7 @@ function setupNpm(options: VerdaccioExecutorSchema) {
|
|||||||
) {
|
) {
|
||||||
execSync(
|
execSync(
|
||||||
`npm config set ${registryName} ${npmRegistryPaths[index]} --location ${options.location}`,
|
`npm config set ${registryName} ${npmRegistryPaths[index]} --location ${options.location}`,
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
);
|
);
|
||||||
logger.info(
|
logger.info(
|
||||||
`Reset npm ${registryName} to ${npmRegistryPaths[index]}`
|
`Reset npm ${registryName} to ${npmRegistryPaths[index]}`
|
||||||
@ -204,6 +204,7 @@ function setupNpm(options: VerdaccioExecutorSchema) {
|
|||||||
`npm config delete ${registryName} --location ${options.location}`,
|
`npm config delete ${registryName} --location ${options.location}`,
|
||||||
{
|
{
|
||||||
env,
|
env,
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
logger.info('Cleared custom npm registry');
|
logger.info('Cleared custom npm registry');
|
||||||
@ -211,7 +212,7 @@ function setupNpm(options: VerdaccioExecutorSchema) {
|
|||||||
});
|
});
|
||||||
execSync(
|
execSync(
|
||||||
`npm config delete //localhost:${options.port}/:_authToken --location ${options.location}`,
|
`npm config delete //localhost:${options.port}/:_authToken --location ${options.location}`,
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(`Failed to reset npm registry: ${e.message}`);
|
throw new Error(`Failed to reset npm registry: ${e.message}`);
|
||||||
@ -230,6 +231,7 @@ function getYarnUnsafeHttpWhitelist(isYarnV1: boolean) {
|
|||||||
JSON.parse(
|
JSON.parse(
|
||||||
execSync(`yarn config get unsafeHttpWhitelist --json`, {
|
execSync(`yarn config get unsafeHttpWhitelist --json`, {
|
||||||
env,
|
env,
|
||||||
|
windowsHide: true,
|
||||||
}).toString()
|
}).toString()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -245,13 +247,13 @@ function setYarnUnsafeHttpWhitelist(
|
|||||||
`yarn config set unsafeHttpWhitelist --json '${JSON.stringify(
|
`yarn config set unsafeHttpWhitelist --json '${JSON.stringify(
|
||||||
Array.from(currentWhitelist)
|
Array.from(currentWhitelist)
|
||||||
)}'` + (options.location === 'user' ? ' --home' : ''),
|
)}'` + (options.location === 'user' ? ' --home' : ''),
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
execSync(
|
execSync(
|
||||||
`yarn config unset unsafeHttpWhitelist` +
|
`yarn config unset unsafeHttpWhitelist` +
|
||||||
(options.location === 'user' ? ' --home' : ''),
|
(options.location === 'user' ? ' --home' : ''),
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -263,7 +265,9 @@ function setupYarn(options: VerdaccioExecutorSchema) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
isYarnV1 =
|
isYarnV1 =
|
||||||
major(execSync('yarn --version', { env }).toString().trim()) === 1;
|
major(
|
||||||
|
execSync('yarn --version', { env, windowsHide: true }).toString().trim()
|
||||||
|
) === 1;
|
||||||
} catch {
|
} catch {
|
||||||
// This would fail if yarn is not installed which is okay
|
// This would fail if yarn is not installed which is okay
|
||||||
return () => {};
|
return () => {};
|
||||||
@ -277,6 +281,7 @@ function setupYarn(options: VerdaccioExecutorSchema) {
|
|||||||
yarnRegistryPaths.push(
|
yarnRegistryPaths.push(
|
||||||
execSync(`yarn config get ${scopeName}${registryConfigName}`, {
|
execSync(`yarn config get ${scopeName}${registryConfigName}`, {
|
||||||
env,
|
env,
|
||||||
|
windowsHide: true,
|
||||||
})
|
})
|
||||||
?.toString()
|
?.toString()
|
||||||
?.trim()
|
?.trim()
|
||||||
@ -286,7 +291,7 @@ function setupYarn(options: VerdaccioExecutorSchema) {
|
|||||||
execSync(
|
execSync(
|
||||||
`yarn config set ${scopeName}${registryConfigName} http://localhost:${options.port}/` +
|
`yarn config set ${scopeName}${registryConfigName} http://localhost:${options.port}/` +
|
||||||
(options.location === 'user' ? ' --home' : ''),
|
(options.location === 'user' ? ' --home' : ''),
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
@ -313,7 +318,7 @@ function setupYarn(options: VerdaccioExecutorSchema) {
|
|||||||
try {
|
try {
|
||||||
const currentYarnRegistryPath = execSync(
|
const currentYarnRegistryPath = execSync(
|
||||||
`yarn config get ${registryConfigName}`,
|
`yarn config get ${registryConfigName}`,
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
)
|
)
|
||||||
?.toString()
|
?.toString()
|
||||||
?.trim()
|
?.trim()
|
||||||
@ -331,7 +336,11 @@ function setupYarn(options: VerdaccioExecutorSchema) {
|
|||||||
execSync(
|
execSync(
|
||||||
`yarn config set ${registryName} ${yarnRegistryPaths[index]}` +
|
`yarn config set ${registryName} ${yarnRegistryPaths[index]}` +
|
||||||
(options.location === 'user' ? ' --home' : ''),
|
(options.location === 'user' ? ' --home' : ''),
|
||||||
{ env }
|
{
|
||||||
|
env,
|
||||||
|
|
||||||
|
windowsHide: true,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
logger.info(
|
logger.info(
|
||||||
`Reset yarn ${registryName} to ${yarnRegistryPaths[index]}`
|
`Reset yarn ${registryName} to ${yarnRegistryPaths[index]}`
|
||||||
@ -340,7 +349,7 @@ function setupYarn(options: VerdaccioExecutorSchema) {
|
|||||||
execSync(
|
execSync(
|
||||||
`yarn config ${isYarnV1 ? 'delete' : 'unset'} ${registryName}` +
|
`yarn config ${isYarnV1 ? 'delete' : 'unset'} ${registryName}` +
|
||||||
(options.location === 'user' ? ' --home' : ''),
|
(options.location === 'user' ? ' --home' : ''),
|
||||||
{ env }
|
{ env, windowsHide: true }
|
||||||
);
|
);
|
||||||
logger.info(`Cleared custom yarn ${registryConfigName}`);
|
logger.info(`Cleared custom yarn ${registryConfigName}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -211,6 +211,9 @@ To fix this you will either need to add a package.json file at that location, or
|
|||||||
currentVersion = await new Promise<string>((resolve, reject) => {
|
currentVersion = await new Promise<string>((resolve, reject) => {
|
||||||
exec(
|
exec(
|
||||||
`npm view ${packageName} version --"${registryConfigKey}=${registry}" --tag=${tag}`,
|
`npm view ${packageName} version --"${registryConfigKey}=${registry}" --tag=${tag}`,
|
||||||
|
{
|
||||||
|
windowsHide: true,
|
||||||
|
},
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
return reject(error);
|
return reject(error);
|
||||||
|
|||||||
@ -133,6 +133,7 @@ function execLockFileUpdate(
|
|||||||
...process.env,
|
...process.env,
|
||||||
...env,
|
...env,
|
||||||
},
|
},
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
output.error({
|
output.error({
|
||||||
|
|||||||
@ -21,8 +21,11 @@ export async function setupVerdaccio(
|
|||||||
if (!tree.exists('.verdaccio/config.yml')) {
|
if (!tree.exists('.verdaccio/config.yml')) {
|
||||||
generateFiles(tree, path.join(__dirname, 'files'), '.verdaccio', {
|
generateFiles(tree, path.join(__dirname, 'files'), '.verdaccio', {
|
||||||
npmUplinkRegistry:
|
npmUplinkRegistry:
|
||||||
execSync('npm config get registry')?.toString()?.trim() ??
|
execSync('npm config get registry', {
|
||||||
'https://registry.npmjs.org',
|
windowsHide: true,
|
||||||
|
})
|
||||||
|
?.toString()
|
||||||
|
?.trim() ?? 'https://registry.npmjs.org',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,10 @@ export function startLocalRegistry({
|
|||||||
const registry = `http://localhost:${port}`;
|
const registry = `http://localhost:${port}`;
|
||||||
process.env.npm_config_registry = registry;
|
process.env.npm_config_registry = registry;
|
||||||
execSync(
|
execSync(
|
||||||
`npm config set //localhost:${port}/:_authToken "secretVerdaccioToken"`
|
`npm config set //localhost:${port}/:_authToken "secretVerdaccioToken"`,
|
||||||
|
{
|
||||||
|
windowsHide: true,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// yarnv1
|
// yarnv1
|
||||||
@ -59,7 +62,9 @@ export function startLocalRegistry({
|
|||||||
|
|
||||||
resolve(() => {
|
resolve(() => {
|
||||||
childProcess.kill();
|
childProcess.kill();
|
||||||
execSync(`npm config delete //localhost:${port}/:_authToken`);
|
execSync(`npm config delete //localhost:${port}/:_authToken`, {
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
childProcess?.stdout?.off('data', listener);
|
childProcess?.stdout?.off('data', listener);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,7 +108,7 @@ async function getNpmConfigValue(key: string, cwd: string): Promise<string> {
|
|||||||
async function execAsync(command: string, cwd: string): Promise<string> {
|
async function execAsync(command: string, cwd: string): Promise<string> {
|
||||||
// Must be non-blocking async to allow spinner to render
|
// Must be non-blocking async to allow spinner to render
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
exec(command, { cwd }, (error, stdout, stderr) => {
|
exec(command, { cwd, windowsHide: true }, (error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
return reject(error);
|
return reject(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,6 +85,7 @@ export async function compileSwc(
|
|||||||
const swcCmdLog = execSync(getSwcCmd(normalizedOptions), {
|
const swcCmdLog = execSync(getSwcCmd(normalizedOptions), {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
cwd: normalizedOptions.swcCliOptions.swcCwd,
|
cwd: normalizedOptions.swcCliOptions.swcCwd,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
logger.log(swcCmdLog.replace(/\n/, ''));
|
logger.log(swcCmdLog.replace(/\n/, ''));
|
||||||
const isCompileSuccess = swcCmdLog.includes('Successfully compiled');
|
const isCompileSuccess = swcCmdLog.includes('Successfully compiled');
|
||||||
@ -137,6 +138,7 @@ export async function* compileSwcWatch(
|
|||||||
|
|
||||||
const swcWatcher = exec(getSwcCmd(normalizedOptions, true), {
|
const swcWatcher = exec(getSwcCmd(normalizedOptions, true), {
|
||||||
cwd: normalizedOptions.swcCliOptions.swcCwd,
|
cwd: normalizedOptions.swcCliOptions.swcCwd,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
processOnExit = () => {
|
processOnExit = () => {
|
||||||
|
|||||||
@ -153,7 +153,11 @@ export async function applicationGenerator(tree: Tree, schema: Schema) {
|
|||||||
|
|
||||||
tasks.push(() => {
|
tasks.push(() => {
|
||||||
try {
|
try {
|
||||||
execSync(`npx -y nuxi prepare`, { cwd: options.appProjectRoot });
|
execSync(`npx -y nuxi prepare`, {
|
||||||
|
cwd: options.appProjectRoot,
|
||||||
|
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(
|
console.error(
|
||||||
`Failed to run \`nuxi prepare\` in "${options.appProjectRoot}". Please run the command manually.`
|
`Failed to run \`nuxi prepare\` in "${options.appProjectRoot}". Please run the command manually.`
|
||||||
|
|||||||
@ -260,10 +260,18 @@ function getLocalNxVersion(workspace: WorkspaceTypeAndRoot): string | null {
|
|||||||
|
|
||||||
function _getLatestVersionOfNx(): string {
|
function _getLatestVersionOfNx(): string {
|
||||||
try {
|
try {
|
||||||
return execSync('npm view nx@latest version').toString().trim();
|
return execSync('npm view nx@latest version', {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
} catch {
|
} catch {
|
||||||
try {
|
try {
|
||||||
return execSync('pnpm view nx@latest version').toString().trim();
|
return execSync('pnpm view nx@latest version', {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,10 @@ async function requirePowerpack(): Promise<any> {
|
|||||||
if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
|
if ('code' in e && e.code === 'MODULE_NOT_FOUND') {
|
||||||
try {
|
try {
|
||||||
execSync(
|
execSync(
|
||||||
`${getPackageManagerCommand().addDev} @nx/powerpack-license@latest`
|
`${getPackageManagerCommand().addDev} @nx/powerpack-license@latest`,
|
||||||
|
{
|
||||||
|
windowsHide: true,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||
@ -43,19 +43,25 @@ async function installPackage(
|
|||||||
if (existsSync('package.json')) {
|
if (existsSync('package.json')) {
|
||||||
const pmc = getPackageManagerCommand();
|
const pmc = getPackageManagerCommand();
|
||||||
await new Promise<void>((resolve) =>
|
await new Promise<void>((resolve) =>
|
||||||
exec(`${pmc.addDev} ${pkgName}@${version}`, (error, stdout) => {
|
exec(
|
||||||
if (error) {
|
`${pmc.addDev} ${pkgName}@${version}`,
|
||||||
spinner.fail();
|
{
|
||||||
output.addNewline();
|
windowsHide: true,
|
||||||
logger.error(stdout);
|
},
|
||||||
output.error({
|
(error, stdout) => {
|
||||||
title: `Failed to install ${pkgName}. Please check the error above for more details.`,
|
if (error) {
|
||||||
});
|
spinner.fail();
|
||||||
process.exit(1);
|
output.addNewline();
|
||||||
}
|
logger.error(stdout);
|
||||||
|
output.error({
|
||||||
|
title: `Failed to install ${pkgName}. Please check the error above for more details.`,
|
||||||
|
});
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
return resolve();
|
return resolve();
|
||||||
})
|
}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
nxJson.installation.plugins ??= {};
|
nxJson.installation.plugins ??= {};
|
||||||
|
|||||||
@ -50,6 +50,7 @@ export async function viewLogs(): Promise<number> {
|
|||||||
const pmc = getPackageManagerCommand();
|
const pmc = getPackageManagerCommand();
|
||||||
execSync(`${pmc.exec} nx-cloud upload-and-show-run-details`, {
|
execSync(`${pmc.exec} nx-cloud upload-and-show-run-details`, {
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!cloudUsed) {
|
if (!cloudUsed) {
|
||||||
|
|||||||
@ -54,6 +54,7 @@ export async function nxExecCommand(
|
|||||||
NX_PROJECT_ROOT_PATH:
|
NX_PROJECT_ROOT_PATH:
|
||||||
projectGraph.nodes?.[process.env.NX_TASK_TARGET_PROJECT]?.data?.root,
|
projectGraph.nodes?.[process.env.NX_TASK_TARGET_PROJECT]?.data?.root,
|
||||||
},
|
},
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// nx exec is being ran inside of Nx's context
|
// nx exec is being ran inside of Nx's context
|
||||||
@ -104,6 +105,7 @@ async function runScriptAsNxTarget(
|
|||||||
projectGraph.nodes?.[projectName]?.data?.root
|
projectGraph.nodes?.[projectName]?.data?.root
|
||||||
)
|
)
|
||||||
: workspaceRoot,
|
: workspaceRoot,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -127,7 +129,11 @@ function runTargetOnProject(
|
|||||||
const command = `${
|
const command = `${
|
||||||
pm.exec
|
pm.exec
|
||||||
} nx run ${projectName}:\\\"${targetName}\\\" ${extraArgs.join(' ')}`;
|
} nx run ${projectName}:\\\"${targetName}\\\" ${extraArgs.join(' ')}`;
|
||||||
execSync(command, { stdio: 'inherit' });
|
execSync(command, {
|
||||||
|
stdio: 'inherit',
|
||||||
|
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function readScriptArgV(
|
function readScriptArgV(
|
||||||
|
|||||||
@ -211,6 +211,7 @@ function write(patterns: string[]) {
|
|||||||
)}`,
|
)}`,
|
||||||
{
|
{
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -221,6 +222,7 @@ function write(patterns: string[]) {
|
|||||||
)} --parser json`,
|
)} --parser json`,
|
||||||
{
|
{
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -237,7 +239,7 @@ async function check(patterns: string[]): Promise<string[]> {
|
|||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
exec(
|
exec(
|
||||||
`node "${prettierPath}" --list-different ${patterns.join(' ')}`,
|
`node "${prettierPath}" --list-different ${patterns.join(' ')}`,
|
||||||
{ encoding: 'utf-8' },
|
{ encoding: 'utf-8', windowsHide: true },
|
||||||
(error, stdout) => {
|
(error, stdout) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
// The command failed so there are files with different formatting. Prettier writes them to stdout, newline separated.
|
// The command failed so there are files with different formatting. Prettier writes them to stdout, newline separated.
|
||||||
|
|||||||
@ -1263,5 +1263,6 @@ function getHelpTextFromTarget(
|
|||||||
|
|
||||||
return execSync(command, {
|
return execSync(command, {
|
||||||
cwd: target.options?.cwd ?? workspaceRoot,
|
cwd: target.options?.cwd ?? workspaceRoot,
|
||||||
|
windowsHide: true,
|
||||||
}).toString();
|
}).toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,5 +3,9 @@ import { getPackageManagerCommand } from '../../../../utils/package-manager';
|
|||||||
|
|
||||||
export function setupIntegratedWorkspace(): void {
|
export function setupIntegratedWorkspace(): void {
|
||||||
const pmc = getPackageManagerCommand();
|
const pmc = getPackageManagerCommand();
|
||||||
execSync(`${pmc.exec} nx g @nx/angular:ng-add`, { stdio: [0, 1, 2] });
|
execSync(`${pmc.exec} nx g @nx/angular:ng-add`, {
|
||||||
|
stdio: [0, 1, 2],
|
||||||
|
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,7 +106,10 @@ export async function getLegacyMigrationFunctionIfApplicable(
|
|||||||
);
|
);
|
||||||
|
|
||||||
output.log({ title: '📝 Setting up workspace' });
|
output.log({ title: '📝 Setting up workspace' });
|
||||||
execSync(`${pmc.exec} ${legacyMigrationCommand}`, { stdio: [0, 1, 2] });
|
execSync(`${pmc.exec} ${legacyMigrationCommand}`, {
|
||||||
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
|
|
||||||
if (useNxCloud) {
|
if (useNxCloud) {
|
||||||
output.log({ title: '🛠️ Setting up Nx Cloud' });
|
output.log({ title: '🛠️ Setting up Nx Cloud' });
|
||||||
@ -146,7 +149,7 @@ async function installDependencies(
|
|||||||
}
|
}
|
||||||
writeJsonFile(`package.json`, json);
|
writeJsonFile(`package.json`, json);
|
||||||
|
|
||||||
execSync(pmc.install, { stdio: [0, 1, 2] });
|
execSync(pmc.install, { stdio: [0, 1, 2], windowsHide: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resolvePackageVersion(
|
async function resolvePackageVersion(
|
||||||
|
|||||||
@ -67,7 +67,9 @@ export function generateDotNxSetup(version?: string) {
|
|||||||
|
|
||||||
export function normalizeVersionForNxJson(pkg: string, version: string) {
|
export function normalizeVersionForNxJson(pkg: string, version: string) {
|
||||||
if (!valid(version)) {
|
if (!valid(version)) {
|
||||||
version = execSync(`npm view ${pkg}@${version} version`).toString();
|
version = execSync(`npm view ${pkg}@${version} version`, {
|
||||||
|
windowsHide: true,
|
||||||
|
}).toString();
|
||||||
}
|
}
|
||||||
return version.trimEnd();
|
return version.trimEnd();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,6 +90,7 @@ function performInstallation(
|
|||||||
cp.execSync('npm i', {
|
cp.execSync('npm i', {
|
||||||
cwd: path.dirname(installationPath),
|
cwd: path.dirname(installationPath),
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// revert possible changes to the current installation
|
// revert possible changes to the current installation
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
|
|
||||||
export function checkForUncommittedChanges() {
|
export function checkForUncommittedChanges() {
|
||||||
const gitResult = execSync('git status --porcelain').toString();
|
const gitResult = execSync('git status --porcelain', {
|
||||||
|
windowsHide: true,
|
||||||
|
}).toString();
|
||||||
|
|
||||||
const filteredResults = gitResult
|
const filteredResults = gitResult
|
||||||
.split('\n')
|
.split('\n')
|
||||||
|
|||||||
@ -70,6 +70,7 @@ function installDependencies(options: NormalizedOptions) {
|
|||||||
|
|
||||||
execSync(`${options.pmc.addDev} ${dependencies.join(' ')}`, {
|
execSync(`${options.pmc.addDev} ${dependencies.join(' ')}`, {
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +87,9 @@ async function normalizeOptions(options: Options): Promise<NormalizedOptions> {
|
|||||||
...packageJson.devDependencies,
|
...packageJson.devDependencies,
|
||||||
};
|
};
|
||||||
const isCRA5 = /^[^~]?5/.test(deps['react-scripts']);
|
const isCRA5 = /^[^~]?5/.test(deps['react-scripts']);
|
||||||
const npmVersion = execSync('npm -v').toString();
|
const npmVersion = execSync('npm -v', {
|
||||||
|
windowsHide: true,
|
||||||
|
}).toString();
|
||||||
// Should remove this check 04/2023 once Node 14 & npm 6 reach EOL
|
// Should remove this check 04/2023 once Node 14 & npm 6 reach EOL
|
||||||
const npxYesFlagNeeded = !npmVersion.startsWith('6'); // npm 7 added -y flag to npx
|
const npxYesFlagNeeded = !npmVersion.startsWith('6'); // npm 7 added -y flag to npx
|
||||||
const isVite = options.vite;
|
const isVite = options.vite;
|
||||||
@ -126,8 +129,14 @@ async function reorgnizeWorkspaceStructure(options: NormalizedOptions) {
|
|||||||
|
|
||||||
output.log({ title: '🧶 Updating .gitignore file' });
|
output.log({ title: '🧶 Updating .gitignore file' });
|
||||||
|
|
||||||
execSync(`echo "node_modules" >> .gitignore`, { stdio: [0, 1, 2] });
|
execSync(`echo "node_modules" >> .gitignore`, {
|
||||||
execSync(`echo "dist" >> .gitignore`, { stdio: [0, 1, 2] });
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
|
execSync(`echo "dist" >> .gitignore`, {
|
||||||
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
|
|
||||||
process.chdir('..');
|
process.chdir('..');
|
||||||
|
|
||||||
@ -168,7 +177,7 @@ function createTempWorkspace(options: NormalizedOptions) {
|
|||||||
} ${
|
} ${
|
||||||
options.addE2e ? '--e2eTestRunner=playwright' : '--e2eTestRunner=none'
|
options.addE2e ? '--e2eTestRunner=playwright' : '--e2eTestRunner=none'
|
||||||
}`,
|
}`,
|
||||||
{ stdio: [0, 1, 2] }
|
{ stdio: [0, 1, 2], windowsHide: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
output.log({ title: '👋 Welcome to Nx!' });
|
output.log({ title: '👋 Welcome to Nx!' });
|
||||||
@ -311,7 +320,10 @@ async function addBundler(options: NormalizedOptions) {
|
|||||||
title: '🛬 Skip CRA preflight check since Nx manages the monorepo',
|
title: '🛬 Skip CRA preflight check since Nx manages the monorepo',
|
||||||
});
|
});
|
||||||
|
|
||||||
execSync(`echo "SKIP_PREFLIGHT_CHECK=true" > .env`, { stdio: [0, 1, 2] });
|
execSync(`echo "SKIP_PREFLIGHT_CHECK=true" > .env`, {
|
||||||
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -68,24 +68,28 @@ function deduceDefaultBase() {
|
|||||||
try {
|
try {
|
||||||
execSync(`git rev-parse --verify main`, {
|
execSync(`git rev-parse --verify main`, {
|
||||||
stdio: ['ignore', 'ignore', 'ignore'],
|
stdio: ['ignore', 'ignore', 'ignore'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
return 'main';
|
return 'main';
|
||||||
} catch {
|
} catch {
|
||||||
try {
|
try {
|
||||||
execSync(`git rev-parse --verify dev`, {
|
execSync(`git rev-parse --verify dev`, {
|
||||||
stdio: ['ignore', 'ignore', 'ignore'],
|
stdio: ['ignore', 'ignore', 'ignore'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
return 'dev';
|
return 'dev';
|
||||||
} catch {
|
} catch {
|
||||||
try {
|
try {
|
||||||
execSync(`git rev-parse --verify develop`, {
|
execSync(`git rev-parse --verify develop`, {
|
||||||
stdio: ['ignore', 'ignore', 'ignore'],
|
stdio: ['ignore', 'ignore', 'ignore'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
return 'develop';
|
return 'develop';
|
||||||
} catch {
|
} catch {
|
||||||
try {
|
try {
|
||||||
execSync(`git rev-parse --verify next`, {
|
execSync(`git rev-parse --verify next`, {
|
||||||
stdio: ['ignore', 'ignore', 'ignore'],
|
stdio: ['ignore', 'ignore', 'ignore'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
return 'next';
|
return 'next';
|
||||||
} catch {
|
} catch {
|
||||||
@ -140,7 +144,7 @@ export function runInstall(
|
|||||||
repoRoot: string,
|
repoRoot: string,
|
||||||
pmc: PackageManagerCommands = getPackageManagerCommand()
|
pmc: PackageManagerCommands = getPackageManagerCommand()
|
||||||
) {
|
) {
|
||||||
execSync(pmc.install, { stdio: [0, 1, 2], cwd: repoRoot });
|
execSync(pmc.install, { stdio: [0, 1, 2], cwd: repoRoot, windowsHide: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function initCloud(
|
export async function initCloud(
|
||||||
|
|||||||
@ -95,6 +95,7 @@ export async function initHandler(options: InitArgs) {
|
|||||||
} else {
|
} else {
|
||||||
execSync(`npx --yes create-nx-workspace@${version} ${args}`, {
|
execSync(`npx --yes create-nx-workspace@${version} ${args}`, {
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,6 +59,7 @@ export function installPlugins(
|
|||||||
{
|
{
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
cwd: repoRoot,
|
cwd: repoRoot,
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -128,6 +128,7 @@ function runMigration() {
|
|||||||
}
|
}
|
||||||
execSync(`${p} _migrate ${process.argv.slice(3).join(' ')}`, {
|
execSync(`${p} _migrate ${process.argv.slice(3).join(' ')}`, {
|
||||||
stdio: ['inherit', 'inherit', 'inherit'],
|
stdio: ['inherit', 'inherit', 'inherit'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -155,12 +156,14 @@ function nxCliPath() {
|
|||||||
execSync(pmc.preInstall, {
|
execSync(pmc.preInstall, {
|
||||||
cwd: tmpDir,
|
cwd: tmpDir,
|
||||||
stdio: ['ignore', 'ignore', 'ignore'],
|
stdio: ['ignore', 'ignore', 'ignore'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
// if it's berry ensure we set the node_linker to node-modules
|
// if it's berry ensure we set the node_linker to node-modules
|
||||||
if (packageManager === 'yarn' && pmc.ciInstall.includes('immutable')) {
|
if (packageManager === 'yarn' && pmc.ciInstall.includes('immutable')) {
|
||||||
execSync('yarn config set nodeLinker node-modules', {
|
execSync('yarn config set nodeLinker node-modules', {
|
||||||
cwd: tmpDir,
|
cwd: tmpDir,
|
||||||
stdio: ['ignore', 'ignore', 'ignore'],
|
stdio: ['ignore', 'ignore', 'ignore'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -168,6 +171,7 @@ function nxCliPath() {
|
|||||||
execSync(pmc.install, {
|
execSync(pmc.install, {
|
||||||
cwd: tmpDir,
|
cwd: tmpDir,
|
||||||
stdio: ['ignore', 'ignore', 'ignore'],
|
stdio: ['ignore', 'ignore', 'ignore'],
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set NODE_PATH so that these modules can be used for module resolution
|
// Set NODE_PATH so that these modules can be used for module resolution
|
||||||
|
|||||||
@ -1387,7 +1387,7 @@ function runInstall() {
|
|||||||
output.log({
|
output.log({
|
||||||
title: `Running '${pmCommands.install}' to make sure necessary packages are installed`,
|
title: `Running '${pmCommands.install}' to make sure necessary packages are installed`,
|
||||||
});
|
});
|
||||||
execSync(pmCommands.install, { stdio: [0, 1, 2] });
|
execSync(pmCommands.install, { stdio: [0, 1, 2], windowsHide: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function executeMigrations(
|
export async function executeMigrations(
|
||||||
|
|||||||
@ -323,6 +323,9 @@ async function getCommitForVersionPlanFile(
|
|||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
exec(
|
exec(
|
||||||
`git log --diff-filter=A --pretty=format:"%s|%h|%an|%ae|%b" -n 1 -- ${rawVersionPlan.absolutePath}`,
|
`git log --diff-filter=A --pretty=format:"%s|%h|%an|%ae|%b" -n 1 -- ${rawVersionPlan.absolutePath}`,
|
||||||
|
{
|
||||||
|
windowsHide: true,
|
||||||
|
},
|
||||||
(error, stdout, stderr) => {
|
(error, stdout, stderr) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
if (isVerbose) {
|
if (isVerbose) {
|
||||||
|
|||||||
@ -10,6 +10,7 @@ export async function execCommand(
|
|||||||
...options,
|
...options,
|
||||||
stdio: ['pipe', 'pipe', 'pipe'], // stdin, stdout, stderr
|
stdio: ['pipe', 'pipe', 'pipe'], // stdin, stdout, stderr
|
||||||
encoding: 'utf-8',
|
encoding: 'utf-8',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
let stdout = '';
|
let stdout = '';
|
||||||
|
|||||||
@ -367,6 +367,7 @@ async function resolveGithubToken(hostname: string): Promise<string | null> {
|
|||||||
return execSync(`gh auth token`, {
|
return execSync(`gh auth token`, {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
}).trim();
|
}).trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ export async function launchEditor(filePath: string) {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const editorProcess = spawn(cmd, [...args, filePath], {
|
const editorProcess = spawn(cmd, [...args, filePath], {
|
||||||
stdio: 'inherit', // This will ensure the editor uses the current terminal
|
stdio: 'inherit', // This will ensure the editor uses the current terminal
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
editorProcess.on('exit', (code) => {
|
editorProcess.on('exit', (code) => {
|
||||||
@ -28,7 +29,11 @@ export async function launchEditor(filePath: string) {
|
|||||||
|
|
||||||
function getGitConfig(key): string | null {
|
function getGitConfig(key): string | null {
|
||||||
try {
|
try {
|
||||||
return execSync(`git config --get ${key}`).toString().trim();
|
return execSync(`git config --get ${key}`, {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -753,6 +753,7 @@ function runPreVersionCommand(
|
|||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
stdio,
|
stdio,
|
||||||
env,
|
env,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const title = verbose
|
const title = verbose
|
||||||
|
|||||||
@ -134,6 +134,7 @@ async function printTargetRunHelpInternal(
|
|||||||
} else {
|
} else {
|
||||||
const cp = exec(helpCommand, {
|
const cp = exec(helpCommand, {
|
||||||
env,
|
env,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
cp.on('exit', (code) => {
|
cp.on('exit', (code) => {
|
||||||
process.exit(code);
|
process.exit(code);
|
||||||
|
|||||||
@ -132,6 +132,7 @@ class BatchCommandRunner extends BatchFunctionRunner {
|
|||||||
[this.projectNameEnv]: env[this.projectNameEnv],
|
[this.projectNameEnv]: env[this.projectNameEnv],
|
||||||
[this.fileChangesEnv]: env[this.fileChangesEnv],
|
[this.fileChangesEnv]: env[this.fileChangesEnv],
|
||||||
},
|
},
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
commandExec.on('close', () => {
|
commandExec.on('close', () => {
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@ -9,6 +9,7 @@ export function generateDaemonHelpOutput(): string {
|
|||||||
*/
|
*/
|
||||||
const res = spawnSync(process.execPath, ['./exec-is-server-available.js'], {
|
const res = spawnSync(process.execPath, ['./exec-is-server-available.js'], {
|
||||||
cwd: __dirname,
|
cwd: __dirname,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const isServerAvailable = res?.stdout?.toString().trim().indexOf('true') > -1;
|
const isServerAvailable = res?.stdout?.toString().trim().indexOf('true') > -1;
|
||||||
|
|||||||
@ -572,6 +572,7 @@ describe('Run Commands', () => {
|
|||||||
...process.env,
|
...process.env,
|
||||||
...env(),
|
...env(),
|
||||||
},
|
},
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, {
|
expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, {
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
@ -579,6 +580,7 @@ describe('Run Commands', () => {
|
|||||||
...process.env,
|
...process.env,
|
||||||
...env(),
|
...env(),
|
||||||
},
|
},
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -601,6 +603,7 @@ describe('Run Commands', () => {
|
|||||||
...process.env,
|
...process.env,
|
||||||
...env(),
|
...env(),
|
||||||
},
|
},
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, {
|
expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, {
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
@ -608,6 +611,7 @@ describe('Run Commands', () => {
|
|||||||
...process.env,
|
...process.env,
|
||||||
...env(),
|
...env(),
|
||||||
},
|
},
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -627,10 +631,12 @@ describe('Run Commands', () => {
|
|||||||
expect(exec).toHaveBeenNthCalledWith(1, `echo 'Hello World'`, {
|
expect(exec).toHaveBeenNthCalledWith(1, `echo 'Hello World'`, {
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
env: { ...process.env, FORCE_COLOR: `true`, ...env() },
|
env: { ...process.env, FORCE_COLOR: `true`, ...env() },
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, {
|
expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, {
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
env: { ...process.env, FORCE_COLOR: `true`, ...env() },
|
env: { ...process.env, FORCE_COLOR: `true`, ...env() },
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -402,6 +402,7 @@ function nodeProcess(
|
|||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
env,
|
env,
|
||||||
cwd,
|
cwd,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
childProcesses.add(childProcess);
|
childProcesses.add(childProcess);
|
||||||
|
|||||||
@ -54,6 +54,7 @@ function nodeProcess(
|
|||||||
stdio: ['inherit', 'inherit', 'inherit'],
|
stdio: ['inherit', 'inherit', 'inherit'],
|
||||||
cwd,
|
cwd,
|
||||||
env,
|
env,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ function getNxInitDate(): string | null {
|
|||||||
try {
|
try {
|
||||||
const nxInitIso = execSync(
|
const nxInitIso = execSync(
|
||||||
'git log --diff-filter=A --follow --format=%aI -- nx.json | tail -1',
|
'git log --diff-filter=A --follow --format=%aI -- nx.json | tail -1',
|
||||||
{ stdio: 'pipe' }
|
{ stdio: 'pipe', windowsHide: true }
|
||||||
)
|
)
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
|
|||||||
@ -125,6 +125,7 @@ function defaultReadFileAtRevision(
|
|||||||
: execSync(`git show ${revision}:${filePathInGitRepository}`, {
|
: execSync(`git show ${revision}:${filePathInGitRepository}`, {
|
||||||
maxBuffer: TEN_MEGABYTES,
|
maxBuffer: TEN_MEGABYTES,
|
||||||
stdio: ['pipe', 'pipe', 'ignore'],
|
stdio: ['pipe', 'pipe', 'ignore'],
|
||||||
|
windowsHide: true,
|
||||||
})
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
|
|||||||
@ -230,6 +230,7 @@ export class Cache {
|
|||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
detached: true,
|
detached: true,
|
||||||
shell: false,
|
shell: false,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
p.unref();
|
p.unref();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@ -108,7 +108,10 @@ function shouldRecordStats(): boolean {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const stdout = execSync(pmc.getRegistryUrl, { encoding: 'utf-8' });
|
const stdout = execSync(pmc.getRegistryUrl, {
|
||||||
|
encoding: 'utf-8',
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
const url = new URL(stdout.trim());
|
const url = new URL(stdout.trim());
|
||||||
|
|
||||||
// don't record stats when testing locally
|
// don't record stats when testing locally
|
||||||
|
|||||||
@ -20,6 +20,7 @@ export function runNxSync(
|
|||||||
} else {
|
} else {
|
||||||
options ??= {};
|
options ??= {};
|
||||||
options.cwd ??= process.cwd();
|
options.cwd ??= process.cwd();
|
||||||
|
options.windowsHide ??= true;
|
||||||
const offsetFromRoot = relative(
|
const offsetFromRoot = relative(
|
||||||
options.cwd,
|
options.cwd,
|
||||||
workspaceRootInner(options.cwd, null)
|
workspaceRootInner(options.cwd, null)
|
||||||
@ -43,6 +44,7 @@ export async function runNxAsync(
|
|||||||
} else {
|
} else {
|
||||||
options ??= {};
|
options ??= {};
|
||||||
options.cwd ??= process.cwd();
|
options.cwd ??= process.cwd();
|
||||||
|
options.windowsHide ??= true;
|
||||||
const offsetFromRoot = relative(
|
const offsetFromRoot = relative(
|
||||||
options.cwd,
|
options.cwd,
|
||||||
workspaceRootInner(options.cwd, null)
|
workspaceRootInner(options.cwd, null)
|
||||||
|
|||||||
@ -306,6 +306,7 @@ function getMergeBase(base: string, head: string = 'HEAD') {
|
|||||||
maxBuffer: TEN_MEGABYTES,
|
maxBuffer: TEN_MEGABYTES,
|
||||||
cwd: workspaceRoot,
|
cwd: workspaceRoot,
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
})
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
@ -315,6 +316,7 @@ function getMergeBase(base: string, head: string = 'HEAD') {
|
|||||||
maxBuffer: TEN_MEGABYTES,
|
maxBuffer: TEN_MEGABYTES,
|
||||||
cwd: workspaceRoot,
|
cwd: workspaceRoot,
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
})
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
@ -331,7 +333,11 @@ function getFilesUsingBaseAndHead(base: string, head: string): string[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseGitOutput(command: string): string[] {
|
function parseGitOutput(command: string): string[] {
|
||||||
return execSync(command, { maxBuffer: TEN_MEGABYTES, cwd: workspaceRoot })
|
return execSync(command, {
|
||||||
|
maxBuffer: TEN_MEGABYTES,
|
||||||
|
cwd: workspaceRoot,
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
.toString('utf-8')
|
.toString('utf-8')
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map((a) => a.trim())
|
.map((a) => a.trim())
|
||||||
|
|||||||
@ -4,8 +4,11 @@ export function deduceDefaultBase(): string {
|
|||||||
const nxDefaultBase = 'main';
|
const nxDefaultBase = 'main';
|
||||||
try {
|
try {
|
||||||
return (
|
return (
|
||||||
execSync('git config --get init.defaultBranch').toString().trim() ||
|
execSync('git config --get init.defaultBranch', {
|
||||||
nxDefaultBase
|
windowsHide: true,
|
||||||
|
})
|
||||||
|
.toString()
|
||||||
|
.trim() || nxDefaultBase
|
||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
return nxDefaultBase;
|
return nxDefaultBase;
|
||||||
|
|||||||
@ -9,9 +9,10 @@ try {
|
|||||||
const { execSync } = require('child_process');
|
const { execSync } = require('child_process');
|
||||||
// NOTE: Using env vars because Windows PowerShell has its own handling of quotes (") messes up quotes in args, even if escaped.
|
// NOTE: Using env vars because Windows PowerShell has its own handling of quotes (") messes up quotes in args, even if escaped.
|
||||||
const src = process.env.NX_IMPORT_SOURCE;
|
const src = process.env.NX_IMPORT_SOURCE;
|
||||||
execSync('git read-tree --empty', { stdio: 'inherit' });
|
execSync('git read-tree --empty', { stdio: 'inherit', windowsHide: true });
|
||||||
execSync(`git reset ${process.env.GIT_COMMIT} -- "${src}"`, {
|
execSync(`git reset ${process.env.GIT_COMMIT} -- "${src}"`, {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error executing Git commands: ${error}`);
|
console.error(`Error executing Git commands: ${error}`);
|
||||||
|
|||||||
@ -21,7 +21,10 @@ describe('git utils tests', () => {
|
|||||||
const result = getGithubSlugOrNull();
|
const result = getGithubSlugOrNull();
|
||||||
|
|
||||||
expect(result).toBe('origin-user/repo-name');
|
expect(result).toBe('origin-user/repo-name');
|
||||||
expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' });
|
expect(execSync).toHaveBeenCalledWith('git remote -v', {
|
||||||
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return "github" if there are no remotes', () => {
|
it('should return "github" if there are no remotes', () => {
|
||||||
@ -30,7 +33,10 @@ describe('git utils tests', () => {
|
|||||||
const result = getGithubSlugOrNull();
|
const result = getGithubSlugOrNull();
|
||||||
|
|
||||||
expect(result).toBe('github');
|
expect(result).toBe('github');
|
||||||
expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' });
|
expect(execSync).toHaveBeenCalledWith('git remote -v', {
|
||||||
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return "github" if execSync throws an error', () => {
|
it('should return "github" if execSync throws an error', () => {
|
||||||
@ -41,7 +47,10 @@ describe('git utils tests', () => {
|
|||||||
const result = getGithubSlugOrNull();
|
const result = getGithubSlugOrNull();
|
||||||
|
|
||||||
expect(result).toBe('github');
|
expect(result).toBe('github');
|
||||||
expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' });
|
expect(execSync).toHaveBeenCalledWith('git remote -v', {
|
||||||
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the first github remote slug if no origin is present', () => {
|
it('should return the first github remote slug if no origin is present', () => {
|
||||||
@ -53,7 +62,10 @@ describe('git utils tests', () => {
|
|||||||
const result = getGithubSlugOrNull();
|
const result = getGithubSlugOrNull();
|
||||||
|
|
||||||
expect(result).toBe('upstream-user/repo-name');
|
expect(result).toBe('upstream-user/repo-name');
|
||||||
expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' });
|
expect(execSync).toHaveBeenCalledWith('git remote -v', {
|
||||||
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return null if remote is set up but not github', () => {
|
it('should return null if remote is set up but not github', () => {
|
||||||
@ -65,7 +77,10 @@ describe('git utils tests', () => {
|
|||||||
const result = getGithubSlugOrNull();
|
const result = getGithubSlugOrNull();
|
||||||
|
|
||||||
expect(result).toBeNull();
|
expect(result).toBeNull();
|
||||||
expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' });
|
expect(execSync).toHaveBeenCalledWith('git remote -v', {
|
||||||
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the first github remote slug for HTTPS URLs', () => {
|
it('should return the first github remote slug for HTTPS URLs', () => {
|
||||||
@ -77,7 +92,10 @@ describe('git utils tests', () => {
|
|||||||
const result = getGithubSlugOrNull();
|
const result = getGithubSlugOrNull();
|
||||||
|
|
||||||
expect(result).toBe('origin-user/repo-name');
|
expect(result).toBe('origin-user/repo-name');
|
||||||
expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' });
|
expect(execSync).toHaveBeenCalledWith('git remote -v', {
|
||||||
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,9 @@ try {
|
|||||||
// NOTE: Using env vars because Windows PowerShell has its own handling of quotes (") messes up quotes in args, even if escaped.
|
// NOTE: Using env vars because Windows PowerShell has its own handling of quotes (") messes up quotes in args, even if escaped.
|
||||||
const src = process.env.NX_IMPORT_SOURCE;
|
const src = process.env.NX_IMPORT_SOURCE;
|
||||||
const dest = process.env.NX_IMPORT_DESTINATION;
|
const dest = process.env.NX_IMPORT_DESTINATION;
|
||||||
const files = execSync(`git ls-files -z ${src}`)
|
const files = execSync(`git ls-files -z ${src}`, {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim()
|
.trim()
|
||||||
.split('\x00')
|
.split('\x00')
|
||||||
|
|||||||
@ -40,6 +40,7 @@ export class GitRepository {
|
|||||||
getGitRootPath(cwd: string) {
|
getGitRootPath(cwd: string) {
|
||||||
return execSync('git rev-parse --show-toplevel', {
|
return execSync('git rev-parse --show-toplevel', {
|
||||||
cwd,
|
cwd,
|
||||||
|
windowsHide: true,
|
||||||
})
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
@ -237,6 +238,7 @@ export function getGithubSlugOrNull(): string | null {
|
|||||||
try {
|
try {
|
||||||
const gitRemote = execSync('git remote -v', {
|
const gitRemote = execSync('git remote -v', {
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
}).toString();
|
}).toString();
|
||||||
// If there are no remotes, we default to github
|
// If there are no remotes, we default to github
|
||||||
if (!gitRemote || gitRemote.length === 0) {
|
if (!gitRemote || gitRemote.length === 0) {
|
||||||
@ -302,6 +304,7 @@ export function commitChanges(
|
|||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
input: commitMessage,
|
input: commitMessage,
|
||||||
cwd: directory,
|
cwd: directory,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (directory) {
|
if (directory) {
|
||||||
@ -323,6 +326,7 @@ export function getLatestCommitSha(): string | null {
|
|||||||
return execSync('git rev-parse HEAD', {
|
return execSync('git rev-parse HEAD', {
|
||||||
encoding: 'utf8',
|
encoding: 'utf8',
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
windowsHide: true,
|
||||||
}).trim();
|
}).trim();
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -80,6 +80,7 @@ export async function playwrightExecutor(
|
|||||||
execSync(`${pmc.exec} playwright install`, {
|
execSync(`${pmc.exec} playwright install`, {
|
||||||
cwd: workspaceRoot,
|
cwd: workspaceRoot,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -161,7 +161,10 @@ function getBrowsersInstallTask() {
|
|||||||
bodyLines: ['use --skipInstall to skip installation.'],
|
bodyLines: ['use --skipInstall to skip installation.'],
|
||||||
});
|
});
|
||||||
const pmc = getPackageManagerCommand();
|
const pmc = getPackageManagerCommand();
|
||||||
execSync(`${pmc.exec} playwright install`, { cwd: workspaceRoot });
|
execSync(`${pmc.exec} playwright install`, {
|
||||||
|
cwd: workspaceRoot,
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ export function runCommandAsync(
|
|||||||
{
|
{
|
||||||
cwd: opts.cwd ?? tmpProjPath(),
|
cwd: opts.cwd ?? tmpProjPath(),
|
||||||
env: { ...process.env, ...opts.env },
|
env: { ...process.env, ...opts.env },
|
||||||
|
windowsHide: true,
|
||||||
},
|
},
|
||||||
(err, stdout, stderr) => {
|
(err, stdout, stderr) => {
|
||||||
if (!opts.silenceError && err) {
|
if (!opts.silenceError && err) {
|
||||||
|
|||||||
@ -21,6 +21,7 @@ export function runNxCommand(
|
|||||||
const execSyncOptions: ExecOptions = {
|
const execSyncOptions: ExecOptions = {
|
||||||
cwd,
|
cwd,
|
||||||
env: { ...process.env, ...opts.env },
|
env: { ...process.env, ...opts.env },
|
||||||
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
if (fileExists(tmpProjPath('package.json'))) {
|
if (fileExists(tmpProjPath('package.json'))) {
|
||||||
const pmc = getPackageManagerCommand(detectPackageManager(cwd));
|
const pmc = getPackageManagerCommand(detectPackageManager(cwd));
|
||||||
|
|||||||
@ -21,6 +21,7 @@ function runNxNewCommand(args?: string, silent?: boolean) {
|
|||||||
{
|
{
|
||||||
cwd: localTmpDir,
|
cwd: localTmpDir,
|
||||||
...(silent && false ? { stdio: ['ignore', 'ignore', 'ignore'] } : {}),
|
...(silent && false ? { stdio: ['ignore', 'ignore', 'ignore'] } : {}),
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -55,6 +56,7 @@ export function runPackageManagerInstall(silent: boolean = true) {
|
|||||||
const install = execSync(pmc.install, {
|
const install = execSync(pmc.install, {
|
||||||
cwd,
|
cwd,
|
||||||
...(silent ? { stdio: ['ignore', 'ignore', 'ignore'] } : {}),
|
...(silent ? { stdio: ['ignore', 'ignore', 'ignore'] } : {}),
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
return install ? install.toString() : '';
|
return install ? install.toString() : '';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,6 +72,7 @@ export function podInstall(
|
|||||||
execSync('touch .xcode.env', {
|
execSync('touch .xcode.env', {
|
||||||
cwd: iosDirectory,
|
cwd: iosDirectory,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const podCommand = [
|
const podCommand = [
|
||||||
@ -82,6 +83,7 @@ export function podInstall(
|
|||||||
execSync(podCommand, {
|
execSync(podCommand, {
|
||||||
cwd: iosDirectory,
|
cwd: iosDirectory,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(podInstallErrorMessage);
|
logger.error(podInstallErrorMessage);
|
||||||
|
|||||||
@ -20,6 +20,7 @@ export function callUpgrade(schema: Schema): 1 | Buffer {
|
|||||||
}`,
|
}`,
|
||||||
{
|
{
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -85,6 +86,7 @@ export function callAutomigrate(
|
|||||||
`${commandToRun} ${schema.autoAcceptAllPrompts ? '--yes' : ''}`,
|
`${commandToRun} ${schema.autoAcceptAllPrompts ? '--yes' : ''}`,
|
||||||
{
|
{
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@ export function callUpgrade(schema: Schema): 1 | Buffer {
|
|||||||
}`,
|
}`,
|
||||||
{
|
{
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -83,6 +84,7 @@ export function callAutomigrate(
|
|||||||
`${commandToRun} ${schema.autoAcceptAllPrompts ? '--yes' : ''}`,
|
`${commandToRun} ${schema.autoAcceptAllPrompts ? '--yes' : ''}`,
|
||||||
{
|
{
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,9 @@ export function nxViteBuildCoordinationPlugin(
|
|||||||
|
|
||||||
async function buildChangedProjects() {
|
async function buildChangedProjects() {
|
||||||
await new Promise<void>((res) => {
|
await new Promise<void>((res) => {
|
||||||
activeBuildProcess = exec(options.buildCommand);
|
activeBuildProcess = exec(options.buildCommand, {
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
activeBuildProcess.stdout.pipe(process.stdout);
|
activeBuildProcess.stdout.pipe(process.stdout);
|
||||||
activeBuildProcess.stderr.pipe(process.stderr);
|
activeBuildProcess.stderr.pipe(process.stderr);
|
||||||
activeBuildProcess.on('exit', () => {
|
activeBuildProcess.on('exit', () => {
|
||||||
|
|||||||
@ -36,6 +36,7 @@ export async function validateTypes(opts: {
|
|||||||
{
|
{
|
||||||
cwd: opts.workspaceRoot,
|
cwd: opts.workspaceRoot,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,9 @@ export class WebpackNxBuildCoordinationPlugin {
|
|||||||
this.currentlyRunning = 'nx-build';
|
this.currentlyRunning = 'nx-build';
|
||||||
try {
|
try {
|
||||||
return await new Promise<void>((res) => {
|
return await new Promise<void>((res) => {
|
||||||
this.buildCmdProcess = exec(this.buildCmd);
|
this.buildCmdProcess = exec(this.buildCmd, {
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
|
|
||||||
this.buildCmdProcess.stdout.pipe(process.stdout);
|
this.buildCmdProcess.stdout.pipe(process.stdout);
|
||||||
this.buildCmdProcess.stderr.pipe(process.stderr);
|
this.buildCmdProcess.stderr.pipe(process.stderr);
|
||||||
|
|||||||
@ -36,6 +36,7 @@ export function generatePreset(host: Tree, opts: NormalizedSchema) {
|
|||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
shell: true,
|
shell: true,
|
||||||
cwd: join(host.root, opts.directory),
|
cwd: join(host.root, opts.directory),
|
||||||
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
const pmc = getPackageManagerCommand();
|
const pmc = getPackageManagerCommand();
|
||||||
const executable = `${pmc.exec} nx`;
|
const executable = `${pmc.exec} nx`;
|
||||||
|
|||||||
@ -63,6 +63,7 @@ export async function newGenerator(tree: Tree, opts: Schema) {
|
|||||||
cwd: joinPathFragments(tree.root, options.directory),
|
cwd: joinPathFragments(tree.root, options.directory),
|
||||||
stdio:
|
stdio:
|
||||||
process.env.NX_GENERATE_QUIET === 'true' ? 'ignore' : 'inherit',
|
process.env.NX_GENERATE_QUIET === 'true' ? 'ignore' : 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
installPackagesTask(
|
installPackagesTask(
|
||||||
|
|||||||
@ -7,7 +7,11 @@ export function getNpmPackageVersion(
|
|||||||
`npm view ${packageName}${
|
`npm view ${packageName}${
|
||||||
packageVersion ? '@' + packageVersion : ''
|
packageVersion ? '@' + packageVersion : ''
|
||||||
} version --json`,
|
} version --json`,
|
||||||
{ stdio: ['pipe', 'pipe', 'ignore'] }
|
{
|
||||||
|
stdio: ['pipe', 'pipe', 'ignore'],
|
||||||
|
|
||||||
|
windowsHide: true,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
|
|||||||
@ -4,8 +4,11 @@ export function deduceDefaultBase(): string {
|
|||||||
const nxDefaultBase = 'main';
|
const nxDefaultBase = 'main';
|
||||||
try {
|
try {
|
||||||
return (
|
return (
|
||||||
execSync('git config --get init.defaultBranch').toString().trim() ||
|
execSync('git config --get init.defaultBranch', {
|
||||||
nxDefaultBase
|
windowsHide: true,
|
||||||
|
})
|
||||||
|
.toString()
|
||||||
|
.trim() || nxDefaultBase
|
||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
return nxDefaultBase;
|
return nxDefaultBase;
|
||||||
|
|||||||
@ -42,11 +42,20 @@ async function run() {
|
|||||||
updateVersionUtils(packageVersionMap);
|
updateVersionUtils(packageVersionMap);
|
||||||
|
|
||||||
console.log('⏳ - Installing packages...');
|
console.log('⏳ - Installing packages...');
|
||||||
execSync('pnpm install', { stdio: 'inherit', encoding: 'utf8' });
|
execSync('pnpm install', {
|
||||||
|
stdio: 'inherit',
|
||||||
|
encoding: 'utf8',
|
||||||
|
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
console.log('✅ - Finished installing packages!');
|
console.log('✅ - Finished installing packages!');
|
||||||
|
|
||||||
console.log('⏳ - Formatting files...');
|
console.log('⏳ - Formatting files...');
|
||||||
execSync('pnpm nx format', { stdio: 'inherit', encoding: 'utf8' });
|
execSync('pnpm nx format', {
|
||||||
|
stdio: 'inherit',
|
||||||
|
encoding: 'utf8',
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
console.log('✅ - Finished creating migrations!');
|
console.log('✅ - Finished creating migrations!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@ export async function generateDevkitDocumentation() {
|
|||||||
const execSyncOptions: ExecSyncOptions = {
|
const execSyncOptions: ExecSyncOptions = {
|
||||||
stdio: 'true' === 'true' ? 'inherit' : 'ignore',
|
stdio: 'true' === 'true' ? 'inherit' : 'ignore',
|
||||||
// stdio: process.env.CI === 'true' ? 'inherit' : 'ignore',
|
// stdio: process.env.CI === 'true' ? 'inherit' : 'ignore',
|
||||||
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
execSync('nx run-many -t build -p devkit,typedoc-theme', execSyncOptions);
|
execSync('nx run-many -t build -p devkit,typedoc-theme', execSyncOptions);
|
||||||
|
|||||||
@ -38,7 +38,9 @@ async function generate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkDocumentation() {
|
function checkDocumentation() {
|
||||||
const output = execSync('git status --porcelain ./docs').toString('utf-8');
|
const output = execSync('git status --porcelain ./docs', {
|
||||||
|
windowsHide: true,
|
||||||
|
}).toString('utf-8');
|
||||||
|
|
||||||
if (output) {
|
if (output) {
|
||||||
console.log(
|
console.log(
|
||||||
@ -50,7 +52,10 @@ function checkDocumentation() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
console.log('\nChanged Docs:');
|
console.log('\nChanged Docs:');
|
||||||
execSync('git status --porcelain ./docs', { stdio: 'inherit' });
|
execSync('git status --porcelain ./docs', {
|
||||||
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -62,7 +62,9 @@ function writeFile() {
|
|||||||
|
|
||||||
// if no generated projects are found, generate one for nx and try this again
|
// if no generated projects are found, generate one for nx and try this again
|
||||||
if (generatedGraphs.length === 0) {
|
if (generatedGraphs.length === 0) {
|
||||||
execSync('nx run graph-client:generate-graph --directory ./ --name nx');
|
execSync('nx run graph-client:generate-graph --directory ./ --name nx', {
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
writeFile();
|
writeFile();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ async function generateGraph(directory: string, name: string) {
|
|||||||
try {
|
try {
|
||||||
execSync(
|
execSync(
|
||||||
'npx nx graph --file ./node_modules/.cache/nx-graph-gen/graph.html',
|
'npx nx graph --file ./node_modules/.cache/nx-graph-gen/graph.html',
|
||||||
{ cwd: directory, stdio: 'ignore' }
|
{ cwd: directory, stdio: 'ignore', windowsHide: true }
|
||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
console.error(`Could not run graph command in directory ${directory}`);
|
console.error(`Could not run graph command in directory ${directory}`);
|
||||||
|
|||||||
@ -35,6 +35,7 @@ const VALID_AUTHORS_FOR_LATEST = [
|
|||||||
execSync(`pnpm nx copy-native-package-directories nx`, {
|
execSync(`pnpm nx copy-native-package-directories nx`, {
|
||||||
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Expected to run as part of the Github `publish` workflow
|
// Expected to run as part of the Github `publish` workflow
|
||||||
@ -44,11 +45,13 @@ const VALID_AUTHORS_FOR_LATEST = [
|
|||||||
execSync('find ./build -name "*.node" -delete', {
|
execSync('find ./build -name "*.node" -delete', {
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
execSync('pnpm nx run-many --target=artifacts', {
|
execSync('pnpm nx run-many --target=artifacts', {
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +69,7 @@ const VALID_AUTHORS_FOR_LATEST = [
|
|||||||
execSync(versionCommand, {
|
execSync(versionCommand, {
|
||||||
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -74,7 +78,9 @@ const VALID_AUTHORS_FOR_LATEST = [
|
|||||||
// For this important use-case it makes sense to always have full logs
|
// For this important use-case it makes sense to always have full logs
|
||||||
isVerboseLogging = true;
|
isVerboseLogging = true;
|
||||||
|
|
||||||
execSync('git status --ahead-behind');
|
execSync('git status --ahead-behind', {
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
|
|
||||||
if (isRelativeVersionKeyword(options.version)) {
|
if (isRelativeVersionKeyword(options.version)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@ -87,6 +93,7 @@ const VALID_AUTHORS_FOR_LATEST = [
|
|||||||
execSync(`pnpm nx run-many -t add-extra-dependencies --parallel 8`, {
|
execSync(`pnpm nx run-many -t add-extra-dependencies --parallel 8`, {
|
||||||
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
let changelogCommand = `pnpm nx release changelog ${options.version} --interactive workspace`;
|
let changelogCommand = `pnpm nx release changelog ${options.version} --interactive workspace`;
|
||||||
@ -106,6 +113,7 @@ const VALID_AUTHORS_FOR_LATEST = [
|
|||||||
execSync(changelogCommand, {
|
execSync(changelogCommand, {
|
||||||
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
@ -119,6 +127,7 @@ const VALID_AUTHORS_FOR_LATEST = [
|
|||||||
execSync(`pnpm nx run-many -t add-extra-dependencies --parallel 8`, {
|
execSync(`pnpm nx run-many -t add-extra-dependencies --parallel 8`, {
|
||||||
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
stdio: isVerboseLogging ? [0, 1, 2] : 'ignore',
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const distTag = determineDistTag(options.version);
|
const distTag = determineDistTag(options.version);
|
||||||
@ -174,12 +183,17 @@ const VALID_AUTHORS_FOR_LATEST = [
|
|||||||
execSync(publishCommand, {
|
execSync(publishCommand, {
|
||||||
stdio: [0, 1, 2],
|
stdio: [0, 1, 2],
|
||||||
maxBuffer: LARGE_BUFFER,
|
maxBuffer: LARGE_BUFFER,
|
||||||
|
windowsHide: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!options.dryRun) {
|
if (!options.dryRun) {
|
||||||
let version;
|
let version;
|
||||||
if (['minor', 'major', 'patch'].includes(options.version)) {
|
if (['minor', 'major', 'patch'].includes(options.version)) {
|
||||||
version = execSync(`npm view nx@${distTag} version`).toString().trim();
|
version = execSync(`npm view nx@${distTag} version`, {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
} else {
|
} else {
|
||||||
version = options.version;
|
version = options.version;
|
||||||
}
|
}
|
||||||
@ -256,10 +270,14 @@ function parseArgs() {
|
|||||||
* Handle the special case of `canary`
|
* Handle the special case of `canary`
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const currentLatestVersion = execSync('npm view nx@latest version')
|
const currentLatestVersion = execSync('npm view nx@latest version', {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
const currentNextVersion = execSync('npm view nx@next version')
|
const currentNextVersion = execSync('npm view nx@next version', {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
@ -290,7 +308,11 @@ function parseArgs() {
|
|||||||
const YYYYMMDD = `${year}${month}${day}`;
|
const YYYYMMDD = `${year}${month}${day}`;
|
||||||
|
|
||||||
// Get the current short git sha
|
// Get the current short git sha
|
||||||
const gitSha = execSync('git rev-parse --short HEAD').toString().trim();
|
const gitSha = execSync('git rev-parse --short HEAD', {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
|
||||||
const canaryVersion = `${canaryBaseVersion}-canary.${YYYYMMDD}-${gitSha}`;
|
const canaryVersion = `${canaryBaseVersion}-canary.${YYYYMMDD}-${gitSha}`;
|
||||||
|
|
||||||
@ -358,7 +380,13 @@ function parseArgs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getRegistry() {
|
function getRegistry() {
|
||||||
return new URL(execSync('npm config get registry').toString().trim());
|
return new URL(
|
||||||
|
execSync('npm config get registry', {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
|
.toString()
|
||||||
|
.trim()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function determineDistTag(
|
function determineDistTag(
|
||||||
@ -392,7 +420,9 @@ function determineDistTag(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentLatestVersion = execSync('npm view nx version')
|
const currentLatestVersion = execSync('npm view nx version', {
|
||||||
|
windowsHide: true,
|
||||||
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
const parsedCurrentLatestVersion = parse(currentLatestVersion);
|
const parsedCurrentLatestVersion = parse(currentLatestVersion);
|
||||||
|
|||||||
@ -8,7 +8,9 @@ console.log(`Comparing ${currentVersion} to npm versions`);
|
|||||||
|
|
||||||
const majorVersion = major(currentVersion);
|
const majorVersion = major(currentVersion);
|
||||||
const releasedVersions: string[] = JSON.parse(
|
const releasedVersions: string[] = JSON.parse(
|
||||||
execSync(`npm show nx@^${majorVersion} version --json`).toString()
|
execSync(`npm show nx@^${majorVersion} version --json`, {
|
||||||
|
windowsHide: true,
|
||||||
|
}).toString()
|
||||||
);
|
);
|
||||||
|
|
||||||
const latestVersion = maxSatisfying(releasedVersions, `^${majorVersion}`);
|
const latestVersion = maxSatisfying(releasedVersions, `^${majorVersion}`);
|
||||||
@ -23,8 +25,12 @@ if (currentVersion && latestVersion && gte(currentVersion, latestVersion)) {
|
|||||||
`Publishing docs site for ${process.env.GITHUB_REF_NAME} to ${branchName}`
|
`Publishing docs site for ${process.env.GITHUB_REF_NAME} to ${branchName}`
|
||||||
);
|
);
|
||||||
// We force recreate the branch in order to always be up to date and avoid merge conflicts within the automated workflow
|
// We force recreate the branch in order to always be up to date and avoid merge conflicts within the automated workflow
|
||||||
execSync(`git branch -f ${branchName}`);
|
execSync(`git branch -f ${branchName}`, {
|
||||||
execSync(`git push -f origin ${branchName}`);
|
windowsHide: true,
|
||||||
|
});
|
||||||
|
execSync(`git push -f origin ${branchName}`, {
|
||||||
|
windowsHide: true,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(`Not publishing docs to ${branchName}`);
|
console.log(`Not publishing docs to ${branchName}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user