repo-tools: make generate-patch run yarn install
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -63,6 +63,7 @@ Options:
|
||||
--registry-url <registry-url>
|
||||
--base-version <version>
|
||||
--query <query>
|
||||
--skip-install
|
||||
-h, --help
|
||||
```
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ export default async (
|
||||
query?: string;
|
||||
registryUrl?: string;
|
||||
baseVersion?: string;
|
||||
skipInstall?: boolean;
|
||||
},
|
||||
) => {
|
||||
const sourceRepo = await getPackages(process.cwd());
|
||||
@@ -115,9 +116,18 @@ export default async (
|
||||
|
||||
await updateTargetRootPkg(patchEntry);
|
||||
|
||||
console.log(
|
||||
'Done, be sure to reinstall dependencies in the target workspace',
|
||||
);
|
||||
if (!opts.skipInstall) {
|
||||
console.log("Running 'yarn install' in target workspace");
|
||||
await exec('yarn', ['install'], {
|
||||
cwd: ctx.targetRoot,
|
||||
}).catch(() => {
|
||||
throw new Error(
|
||||
"Failed to run 'yarn install' in target workspace, please run it manually to troubleshoot",
|
||||
);
|
||||
});
|
||||
} else {
|
||||
console.log("Skipped running 'yarn install'");
|
||||
}
|
||||
} finally {
|
||||
fs.rmSync(tmpDir, { force: true, recursive: true, maxRetries: 3 });
|
||||
}
|
||||
|
||||
@@ -271,6 +271,10 @@ export function registerCommands(program: Command) {
|
||||
'--query <query>',
|
||||
'Only apply the patch for a specific version query in the target repository',
|
||||
)
|
||||
.option(
|
||||
'--skip-install',
|
||||
'Skip dependency installation in the target repository after applying the patch',
|
||||
)
|
||||
.description(
|
||||
'Generate a patch for the selected package in the target repository',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user