cli/commands/new: add option to skip install
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -179,6 +179,7 @@ Usage: backstage-cli new [options]
|
||||
Options:
|
||||
--select <name>
|
||||
--option <name>=<value>
|
||||
--skip-install
|
||||
--scope <scope>
|
||||
--npm-registry <URL>
|
||||
--baseVersion <version>
|
||||
|
||||
@@ -257,6 +257,10 @@ export function registerCommands(program: Command) {
|
||||
(opt, arr: string[]) => [...arr, opt],
|
||||
[],
|
||||
)
|
||||
.option(
|
||||
'--skip-install',
|
||||
`Skips running 'yarn install' and 'yarn lint --fix'`,
|
||||
)
|
||||
.option('--scope <scope>', 'The scope to use for new packages')
|
||||
.option(
|
||||
'--npm-registry <URL>',
|
||||
|
||||
@@ -19,6 +19,7 @@ import { createNewPackage } from '../../lib/new/createNewPackage';
|
||||
type ArgOptions = {
|
||||
option: string[];
|
||||
select?: string;
|
||||
skipInstall: boolean;
|
||||
private?: boolean;
|
||||
npmRegistry?: string;
|
||||
scope?: string;
|
||||
@@ -30,6 +31,7 @@ export default async (opts: ArgOptions) => {
|
||||
const {
|
||||
option: rawArgOptions,
|
||||
select: preselectedTemplateId,
|
||||
skipInstall,
|
||||
scope,
|
||||
private: isPrivate,
|
||||
...otherGlobals
|
||||
@@ -67,6 +69,7 @@ export default async (opts: ArgOptions) => {
|
||||
packageNamePrefix: packagePrefix,
|
||||
packageNamePluginInfix: pluginInfix,
|
||||
},
|
||||
skipInstall,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ export type CreateNewPackageOptions = {
|
||||
preselectedTemplateId?: string;
|
||||
configOverrides: Partial<PortableTemplateConfig>;
|
||||
prefilledParams: PortableTemplateParams;
|
||||
skipInstall?: boolean;
|
||||
};
|
||||
|
||||
export async function createNewPackage(options: CreateNewPackageOptions) {
|
||||
@@ -50,5 +51,6 @@ export async function createNewPackage(options: CreateNewPackageOptions) {
|
||||
config,
|
||||
template,
|
||||
input,
|
||||
skipInstall: options.skipInstall,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ type ExecuteNewTemplateOptions = {
|
||||
config: PortableTemplateConfig;
|
||||
template: PortableTemplate;
|
||||
input: PortableTemplateInput;
|
||||
skipInstall?: boolean;
|
||||
};
|
||||
|
||||
export async function executePortableTemplate(
|
||||
@@ -48,14 +49,16 @@ export async function executePortableTemplate(
|
||||
await addCodeownersEntry(targetDir, input.owner);
|
||||
}
|
||||
|
||||
await Task.forCommand('yarn install', {
|
||||
cwd: targetDir,
|
||||
optional: true,
|
||||
});
|
||||
await Task.forCommand('yarn lint --fix', {
|
||||
cwd: targetDir,
|
||||
optional: true,
|
||||
});
|
||||
if (!options.skipInstall) {
|
||||
await Task.forCommand('yarn install', {
|
||||
cwd: targetDir,
|
||||
optional: true,
|
||||
});
|
||||
await Task.forCommand('yarn lint --fix', {
|
||||
cwd: targetDir,
|
||||
optional: true,
|
||||
});
|
||||
}
|
||||
|
||||
Task.log();
|
||||
Task.log(`🎉 Successfully created ${template.name}`);
|
||||
|
||||
Reference in New Issue
Block a user