feat(cli): javascript template download & unpacking mechanism

This commit is contained in:
Erica Marigold 2022-11-21 14:43:02 +05:30
parent 32a001a23f
commit acc1962589
No known key found for this signature in database
GPG key ID: 23CD97ABBBCC5ED2

View file

@ -51,10 +51,7 @@ inquirer
let packageManager = getPackageManager()
if (answers.flavor == "typescript") {
const TEMPLATE_DOWNLOAD_URL = "https://files.devcomp.xyz/r/create-guilded-app_ts.zip"
const start = () => {
const start = async (TEMPLATE_DOWNLOAD_URL) => {
const download = stream(TEMPLATE_DOWNLOAD_URL, { isStream: true }).pipe(createWriteStream(`${answers.location}/create-guilded-bot_ts.zip`));
download.on("finish", () => {
fs.createReadStream(`${answers.location}/create-guilded-bot_ts.zip`)
@ -66,11 +63,21 @@ inquirer
});
};
if (answers.flavor == "typescript") {
const TEMPLATE_DOWNLOAD_URL = "https://files.devcomp.xyz/r/create-guilded-app_ts.zip"
start();
start(TEMPLATE_DOWNLOAD_URL).then(() => {
install(packageManager as "npm" | "pnpm" | "yarn" | null, answers.location)
})
}
if (answers.flavor == "javascript") {
const TEMPLATE_DOWNLOAD_URL = "https://files.devcomp.xyz/r/create-guilded-app_js.zip"
start(TEMPLATE_DOWNLOAD_URL).then(() => {
install(packageManager as "npm" | "pnpm" | "yarn" | null, answers.location)
})
}
});