@apphosting/create
Advanced tools
Comparing version 0.2.1 to 0.3.0
#! /usr/bin/env node | ||
import { program } from "commander"; | ||
import { downloadTemplate } from "giget"; | ||
import { select } from "@inquirer/prompts"; | ||
import { select, input } from "@inquirer/prompts"; | ||
import spawn from "@npmcli/promise-spawn"; | ||
@@ -17,4 +17,8 @@ import ora from "ora"; | ||
.option("--package-manager <string>") | ||
.argument("<directory>", "path to the project's root directory") | ||
.action(async (dir, { framework, packageManager }) => { | ||
.argument("[directory]", "path to the project's root directory") | ||
.action(async (directory, { framework, packageManager }) => { | ||
directory || (directory = await input({ | ||
message: "What directory should we bootstrap the application in?", | ||
default: ".", | ||
})); | ||
// TODO DRY up the validation and error handling, move to commander parse | ||
@@ -69,3 +73,3 @@ if (framework) { | ||
// TODO allow different templates | ||
await downloadTemplate(`gh:FirebaseExtended/firebase-framework-tools/starters/${framework}/basic`, { dir, force: true }); | ||
await downloadTemplate(`gh:FirebaseExtended/firebase-framework-tools/starters/${framework}/basic`, { dir: directory, force: true }); | ||
cloneSpinner.succeed(); | ||
@@ -77,3 +81,3 @@ if (packageManager === "npm") { | ||
stdio: "inherit", | ||
cwd: dir, | ||
cwd: directory, | ||
}); | ||
@@ -85,3 +89,3 @@ } | ||
stdio: "inherit", | ||
cwd: dir, | ||
cwd: directory, | ||
}); | ||
@@ -91,3 +95,3 @@ await spawn("corepack", ["use", `${packageManager}@${packageManagerVersion}`], { | ||
stdio: "inherit", | ||
cwd: dir, | ||
cwd: directory, | ||
}); | ||
@@ -94,0 +98,0 @@ } |
{ | ||
"name": "@apphosting/create", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"main": "dist/index.js", | ||
@@ -46,5 +46,4 @@ "description": "Experimental addon to the Firebase CLI to add web framework support", | ||
"@types/npmcli__promise-spawn": "^6.0.3", | ||
"ts-node": "*", | ||
"typescript": "*" | ||
} | ||
} |
4617
3
99