use --path option instead of [path] argument in create-app

Signed-off-by: Colton Padden <colton.padden@fastmail.com>
This commit is contained in:
Colton Padden
2021-10-05 11:20:35 -04:00
parent fe48f0ea95
commit 973678fd8c
2 changed files with 10 additions and 8 deletions
+5 -6
View File
@@ -120,12 +120,11 @@ export default async (cmd: Command): Promise<void> => {
const templateDir = paths.resolveOwn('templates/default-app');
const tempDir = resolvePath(os.tmpdir(), answers.name);
// Use `[path]` argument as applicaiton directory when specified, otherwise
// Use `--path` argument as applicaiton directory when specified, otherwise
// create a directory using `answers.name`
const appDir =
cmd.args.length > 0
? resolvePath(cmd.args[0])
: resolvePath(paths.targetDir, answers.name);
const appDir = cmd.path
? resolvePath(cmd.path)
: resolvePath(paths.targetDir, answers.name);
Task.log();
Task.log('Creating the app...');
@@ -133,7 +132,7 @@ export default async (cmd: Command): Promise<void> => {
try {
// Directory must not already exist when using consructed path from
// `answers.name`
if (cmd.args.length === 0) {
if (!cmd.path) {
Task.section('Checking if the directory is available');
await checkExists(paths.targetDir, answers.name);
}
+5 -2
View File
@@ -29,8 +29,11 @@ const main = (argv: string[]) => {
program
.name('backstage-create-app')
.version(version)
.description('Creates a new app in a new directory or specified [path]')
.usage('[path] [options]')
.description('Creates a new app in a new directory or specified path')
.option(
'--path [directory]',
'Location to store the app defaulting to a new folder with the app name',
)
.option(
'--skip-install',
'Skip the install and builds steps after creating the app',