mirror of
https://github.com/CompeyDev/create-guilded-bot.git
synced 2025-01-05 18:59:10 +00:00
feat(cli): javascript template download & unpacking mechanism
This commit is contained in:
parent
32a001a23f
commit
acc1962589
1 changed files with 22 additions and 15 deletions
|
@ -51,26 +51,33 @@ inquirer
|
||||||
|
|
||||||
let packageManager = getPackageManager()
|
let packageManager = getPackageManager()
|
||||||
|
|
||||||
|
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`)
|
||||||
|
.pipe(unzip.Extract({ path: `${answers.location}` }))
|
||||||
|
.on("finish", () => {
|
||||||
|
removeSync(`${answers.location}/create-guilded-bot_ts.zip`)
|
||||||
|
logger.success("🚀 Let's get started.")
|
||||||
|
})
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
if (answers.flavor == "typescript") {
|
if (answers.flavor == "typescript") {
|
||||||
const TEMPLATE_DOWNLOAD_URL = "https://files.devcomp.xyz/r/create-guilded-app_ts.zip"
|
const TEMPLATE_DOWNLOAD_URL = "https://files.devcomp.xyz/r/create-guilded-app_ts.zip"
|
||||||
|
|
||||||
const start = () => {
|
start(TEMPLATE_DOWNLOAD_URL).then(() => {
|
||||||
const download = stream(TEMPLATE_DOWNLOAD_URL, { isStream: true }).pipe(createWriteStream(`${answers.location}/create-guilded-bot_ts.zip`));
|
install(packageManager as "npm" | "pnpm" | "yarn" | null, answers.location)
|
||||||
download.on("finish", () => {
|
})
|
||||||
fs.createReadStream(`${answers.location}/create-guilded-bot_ts.zip`)
|
}
|
||||||
.pipe(unzip.Extract({ path: `${answers.location}` }))
|
|
||||||
.on("finish", () => {
|
if (answers.flavor == "javascript") {
|
||||||
removeSync(`${answers.location}/create-guilded-bot_ts.zip`)
|
const TEMPLATE_DOWNLOAD_URL = "https://files.devcomp.xyz/r/create-guilded-app_js.zip"
|
||||||
logger.success("🚀 Let's get started.")
|
|
||||||
})
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
start(TEMPLATE_DOWNLOAD_URL).then(() => {
|
||||||
start();
|
install(packageManager as "npm" | "pnpm" | "yarn" | null, answers.location)
|
||||||
|
})
|
||||||
install(packageManager as "npm" | "pnpm" | "yarn" | null, answers.location)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue