fix(core): ensure preinstall is only run once on repo (#18671)
This commit is contained in:
parent
195c5bfb2f
commit
adb39c464d
@ -42,9 +42,6 @@ export function installPackagesTask(
|
|||||||
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',
|
||||||
};
|
};
|
||||||
if (pmc.preInstall) {
|
|
||||||
execSync(pmc.preInstall, execSyncOptions);
|
|
||||||
}
|
|
||||||
execSync(pmc.install, execSyncOptions);
|
execSync(pmc.install, execSyncOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
addDependenciesToPackageJson,
|
addDependenciesToPackageJson,
|
||||||
|
getPackageManagerCommand,
|
||||||
installPackagesTask,
|
installPackagesTask,
|
||||||
|
joinPathFragments,
|
||||||
names,
|
names,
|
||||||
PackageManager,
|
PackageManager,
|
||||||
Tree,
|
Tree,
|
||||||
@ -11,6 +13,7 @@ import { Preset } from '../utils/presets';
|
|||||||
import { Linter } from '../../utils/lint';
|
import { Linter } from '../../utils/lint';
|
||||||
import { generateWorkspaceFiles } from './generate-workspace-files';
|
import { generateWorkspaceFiles } from './generate-workspace-files';
|
||||||
import { addPresetDependencies, generatePreset } from './generate-preset';
|
import { addPresetDependencies, generatePreset } from './generate-preset';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
|
|
||||||
interface Schema {
|
interface Schema {
|
||||||
directory: string;
|
directory: string;
|
||||||
@ -48,6 +51,13 @@ export async function newGenerator(host: Tree, opts: Schema) {
|
|||||||
addCloudDependencies(host, options);
|
addCloudDependencies(host, options);
|
||||||
|
|
||||||
return async () => {
|
return async () => {
|
||||||
|
const pmc = getPackageManagerCommand(options.packageManager);
|
||||||
|
if (pmc.preInstall) {
|
||||||
|
execSync(pmc.preInstall, {
|
||||||
|
cwd: joinPathFragments(host.root, options.directory),
|
||||||
|
stdio: process.env.NX_GENERATE_QUIET === 'true' ? 'ignore' : 'inherit',
|
||||||
|
});
|
||||||
|
}
|
||||||
installPackagesTask(host, false, options.directory, options.packageManager);
|
installPackagesTask(host, false, options.directory, options.packageManager);
|
||||||
// TODO: move all of these into create-nx-workspace
|
// TODO: move all of these into create-nx-workspace
|
||||||
if (
|
if (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user