create-arcstack 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.cjs +1 -2
- package/bin/run.cjs.map +1 -1
- package/bin/run.js +1 -2
- package/bin/run.js.map +1 -1
- package/package.json +1 -1
package/bin/run.cjs
CHANGED
|
@@ -228,7 +228,6 @@ var CreateArcstackCommand = class extends __h3ravel_musket.Command {
|
|
|
228
228
|
async handle() {
|
|
229
229
|
const options = this.options();
|
|
230
230
|
const pathName = this.argument("location");
|
|
231
|
-
const defaultName = pathName ? __h3ravel_support.Str.of(pathName).afterLast("/") : void 0;
|
|
232
231
|
console.log(altLogo, `font-family: monospace`);
|
|
233
232
|
let { template } = await inquirer.default.prompt([{
|
|
234
233
|
type: "list",
|
|
@@ -252,7 +251,7 @@ var CreateArcstackCommand = class extends __h3ravel_musket.Command {
|
|
|
252
251
|
type: "input",
|
|
253
252
|
name: "appName",
|
|
254
253
|
message: "What is the name of your project:",
|
|
255
|
-
default:
|
|
254
|
+
default: `arcstack-${template}`,
|
|
256
255
|
when: () => !options.name
|
|
257
256
|
}, {
|
|
258
257
|
type: "input",
|
package/bin/run.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.cjs","names":["templates: {\n name: string;\n alias: \"express\" | \"h3\";\n hint: string;\n source: string;\n prereleaseSource?: string;\n}[]","location?: string","appName?: string","description?: string","path","Resolver","Str","packageJsonScript","path","Command","Str","AbortPromptError","ExitPromptError","source: string","Actions","Logger","Kernel"],"sources":["../src/logo.ts","../src/templates.ts","../src/actions.ts","../src/utils.ts","../src/Commands/CreateArcstackCommand.ts","../src/run.ts"],"sourcesContent":["export const altLogo = String.raw`%c\n _ __ _ _ \n /_\\ _ __ ___/ _\\ |_ __ _ ___| | __\n //_\\\\| '__/ __\\ \\| __/ _\\ |/ __| |/ /\n/ _ \\ | | (___\\ \\ || (_| | (__| < \n\\_/ \\_/_| \\___\\__/\\__\\__,_|\\___|_|\\_\\\n \n`;\n","/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are\n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates: {\n name: string;\n alias: \"express\" | \"h3\";\n hint: string;\n source: string;\n prereleaseSource?: string;\n}[] = [\n {\n name: \"Express Starter Kit\",\n alias: \"express\",\n hint: \"An Express application starter kit\",\n source: \"github:toneflix/arcstack\",\n },\n {\n name: \"H3 Starter Kit\",\n alias: \"h3\",\n hint: \"A H3 application starter kit\",\n source: \"github:toneflix/arcstack\",\n },\n];\n","import { Logger, Resolver, packageJsonScript } from \"@h3ravel/shared\";\nimport { copyFile, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\nimport path, { basename, join, relative } from \"node:path\";\n\nimport { Str } from \"@h3ravel/support\";\nimport { chdir } from \"node:process\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean;\n\n constructor(\n private location?: string,\n private appName?: string,\n private description?: string,\n ) {\n if (!this.location) {\n this.location = join(process.cwd(), \".temp\");\n }\n }\n\n async pm() {\n return (await detectPackageManager()) ?? \"npm\";\n }\n\n async runCmd(npx: boolean = false) {\n if (npx) return \"npx\";\n\n const pm = await this.pm();\n\n return pm === \"npm\" ? \"npm run\" : pm;\n }\n\n async download(template: string, install = false, auth?: string, overwrite = false) {\n if (this.location?.includes(\".temp\") || (overwrite && existsSync(this.location!))) {\n await rm(this.location!, { force: true, recursive: true });\n } else if (existsSync(this.location!)) {\n console.log(\"\\n\");\n Logger.parse(\n [\n [\" ERROR \", \"bgRed\"],\n [this.location!, [\"gray\", \"italic\"]],\n [\"is not empty.\", \"white\"],\n ],\n \" \",\n );\n console.log(\"\");\n process.exit(0);\n }\n\n this.skipInstallation = !install;\n this.removeLockFile();\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: await this.pm(),\n forceClean: false,\n });\n }\n\n async installPackage(name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n });\n }\n\n async complete(installed = false) {\n console.log(\"\");\n\n const installPath = \"./\" + relative(process.cwd(), this.location!);\n\n try {\n chdir(path.join(process.cwd(), installPath));\n } catch {\n /** */\n }\n\n Logger.success(\"Your Arcstack project has been created successfully\");\n Logger.parse(\n [\n [\"cd\", \"cyan\"],\n [installPath, \"yellow\"],\n installPath === process.cwd() ? [\"✔\", \"green\"] : [\"\", \"green\"],\n ],\n \" \",\n );\n\n if (!installed) {\n Logger.parse([[await Resolver.getPakageInstallCommand(), \"cyan\"]]);\n }\n\n Logger.parse(\n [\n [await this.runCmd(), \"cyan\"],\n [\"dev\", \"yellow\"],\n ],\n \" \",\n );\n Logger.parse([\n [\"Open\", \"cyan\"],\n [\"http://localhost:3000\", \"yellow\"],\n ]);\n\n console.log(\"\");\n\n Logger.parse([[\"Have any questions\", \"white\"]]);\n // Logger.parse([\n // [\"Join our Discord server -\", \"white\"],\n // [\"https://discord.gg/hsG2A8PuGb\", \"yellow\"],\n // ]);\n Logger.parse([\n [\"Checkout our other projects -\", \"white\"],\n [\"https://toneflix.net/open-source\", \"yellow\"],\n ]);\n }\n\n async cleanup() {\n const pkgPath = join(this.location!, \"package.json\");\n const pkg = await readFile(pkgPath!, \"utf-8\").then(JSON.parse);\n\n delete pkg.packageManager;\n pkg.name = Str.slugify(this.appName ?? basename(this.location!).replace(\".\", \"\"), \"-\");\n pkg.scripts = packageJsonScript;\n if (this.description) {\n pkg.description = this.description;\n }\n\n await Promise.allSettled([\n writeFile(pkgPath, JSON.stringify(pkg, null, 2)),\n this.removeLockFile(),\n rm(join(this.location!, \"pnpm-workspace.yaml\"), { force: true }),\n rm(join(this.location!, \"README.md\"), { force: true }),\n rm(join(this.location!, \".github\"), { force: true, recursive: true }),\n ]);\n }\n\n async removeLockFile() {\n if (!this.skipInstallation) {\n return;\n }\n\n await Promise.allSettled([\n unlink(join(this.location!, \"package-lock.json\")),\n unlink(join(this.location!, \"yarn.lock\")),\n unlink(join(this.location!, \"pnpm-lock.yaml\")),\n ]);\n }\n\n async getBanner() {\n return await readFile(join(process.cwd(), \"./logo.txt\"), \"utf-8\");\n }\n\n async copyExampleEnv() {\n const envPath = join(this.location!, \".env\");\n const exampleEnvPath = join(this.location!, \".env.example\");\n\n if (existsSync(exampleEnvPath)) {\n await copyFile(exampleEnvPath, envPath);\n }\n }\n}\n","import { readdir, rename } from \"node:fs/promises\";\n\nimport path from \"node:path\";\nimport { rm } from \"node:fs/promises\";\n\n/**\n * Removes all files in dirPath except the one specified by keepFileName\n *\n * @param dirPath\n * @param keepFileName\n */\nexport async function cleanDirectoryExcept(dirPath: string, keepFileName: string) {\n const files = await readdir(dirPath);\n\n for (const file of files) {\n if (file === keepFileName) continue;\n\n const fullPath = path.join(dirPath, file);\n\n await rm(fullPath, { recursive: true, force: true });\n }\n}\n\n/**\n * Moves all files from dirPath to parent directory and removes dirPath\n *\n * @param dirPath\n * @param parent\n */\nexport async function hoistDirectoryContents(parent: string, dirPath: string) {\n const source = path.isAbsolute(dirPath) ? dirPath : path.join(process.cwd(), dirPath);\n\n const targetParent = path.isAbsolute(parent) ? parent : path.join(process.cwd(), parent);\n\n if (!source.startsWith(targetParent)) {\n throw new Error(\"Source must be inside the parent directory\");\n }\n\n const entries = await readdir(source);\n\n for (const entry of entries) {\n const from = path.join(source, entry);\n const to = path.join(targetParent, entry);\n\n await rename(from, to);\n }\n\n await rm(source, { recursive: true });\n}\n","import { Command } from \"@h3ravel/musket\";\nimport { altLogo } from \"src/logo\";\nimport inquirer from \"inquirer\";\nimport { AbortPromptError, ExitPromptError } from \"@inquirer/core\";\nimport { basename, join } from \"node:path\";\nimport { templates } from \"src/templates\";\nimport { Str } from \"@h3ravel/support\";\nimport Actions from \"src/actions\";\nimport ora from \"ora\";\nimport { Logger } from \"@h3ravel/shared\";\nimport { cleanDirectoryExcept, hoistDirectoryContents } from \"src/utils\";\n\nexport class CreateArcstackCommand extends Command {\n protected signature = `create-arcstack\n {location?: The location where this project should be created relative to the current dir.}\n {--n|name?: The name of your project.}\n {--i|install: Install node_modules right away}\n {--t|token?: Kit repo authentication token.}\n {--d|desc?: Project Description.}\n {--k|kit?: Starter template kit.}\n {--p|pre: Download prerelease version if available.}\n {--o|overwrite: Overwrite the installation directory if it is not empty.}\n `;\n protected description = \"Display a personalized greeting.\";\n\n async handle() {\n const options = this.options();\n const pathName = this.argument(\"location\");\n const defaultName = pathName ? Str.of(pathName).afterLast(\"/\") : undefined;\n\n console.log(altLogo, `font-family: monospace`);\n\n let { template } = await inquirer\n .prompt([\n {\n type: \"list\",\n name: \"template\",\n message: \"Choose starter template kit:\",\n choices: <never>templates.map((e) => ({\n name: e.name,\n value: e.alias,\n disabled: !e.source ? \"(Unavailable at this time)\" : false,\n })),\n default: \"full\",\n when: () => !options.kit,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n let { appName, description } = await inquirer\n .prompt([\n {\n type: \"input\",\n name: \"appName\",\n message: \"What is the name of your project:\",\n default: defaultName ?? `arcstack-${template}`,\n when: () => !options.name,\n },\n {\n type: \"input\",\n name: \"description\",\n message: \"Project Description:\",\n default: `Simple ${Str.of(template).ucfirst()}.js project created with Arcstack.`,\n when: () => !options.desc,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n let { location } = await inquirer\n .prompt([\n {\n type: \"input\",\n name: \"location\",\n message: \"Installation location relative to the current dir:\",\n default: Str.slugify(options.name ?? appName ?? basename(process.cwd()), \"-\"),\n when: () => !pathName,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n /**\n * Find selected template kit\n */\n const kit = templates.find((e) => e.alias === template)!;\n\n let { install, token, pre } = await inquirer\n .prompt([\n {\n type: \"confirm\",\n name: \"pre\",\n message: `An alpha version of the ${kit.name.replace(/\\s*kit$/i, \"\").trim()} kit is available. Would you like to use it instead?`,\n default: false,\n when: () => kit.prereleaseSource && !options.pre,\n } as never,\n {\n type: \"input\",\n name: \"token\",\n message: \"Authentication token:\",\n when: () => options.kit && !options.token,\n },\n {\n type: \"confirm\",\n name: \"install\",\n message: \"Would you want to install node_modules right away:\",\n default: true,\n when: () => !options.install,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n pre = options.pre ?? pre;\n token = options.token ?? token;\n appName = options.name ?? appName;\n install = options.install ?? install;\n template = options.kit ?? template;\n location = pathName ?? location;\n description = options.description ?? description;\n\n /**\n * Validate selected kit\n */\n if (kit && !kit.source) {\n this.error(`ERROR: The ${kit.name} kit is not currently available`);\n process.exit(1);\n }\n\n const source: string = pre && kit.prereleaseSource ? kit.prereleaseSource! : kit.source;\n const actions = new Actions(join(process.cwd(), location), appName, description);\n const spinner = ora(`Loading Template...`).start();\n\n const result = await actions.download(source, install, token, options.overwrite);\n\n if (result.dir && kit.alias) {\n await cleanDirectoryExcept(result.dir, kit.alias);\n await hoistDirectoryContents(result.dir, join(result.dir, kit.alias));\n }\n\n spinner.info(Logger.parse([[\"Cleaning Up...\", \"green\"]], \"\", false)).start();\n await actions.cleanup();\n\n spinner.info(Logger.parse([[\"Initializing Project...\", \"green\"]], \"\", false)).start();\n await actions.copyExampleEnv();\n\n spinner.succeed(Logger.parse([[\"Project initialization complete!\", \"green\"]], \"\", false));\n\n await actions.complete(install);\n }\n}\n","#!/usr/bin/env node\n\nimport { CreateArcstackCommand } from \"./Commands/CreateArcstackCommand\";\nimport { Kernel } from \"@h3ravel/musket\";\n\nclass Application {}\n\nKernel.init(new Application(), {\n rootCommand: CreateArcstackCommand,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;;;;ACYjC,MAAaA,YAMP,CACJ;CACE,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACT,EACD;CACE,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACT,CACF;;;;ACpBD,4BAAqB;CACnB;CAEA,YACE,AAAQC,UACR,AAAQC,SACR,AAAQC,aACR;EAHQ;EACA;EACA;AAER,MAAI,CAAC,KAAK,SACR,MAAK,+BAAgB,QAAQ,KAAK,EAAE,QAAQ;;CAIhD,MAAM,KAAK;AACT,SAAQ,qDAA4B,IAAK;;CAG3C,MAAM,OAAO,MAAe,OAAO;AACjC,MAAI,IAAK,QAAO;EAEhB,MAAM,KAAK,MAAM,KAAK,IAAI;AAE1B,SAAO,OAAO,QAAQ,YAAY;;CAGpC,MAAM,SAAS,UAAkB,UAAU,OAAO,MAAe,YAAY,OAAO;AAClF,MAAI,KAAK,UAAU,SAAS,QAAQ,IAAK,qCAAwB,KAAK,SAAU,CAC9E,gCAAS,KAAK,UAAW;GAAE,OAAO;GAAM,WAAW;GAAM,CAAC;mCACtC,KAAK,SAAU,EAAE;AACrC,WAAQ,IAAI,KAAK;AACjB,2BAAO,MACL;IACE,CAAC,WAAW,QAAQ;IACpB,CAAC,KAAK,UAAW,CAAC,QAAQ,SAAS,CAAC;IACpC,CAAC,iBAAiB,QAAQ;IAC3B,EACD,IACD;AACD,WAAQ,IAAI,GAAG;AACf,WAAQ,KAAK,EAAE;;AAGjB,OAAK,mBAAmB,CAAC;AACzB,OAAK,gBAAgB;AAErB,SAAO,kCAAuB,UAAU;GACtC,KAAK,KAAK;GACV;GACA;GACA,UAAU,MAAM,KAAK,IAA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SAAiB,OAAO,IAAI,mBAAmB,IAAI,mBAAoB,IAAI;EACjF,MAAM,UAAU,IAAIC,oCAAa,QAAQ,KAAK,EAAE,SAAS,EAAE,SAAS,YAAY;EAChF,MAAM,2BAAc,sBAAsB,CAAC,OAAO;EAElD,MAAM,SAAS,MAAM,QAAQ,SAAS,QAAQ,SAAS,OAAO,QAAQ,UAAU;AAEhF,MAAI,OAAO,OAAO,IAAI,OAAO;AAC3B,SAAM,qBAAqB,OAAO,KAAK,IAAI,MAAM;AACjD,SAAM,uBAAuB,OAAO,yBAAU,OAAO,KAAK,IAAI,MAAM,CAAC;;AAGvE,UAAQ,KAAKC,wBAAO,MAAM,CAAC,CAAC,kBAAkB,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AAC5E,QAAM,QAAQ,SAAS;AAEvB,UAAQ,KAAKA,wBAAO,MAAM,CAAC,CAAC,2BAA2B,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AACrF,QAAM,QAAQ,gBAAgB;AAE9B,UAAQ,QAAQA,wBAAO,MAAM,CAAC,CAAC,oCAAoC,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC;AAEzF,QAAM,QAAQ,SAAS,QAAQ;;;;;;ACpKnC,IAAM,cAAN,MAAkB;AAElBC,wBAAO,KAAK,IAAI,aAAa,EAAE,EAC7B,aAAa,uBACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"run.cjs","names":["templates: {\n name: string;\n alias: \"express\" | \"h3\";\n hint: string;\n source: string;\n prereleaseSource?: string;\n}[]","location?: string","appName?: string","description?: string","path","Resolver","Str","packageJsonScript","path","Command","AbortPromptError","ExitPromptError","Str","source: string","Actions","Logger","Kernel"],"sources":["../src/logo.ts","../src/templates.ts","../src/actions.ts","../src/utils.ts","../src/Commands/CreateArcstackCommand.ts","../src/run.ts"],"sourcesContent":["export const altLogo = String.raw`%c\n _ __ _ _ \n /_\\ _ __ ___/ _\\ |_ __ _ ___| | __\n //_\\\\| '__/ __\\ \\| __/ _\\ |/ __| |/ /\n/ _ \\ | | (___\\ \\ || (_| | (__| < \n\\_/ \\_/_| \\___\\__/\\__\\__,_|\\___|_|\\_\\\n \n`;\n","/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are\n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates: {\n name: string;\n alias: \"express\" | \"h3\";\n hint: string;\n source: string;\n prereleaseSource?: string;\n}[] = [\n {\n name: \"Express Starter Kit\",\n alias: \"express\",\n hint: \"An Express application starter kit\",\n source: \"github:toneflix/arcstack\",\n },\n {\n name: \"H3 Starter Kit\",\n alias: \"h3\",\n hint: \"A H3 application starter kit\",\n source: \"github:toneflix/arcstack\",\n },\n];\n","import { Logger, Resolver, packageJsonScript } from \"@h3ravel/shared\";\nimport { copyFile, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\nimport path, { basename, join, relative } from \"node:path\";\n\nimport { Str } from \"@h3ravel/support\";\nimport { chdir } from \"node:process\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean;\n\n constructor(\n private location?: string,\n private appName?: string,\n private description?: string,\n ) {\n if (!this.location) {\n this.location = join(process.cwd(), \".temp\");\n }\n }\n\n async pm() {\n return (await detectPackageManager()) ?? \"npm\";\n }\n\n async runCmd(npx: boolean = false) {\n if (npx) return \"npx\";\n\n const pm = await this.pm();\n\n return pm === \"npm\" ? \"npm run\" : pm;\n }\n\n async download(template: string, install = false, auth?: string, overwrite = false) {\n if (this.location?.includes(\".temp\") || (overwrite && existsSync(this.location!))) {\n await rm(this.location!, { force: true, recursive: true });\n } else if (existsSync(this.location!)) {\n console.log(\"\\n\");\n Logger.parse(\n [\n [\" ERROR \", \"bgRed\"],\n [this.location!, [\"gray\", \"italic\"]],\n [\"is not empty.\", \"white\"],\n ],\n \" \",\n );\n console.log(\"\");\n process.exit(0);\n }\n\n this.skipInstallation = !install;\n this.removeLockFile();\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: await this.pm(),\n forceClean: false,\n });\n }\n\n async installPackage(name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n });\n }\n\n async complete(installed = false) {\n console.log(\"\");\n\n const installPath = \"./\" + relative(process.cwd(), this.location!);\n\n try {\n chdir(path.join(process.cwd(), installPath));\n } catch {\n /** */\n }\n\n Logger.success(\"Your Arcstack project has been created successfully\");\n Logger.parse(\n [\n [\"cd\", \"cyan\"],\n [installPath, \"yellow\"],\n installPath === process.cwd() ? [\"✔\", \"green\"] : [\"\", \"green\"],\n ],\n \" \",\n );\n\n if (!installed) {\n Logger.parse([[await Resolver.getPakageInstallCommand(), \"cyan\"]]);\n }\n\n Logger.parse(\n [\n [await this.runCmd(), \"cyan\"],\n [\"dev\", \"yellow\"],\n ],\n \" \",\n );\n Logger.parse([\n [\"Open\", \"cyan\"],\n [\"http://localhost:3000\", \"yellow\"],\n ]);\n\n console.log(\"\");\n\n Logger.parse([[\"Have any questions\", \"white\"]]);\n // Logger.parse([\n // [\"Join our Discord server -\", \"white\"],\n // [\"https://discord.gg/hsG2A8PuGb\", \"yellow\"],\n // ]);\n Logger.parse([\n [\"Checkout our other projects -\", \"white\"],\n [\"https://toneflix.net/open-source\", \"yellow\"],\n ]);\n }\n\n async cleanup() {\n const pkgPath = join(this.location!, \"package.json\");\n const pkg = await readFile(pkgPath!, \"utf-8\").then(JSON.parse);\n\n delete pkg.packageManager;\n pkg.name = Str.slugify(this.appName ?? basename(this.location!).replace(\".\", \"\"), \"-\");\n pkg.scripts = packageJsonScript;\n if (this.description) {\n pkg.description = this.description;\n }\n\n await Promise.allSettled([\n writeFile(pkgPath, JSON.stringify(pkg, null, 2)),\n this.removeLockFile(),\n rm(join(this.location!, \"pnpm-workspace.yaml\"), { force: true }),\n rm(join(this.location!, \"README.md\"), { force: true }),\n rm(join(this.location!, \".github\"), { force: true, recursive: true }),\n ]);\n }\n\n async removeLockFile() {\n if (!this.skipInstallation) {\n return;\n }\n\n await Promise.allSettled([\n unlink(join(this.location!, \"package-lock.json\")),\n unlink(join(this.location!, \"yarn.lock\")),\n unlink(join(this.location!, \"pnpm-lock.yaml\")),\n ]);\n }\n\n async getBanner() {\n return await readFile(join(process.cwd(), \"./logo.txt\"), \"utf-8\");\n }\n\n async copyExampleEnv() {\n const envPath = join(this.location!, \".env\");\n const exampleEnvPath = join(this.location!, \".env.example\");\n\n if (existsSync(exampleEnvPath)) {\n await copyFile(exampleEnvPath, envPath);\n }\n }\n}\n","import { readdir, rename } from \"node:fs/promises\";\n\nimport path from \"node:path\";\nimport { rm } from \"node:fs/promises\";\n\n/**\n * Removes all files in dirPath except the one specified by keepFileName\n *\n * @param dirPath\n * @param keepFileName\n */\nexport async function cleanDirectoryExcept(dirPath: string, keepFileName: string) {\n const files = await readdir(dirPath);\n\n for (const file of files) {\n if (file === keepFileName) continue;\n\n const fullPath = path.join(dirPath, file);\n\n await rm(fullPath, { recursive: true, force: true });\n }\n}\n\n/**\n * Moves all files from dirPath to parent directory and removes dirPath\n *\n * @param dirPath\n * @param parent\n */\nexport async function hoistDirectoryContents(parent: string, dirPath: string) {\n const source = path.isAbsolute(dirPath) ? dirPath : path.join(process.cwd(), dirPath);\n\n const targetParent = path.isAbsolute(parent) ? parent : path.join(process.cwd(), parent);\n\n if (!source.startsWith(targetParent)) {\n throw new Error(\"Source must be inside the parent directory\");\n }\n\n const entries = await readdir(source);\n\n for (const entry of entries) {\n const from = path.join(source, entry);\n const to = path.join(targetParent, entry);\n\n await rename(from, to);\n }\n\n await rm(source, { recursive: true });\n}\n","import { Command } from \"@h3ravel/musket\";\nimport { altLogo } from \"src/logo\";\nimport inquirer from \"inquirer\";\nimport { AbortPromptError, ExitPromptError } from \"@inquirer/core\";\nimport { basename, join } from \"node:path\";\nimport { templates } from \"src/templates\";\nimport { Str } from \"@h3ravel/support\";\nimport Actions from \"src/actions\";\nimport ora from \"ora\";\nimport { Logger } from \"@h3ravel/shared\";\nimport { cleanDirectoryExcept, hoistDirectoryContents } from \"src/utils\";\n\nexport class CreateArcstackCommand extends Command {\n protected signature = `create-arcstack\n {location?: The location where this project should be created relative to the current dir.}\n {--n|name?: The name of your project.}\n {--i|install: Install node_modules right away}\n {--t|token?: Kit repo authentication token.}\n {--d|desc?: Project Description.}\n {--k|kit?: Starter template kit.}\n {--p|pre: Download prerelease version if available.}\n {--o|overwrite: Overwrite the installation directory if it is not empty.}\n `;\n protected description = \"Display a personalized greeting.\";\n\n async handle() {\n const options = this.options();\n const pathName = this.argument(\"location\");\n // const defaultName = pathName ? Str.of(pathName).afterLast(\"/\") : undefined;\n\n console.log(altLogo, `font-family: monospace`);\n\n let { template } = await inquirer\n .prompt([\n {\n type: \"list\",\n name: \"template\",\n message: \"Choose starter template kit:\",\n choices: <never>templates.map((e) => ({\n name: e.name,\n value: e.alias,\n disabled: !e.source ? \"(Unavailable at this time)\" : false,\n })),\n default: \"full\",\n when: () => !options.kit,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n let { appName, description } = await inquirer\n .prompt([\n {\n type: \"input\",\n name: \"appName\",\n message: \"What is the name of your project:\",\n default: `arcstack-${template}`,\n // default: defaultName ?? `arcstack-${template}`,\n when: () => !options.name,\n },\n {\n type: \"input\",\n name: \"description\",\n message: \"Project Description:\",\n default: `Simple ${Str.of(template).ucfirst()}.js project created with Arcstack.`,\n when: () => !options.desc,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n let { location } = await inquirer\n .prompt([\n {\n type: \"input\",\n name: \"location\",\n message: \"Installation location relative to the current dir:\",\n default: Str.slugify(options.name ?? appName ?? basename(process.cwd()), \"-\"),\n when: () => !pathName,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n /**\n * Find selected template kit\n */\n const kit = templates.find((e) => e.alias === template)!;\n\n let { install, token, pre } = await inquirer\n .prompt([\n {\n type: \"confirm\",\n name: \"pre\",\n message: `An alpha version of the ${kit.name.replace(/\\s*kit$/i, \"\").trim()} kit is available. Would you like to use it instead?`,\n default: false,\n when: () => kit.prereleaseSource && !options.pre,\n } as never,\n {\n type: \"input\",\n name: \"token\",\n message: \"Authentication token:\",\n when: () => options.kit && !options.token,\n },\n {\n type: \"confirm\",\n name: \"install\",\n message: \"Would you want to install node_modules right away:\",\n default: true,\n when: () => !options.install,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n pre = options.pre ?? pre;\n token = options.token ?? token;\n appName = options.name ?? appName;\n install = options.install ?? install;\n template = options.kit ?? template;\n location = pathName ?? location;\n description = options.description ?? description;\n\n /**\n * Validate selected kit\n */\n if (kit && !kit.source) {\n this.error(`ERROR: The ${kit.name} kit is not currently available`);\n process.exit(1);\n }\n\n const source: string = pre && kit.prereleaseSource ? kit.prereleaseSource! : kit.source;\n const actions = new Actions(join(process.cwd(), location), appName, description);\n const spinner = ora(`Loading Template...`).start();\n\n const result = await actions.download(source, install, token, options.overwrite);\n\n if (result.dir && kit.alias) {\n await cleanDirectoryExcept(result.dir, kit.alias);\n await hoistDirectoryContents(result.dir, join(result.dir, kit.alias));\n }\n\n spinner.info(Logger.parse([[\"Cleaning Up...\", \"green\"]], \"\", false)).start();\n await actions.cleanup();\n\n spinner.info(Logger.parse([[\"Initializing Project...\", \"green\"]], \"\", false)).start();\n await actions.copyExampleEnv();\n\n spinner.succeed(Logger.parse([[\"Project initialization complete!\", \"green\"]], \"\", false));\n\n await actions.complete(install);\n }\n}\n","#!/usr/bin/env node\n\nimport { CreateArcstackCommand } from \"./Commands/CreateArcstackCommand\";\nimport { Kernel } from \"@h3ravel/musket\";\n\nclass Application {}\n\nKernel.init(new Application(), {\n rootCommand: CreateArcstackCommand,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;;;;ACYjC,MAAaA,YAMP,CACJ;CACE,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACT,EACD;CACE,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACT,CACF;;;;ACpBD,4BAAqB;CACnB;CAEA,YACE,AAAQC,UACR,AAAQC,SACR,AAAQC,aACR;EAHQ;EACA;EACA;AAER,MAAI,CAAC,KAAK,SACR,MAAK,+BAAgB,QAAQ,KAAK,EAAE,QAAQ;;CAIhD,MAAM,KAAK;AACT,SAAQ,qDAA4B,IAAK;;CAG3C,MAAM,OAAO,MAAe,OAAO;AACjC,MAAI,IAAK,QAAO;EAEhB,MAAM,KAAK,MAAM,KAAK,IAAI;AAE1B,SAAO,OAAO,QAAQ,YAAY;;CAGpC,MAAM,SAAS,UAAkB,UAAU,OAAO,MAAe,YAAY,OAAO;AAClF,MAAI,KAAK,UAAU,SAAS,QAAQ,IAAK,qCAAwB,KAAK,SAAU,CAC9E,gCAAS,KAAK,UAAW;GAAE,OAAO;GAAM,WAAW;GAAM,CAAC;mCACtC,KAAK,SAAU,EAAE;AACrC,WAAQ,IAAI,KAAK;AACjB,2BAAO,MACL;IACE,CAAC,WAAW,QAAQ;IACpB,CAAC,KAAK,UAAW,CAAC,QAAQ,SAAS,CAAC;IACpC,CAAC,iBAAiB,QAAQ;IAC3B,EACD,IACD;AACD,WAAQ,IAAI,GAAG;AACf,WAAQ,KAAK,EAAE;;AAGjB,OAAK,mBAAm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AAQ,KAAK,EAAE;;EAGjB,MAAME,SAAiB,OAAO,IAAI,mBAAmB,IAAI,mBAAoB,IAAI;EACjF,MAAM,UAAU,IAAIC,oCAAa,QAAQ,KAAK,EAAE,SAAS,EAAE,SAAS,YAAY;EAChF,MAAM,2BAAc,sBAAsB,CAAC,OAAO;EAElD,MAAM,SAAS,MAAM,QAAQ,SAAS,QAAQ,SAAS,OAAO,QAAQ,UAAU;AAEhF,MAAI,OAAO,OAAO,IAAI,OAAO;AAC3B,SAAM,qBAAqB,OAAO,KAAK,IAAI,MAAM;AACjD,SAAM,uBAAuB,OAAO,yBAAU,OAAO,KAAK,IAAI,MAAM,CAAC;;AAGvE,UAAQ,KAAKC,wBAAO,MAAM,CAAC,CAAC,kBAAkB,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AAC5E,QAAM,QAAQ,SAAS;AAEvB,UAAQ,KAAKA,wBAAO,MAAM,CAAC,CAAC,2BAA2B,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AACrF,QAAM,QAAQ,gBAAgB;AAE9B,UAAQ,QAAQA,wBAAO,MAAM,CAAC,CAAC,oCAAoC,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC;AAEzF,QAAM,QAAQ,SAAS,QAAQ;;;;;;ACrKnC,IAAM,cAAN,MAAkB;AAElBC,wBAAO,KAAK,IAAI,aAAa,EAAE,EAC7B,aAAa,uBACd,CAAC"}
|
package/bin/run.js
CHANGED
|
@@ -193,7 +193,6 @@ var CreateArcstackCommand = class extends Command {
|
|
|
193
193
|
async handle() {
|
|
194
194
|
const options = this.options();
|
|
195
195
|
const pathName = this.argument("location");
|
|
196
|
-
const defaultName = pathName ? Str.of(pathName).afterLast("/") : void 0;
|
|
197
196
|
console.log(altLogo, `font-family: monospace`);
|
|
198
197
|
let { template } = await inquirer.prompt([{
|
|
199
198
|
type: "list",
|
|
@@ -217,7 +216,7 @@ var CreateArcstackCommand = class extends Command {
|
|
|
217
216
|
type: "input",
|
|
218
217
|
name: "appName",
|
|
219
218
|
message: "What is the name of your project:",
|
|
220
|
-
default:
|
|
219
|
+
default: `arcstack-${template}`,
|
|
221
220
|
when: () => !options.name
|
|
222
221
|
}, {
|
|
223
222
|
type: "input",
|
package/bin/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","names":["templates: {\n name: string;\n alias: \"express\" | \"h3\";\n hint: string;\n source: string;\n prereleaseSource?: string;\n}[]","location?: string","appName?: string","description?: string","source: string","Actions"],"sources":["../src/logo.ts","../src/templates.ts","../src/actions.ts","../src/utils.ts","../src/Commands/CreateArcstackCommand.ts","../src/run.ts"],"sourcesContent":["export const altLogo = String.raw`%c\n _ __ _ _ \n /_\\ _ __ ___/ _\\ |_ __ _ ___| | __\n //_\\\\| '__/ __\\ \\| __/ _\\ |/ __| |/ /\n/ _ \\ | | (___\\ \\ || (_| | (__| < \n\\_/ \\_/_| \\___\\__/\\__\\__,_|\\___|_|\\_\\\n \n`;\n","/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are\n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates: {\n name: string;\n alias: \"express\" | \"h3\";\n hint: string;\n source: string;\n prereleaseSource?: string;\n}[] = [\n {\n name: \"Express Starter Kit\",\n alias: \"express\",\n hint: \"An Express application starter kit\",\n source: \"github:toneflix/arcstack\",\n },\n {\n name: \"H3 Starter Kit\",\n alias: \"h3\",\n hint: \"A H3 application starter kit\",\n source: \"github:toneflix/arcstack\",\n },\n];\n","import { Logger, Resolver, packageJsonScript } from \"@h3ravel/shared\";\nimport { copyFile, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\nimport path, { basename, join, relative } from \"node:path\";\n\nimport { Str } from \"@h3ravel/support\";\nimport { chdir } from \"node:process\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean;\n\n constructor(\n private location?: string,\n private appName?: string,\n private description?: string,\n ) {\n if (!this.location) {\n this.location = join(process.cwd(), \".temp\");\n }\n }\n\n async pm() {\n return (await detectPackageManager()) ?? \"npm\";\n }\n\n async runCmd(npx: boolean = false) {\n if (npx) return \"npx\";\n\n const pm = await this.pm();\n\n return pm === \"npm\" ? \"npm run\" : pm;\n }\n\n async download(template: string, install = false, auth?: string, overwrite = false) {\n if (this.location?.includes(\".temp\") || (overwrite && existsSync(this.location!))) {\n await rm(this.location!, { force: true, recursive: true });\n } else if (existsSync(this.location!)) {\n console.log(\"\\n\");\n Logger.parse(\n [\n [\" ERROR \", \"bgRed\"],\n [this.location!, [\"gray\", \"italic\"]],\n [\"is not empty.\", \"white\"],\n ],\n \" \",\n );\n console.log(\"\");\n process.exit(0);\n }\n\n this.skipInstallation = !install;\n this.removeLockFile();\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: await this.pm(),\n forceClean: false,\n });\n }\n\n async installPackage(name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n });\n }\n\n async complete(installed = false) {\n console.log(\"\");\n\n const installPath = \"./\" + relative(process.cwd(), this.location!);\n\n try {\n chdir(path.join(process.cwd(), installPath));\n } catch {\n /** */\n }\n\n Logger.success(\"Your Arcstack project has been created successfully\");\n Logger.parse(\n [\n [\"cd\", \"cyan\"],\n [installPath, \"yellow\"],\n installPath === process.cwd() ? [\"✔\", \"green\"] : [\"\", \"green\"],\n ],\n \" \",\n );\n\n if (!installed) {\n Logger.parse([[await Resolver.getPakageInstallCommand(), \"cyan\"]]);\n }\n\n Logger.parse(\n [\n [await this.runCmd(), \"cyan\"],\n [\"dev\", \"yellow\"],\n ],\n \" \",\n );\n Logger.parse([\n [\"Open\", \"cyan\"],\n [\"http://localhost:3000\", \"yellow\"],\n ]);\n\n console.log(\"\");\n\n Logger.parse([[\"Have any questions\", \"white\"]]);\n // Logger.parse([\n // [\"Join our Discord server -\", \"white\"],\n // [\"https://discord.gg/hsG2A8PuGb\", \"yellow\"],\n // ]);\n Logger.parse([\n [\"Checkout our other projects -\", \"white\"],\n [\"https://toneflix.net/open-source\", \"yellow\"],\n ]);\n }\n\n async cleanup() {\n const pkgPath = join(this.location!, \"package.json\");\n const pkg = await readFile(pkgPath!, \"utf-8\").then(JSON.parse);\n\n delete pkg.packageManager;\n pkg.name = Str.slugify(this.appName ?? basename(this.location!).replace(\".\", \"\"), \"-\");\n pkg.scripts = packageJsonScript;\n if (this.description) {\n pkg.description = this.description;\n }\n\n await Promise.allSettled([\n writeFile(pkgPath, JSON.stringify(pkg, null, 2)),\n this.removeLockFile(),\n rm(join(this.location!, \"pnpm-workspace.yaml\"), { force: true }),\n rm(join(this.location!, \"README.md\"), { force: true }),\n rm(join(this.location!, \".github\"), { force: true, recursive: true }),\n ]);\n }\n\n async removeLockFile() {\n if (!this.skipInstallation) {\n return;\n }\n\n await Promise.allSettled([\n unlink(join(this.location!, \"package-lock.json\")),\n unlink(join(this.location!, \"yarn.lock\")),\n unlink(join(this.location!, \"pnpm-lock.yaml\")),\n ]);\n }\n\n async getBanner() {\n return await readFile(join(process.cwd(), \"./logo.txt\"), \"utf-8\");\n }\n\n async copyExampleEnv() {\n const envPath = join(this.location!, \".env\");\n const exampleEnvPath = join(this.location!, \".env.example\");\n\n if (existsSync(exampleEnvPath)) {\n await copyFile(exampleEnvPath, envPath);\n }\n }\n}\n","import { readdir, rename } from \"node:fs/promises\";\n\nimport path from \"node:path\";\nimport { rm } from \"node:fs/promises\";\n\n/**\n * Removes all files in dirPath except the one specified by keepFileName\n *\n * @param dirPath\n * @param keepFileName\n */\nexport async function cleanDirectoryExcept(dirPath: string, keepFileName: string) {\n const files = await readdir(dirPath);\n\n for (const file of files) {\n if (file === keepFileName) continue;\n\n const fullPath = path.join(dirPath, file);\n\n await rm(fullPath, { recursive: true, force: true });\n }\n}\n\n/**\n * Moves all files from dirPath to parent directory and removes dirPath\n *\n * @param dirPath\n * @param parent\n */\nexport async function hoistDirectoryContents(parent: string, dirPath: string) {\n const source = path.isAbsolute(dirPath) ? dirPath : path.join(process.cwd(), dirPath);\n\n const targetParent = path.isAbsolute(parent) ? parent : path.join(process.cwd(), parent);\n\n if (!source.startsWith(targetParent)) {\n throw new Error(\"Source must be inside the parent directory\");\n }\n\n const entries = await readdir(source);\n\n for (const entry of entries) {\n const from = path.join(source, entry);\n const to = path.join(targetParent, entry);\n\n await rename(from, to);\n }\n\n await rm(source, { recursive: true });\n}\n","import { Command } from \"@h3ravel/musket\";\nimport { altLogo } from \"src/logo\";\nimport inquirer from \"inquirer\";\nimport { AbortPromptError, ExitPromptError } from \"@inquirer/core\";\nimport { basename, join } from \"node:path\";\nimport { templates } from \"src/templates\";\nimport { Str } from \"@h3ravel/support\";\nimport Actions from \"src/actions\";\nimport ora from \"ora\";\nimport { Logger } from \"@h3ravel/shared\";\nimport { cleanDirectoryExcept, hoistDirectoryContents } from \"src/utils\";\n\nexport class CreateArcstackCommand extends Command {\n protected signature = `create-arcstack\n {location?: The location where this project should be created relative to the current dir.}\n {--n|name?: The name of your project.}\n {--i|install: Install node_modules right away}\n {--t|token?: Kit repo authentication token.}\n {--d|desc?: Project Description.}\n {--k|kit?: Starter template kit.}\n {--p|pre: Download prerelease version if available.}\n {--o|overwrite: Overwrite the installation directory if it is not empty.}\n `;\n protected description = \"Display a personalized greeting.\";\n\n async handle() {\n const options = this.options();\n const pathName = this.argument(\"location\");\n const defaultName = pathName ? Str.of(pathName).afterLast(\"/\") : undefined;\n\n console.log(altLogo, `font-family: monospace`);\n\n let { template } = await inquirer\n .prompt([\n {\n type: \"list\",\n name: \"template\",\n message: \"Choose starter template kit:\",\n choices: <never>templates.map((e) => ({\n name: e.name,\n value: e.alias,\n disabled: !e.source ? \"(Unavailable at this time)\" : false,\n })),\n default: \"full\",\n when: () => !options.kit,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n let { appName, description } = await inquirer\n .prompt([\n {\n type: \"input\",\n name: \"appName\",\n message: \"What is the name of your project:\",\n default: defaultName ?? `arcstack-${template}`,\n when: () => !options.name,\n },\n {\n type: \"input\",\n name: \"description\",\n message: \"Project Description:\",\n default: `Simple ${Str.of(template).ucfirst()}.js project created with Arcstack.`,\n when: () => !options.desc,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n let { location } = await inquirer\n .prompt([\n {\n type: \"input\",\n name: \"location\",\n message: \"Installation location relative to the current dir:\",\n default: Str.slugify(options.name ?? appName ?? basename(process.cwd()), \"-\"),\n when: () => !pathName,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n /**\n * Find selected template kit\n */\n const kit = templates.find((e) => e.alias === template)!;\n\n let { install, token, pre } = await inquirer\n .prompt([\n {\n type: \"confirm\",\n name: \"pre\",\n message: `An alpha version of the ${kit.name.replace(/\\s*kit$/i, \"\").trim()} kit is available. Would you like to use it instead?`,\n default: false,\n when: () => kit.prereleaseSource && !options.pre,\n } as never,\n {\n type: \"input\",\n name: \"token\",\n message: \"Authentication token:\",\n when: () => options.kit && !options.token,\n },\n {\n type: \"confirm\",\n name: \"install\",\n message: \"Would you want to install node_modules right away:\",\n default: true,\n when: () => !options.install,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n pre = options.pre ?? pre;\n token = options.token ?? token;\n appName = options.name ?? appName;\n install = options.install ?? install;\n template = options.kit ?? template;\n location = pathName ?? location;\n description = options.description ?? description;\n\n /**\n * Validate selected kit\n */\n if (kit && !kit.source) {\n this.error(`ERROR: The ${kit.name} kit is not currently available`);\n process.exit(1);\n }\n\n const source: string = pre && kit.prereleaseSource ? kit.prereleaseSource! : kit.source;\n const actions = new Actions(join(process.cwd(), location), appName, description);\n const spinner = ora(`Loading Template...`).start();\n\n const result = await actions.download(source, install, token, options.overwrite);\n\n if (result.dir && kit.alias) {\n await cleanDirectoryExcept(result.dir, kit.alias);\n await hoistDirectoryContents(result.dir, join(result.dir, kit.alias));\n }\n\n spinner.info(Logger.parse([[\"Cleaning Up...\", \"green\"]], \"\", false)).start();\n await actions.cleanup();\n\n spinner.info(Logger.parse([[\"Initializing Project...\", \"green\"]], \"\", false)).start();\n await actions.copyExampleEnv();\n\n spinner.succeed(Logger.parse([[\"Project initialization complete!\", \"green\"]], \"\", false));\n\n await actions.complete(install);\n }\n}\n","#!/usr/bin/env node\n\nimport { CreateArcstackCommand } from \"./Commands/CreateArcstackCommand\";\nimport { Kernel } from \"@h3ravel/musket\";\n\nclass Application {}\n\nKernel.init(new Application(), {\n rootCommand: CreateArcstackCommand,\n});\n"],"mappings":";;;;;;;;;;;;;;;AAAA,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;;;;ACYjC,MAAaA,YAMP,CACJ;CACE,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACT,EACD;CACE,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACT,CACF;;;;ACpBD,4BAAqB;CACnB;CAEA,YACE,AAAQC,UACR,AAAQC,SACR,AAAQC,aACR;EAHQ;EACA;EACA;AAER,MAAI,CAAC,KAAK,SACR,MAAK,WAAW,KAAK,QAAQ,KAAK,EAAE,QAAQ;;CAIhD,MAAM,KAAK;AACT,SAAQ,MAAM,sBAAsB,IAAK;;CAG3C,MAAM,OAAO,MAAe,OAAO;AACjC,MAAI,IAAK,QAAO;EAEhB,MAAM,KAAK,MAAM,KAAK,IAAI;AAE1B,SAAO,OAAO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AM,CAAC,CAAC,2BAA2B,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AACrF,QAAM,QAAQ,gBAAgB;AAE9B,UAAQ,QAAQ,OAAO,MAAM,CAAC,CAAC,oCAAoC,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC;AAEzF,QAAM,QAAQ,SAAS,QAAQ;;;;;;ACpKnC,IAAM,cAAN,MAAkB;AAElB,OAAO,KAAK,IAAI,aAAa,EAAE,EAC7B,aAAa,uBACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"run.js","names":["templates: {\n name: string;\n alias: \"express\" | \"h3\";\n hint: string;\n source: string;\n prereleaseSource?: string;\n}[]","location?: string","appName?: string","description?: string","source: string","Actions"],"sources":["../src/logo.ts","../src/templates.ts","../src/actions.ts","../src/utils.ts","../src/Commands/CreateArcstackCommand.ts","../src/run.ts"],"sourcesContent":["export const altLogo = String.raw`%c\n _ __ _ _ \n /_\\ _ __ ___/ _\\ |_ __ _ ___| | __\n //_\\\\| '__/ __\\ \\| __/ _\\ |/ __| |/ /\n/ _ \\ | | (___\\ \\ || (_| | (__| < \n\\_/ \\_/_| \\___\\__/\\__\\__,_|\\___|_|\\_\\\n \n`;\n","/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are\n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates: {\n name: string;\n alias: \"express\" | \"h3\";\n hint: string;\n source: string;\n prereleaseSource?: string;\n}[] = [\n {\n name: \"Express Starter Kit\",\n alias: \"express\",\n hint: \"An Express application starter kit\",\n source: \"github:toneflix/arcstack\",\n },\n {\n name: \"H3 Starter Kit\",\n alias: \"h3\",\n hint: \"A H3 application starter kit\",\n source: \"github:toneflix/arcstack\",\n },\n];\n","import { Logger, Resolver, packageJsonScript } from \"@h3ravel/shared\";\nimport { copyFile, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\nimport path, { basename, join, relative } from \"node:path\";\n\nimport { Str } from \"@h3ravel/support\";\nimport { chdir } from \"node:process\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean;\n\n constructor(\n private location?: string,\n private appName?: string,\n private description?: string,\n ) {\n if (!this.location) {\n this.location = join(process.cwd(), \".temp\");\n }\n }\n\n async pm() {\n return (await detectPackageManager()) ?? \"npm\";\n }\n\n async runCmd(npx: boolean = false) {\n if (npx) return \"npx\";\n\n const pm = await this.pm();\n\n return pm === \"npm\" ? \"npm run\" : pm;\n }\n\n async download(template: string, install = false, auth?: string, overwrite = false) {\n if (this.location?.includes(\".temp\") || (overwrite && existsSync(this.location!))) {\n await rm(this.location!, { force: true, recursive: true });\n } else if (existsSync(this.location!)) {\n console.log(\"\\n\");\n Logger.parse(\n [\n [\" ERROR \", \"bgRed\"],\n [this.location!, [\"gray\", \"italic\"]],\n [\"is not empty.\", \"white\"],\n ],\n \" \",\n );\n console.log(\"\");\n process.exit(0);\n }\n\n this.skipInstallation = !install;\n this.removeLockFile();\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: await this.pm(),\n forceClean: false,\n });\n }\n\n async installPackage(name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n });\n }\n\n async complete(installed = false) {\n console.log(\"\");\n\n const installPath = \"./\" + relative(process.cwd(), this.location!);\n\n try {\n chdir(path.join(process.cwd(), installPath));\n } catch {\n /** */\n }\n\n Logger.success(\"Your Arcstack project has been created successfully\");\n Logger.parse(\n [\n [\"cd\", \"cyan\"],\n [installPath, \"yellow\"],\n installPath === process.cwd() ? [\"✔\", \"green\"] : [\"\", \"green\"],\n ],\n \" \",\n );\n\n if (!installed) {\n Logger.parse([[await Resolver.getPakageInstallCommand(), \"cyan\"]]);\n }\n\n Logger.parse(\n [\n [await this.runCmd(), \"cyan\"],\n [\"dev\", \"yellow\"],\n ],\n \" \",\n );\n Logger.parse([\n [\"Open\", \"cyan\"],\n [\"http://localhost:3000\", \"yellow\"],\n ]);\n\n console.log(\"\");\n\n Logger.parse([[\"Have any questions\", \"white\"]]);\n // Logger.parse([\n // [\"Join our Discord server -\", \"white\"],\n // [\"https://discord.gg/hsG2A8PuGb\", \"yellow\"],\n // ]);\n Logger.parse([\n [\"Checkout our other projects -\", \"white\"],\n [\"https://toneflix.net/open-source\", \"yellow\"],\n ]);\n }\n\n async cleanup() {\n const pkgPath = join(this.location!, \"package.json\");\n const pkg = await readFile(pkgPath!, \"utf-8\").then(JSON.parse);\n\n delete pkg.packageManager;\n pkg.name = Str.slugify(this.appName ?? basename(this.location!).replace(\".\", \"\"), \"-\");\n pkg.scripts = packageJsonScript;\n if (this.description) {\n pkg.description = this.description;\n }\n\n await Promise.allSettled([\n writeFile(pkgPath, JSON.stringify(pkg, null, 2)),\n this.removeLockFile(),\n rm(join(this.location!, \"pnpm-workspace.yaml\"), { force: true }),\n rm(join(this.location!, \"README.md\"), { force: true }),\n rm(join(this.location!, \".github\"), { force: true, recursive: true }),\n ]);\n }\n\n async removeLockFile() {\n if (!this.skipInstallation) {\n return;\n }\n\n await Promise.allSettled([\n unlink(join(this.location!, \"package-lock.json\")),\n unlink(join(this.location!, \"yarn.lock\")),\n unlink(join(this.location!, \"pnpm-lock.yaml\")),\n ]);\n }\n\n async getBanner() {\n return await readFile(join(process.cwd(), \"./logo.txt\"), \"utf-8\");\n }\n\n async copyExampleEnv() {\n const envPath = join(this.location!, \".env\");\n const exampleEnvPath = join(this.location!, \".env.example\");\n\n if (existsSync(exampleEnvPath)) {\n await copyFile(exampleEnvPath, envPath);\n }\n }\n}\n","import { readdir, rename } from \"node:fs/promises\";\n\nimport path from \"node:path\";\nimport { rm } from \"node:fs/promises\";\n\n/**\n * Removes all files in dirPath except the one specified by keepFileName\n *\n * @param dirPath\n * @param keepFileName\n */\nexport async function cleanDirectoryExcept(dirPath: string, keepFileName: string) {\n const files = await readdir(dirPath);\n\n for (const file of files) {\n if (file === keepFileName) continue;\n\n const fullPath = path.join(dirPath, file);\n\n await rm(fullPath, { recursive: true, force: true });\n }\n}\n\n/**\n * Moves all files from dirPath to parent directory and removes dirPath\n *\n * @param dirPath\n * @param parent\n */\nexport async function hoistDirectoryContents(parent: string, dirPath: string) {\n const source = path.isAbsolute(dirPath) ? dirPath : path.join(process.cwd(), dirPath);\n\n const targetParent = path.isAbsolute(parent) ? parent : path.join(process.cwd(), parent);\n\n if (!source.startsWith(targetParent)) {\n throw new Error(\"Source must be inside the parent directory\");\n }\n\n const entries = await readdir(source);\n\n for (const entry of entries) {\n const from = path.join(source, entry);\n const to = path.join(targetParent, entry);\n\n await rename(from, to);\n }\n\n await rm(source, { recursive: true });\n}\n","import { Command } from \"@h3ravel/musket\";\nimport { altLogo } from \"src/logo\";\nimport inquirer from \"inquirer\";\nimport { AbortPromptError, ExitPromptError } from \"@inquirer/core\";\nimport { basename, join } from \"node:path\";\nimport { templates } from \"src/templates\";\nimport { Str } from \"@h3ravel/support\";\nimport Actions from \"src/actions\";\nimport ora from \"ora\";\nimport { Logger } from \"@h3ravel/shared\";\nimport { cleanDirectoryExcept, hoistDirectoryContents } from \"src/utils\";\n\nexport class CreateArcstackCommand extends Command {\n protected signature = `create-arcstack\n {location?: The location where this project should be created relative to the current dir.}\n {--n|name?: The name of your project.}\n {--i|install: Install node_modules right away}\n {--t|token?: Kit repo authentication token.}\n {--d|desc?: Project Description.}\n {--k|kit?: Starter template kit.}\n {--p|pre: Download prerelease version if available.}\n {--o|overwrite: Overwrite the installation directory if it is not empty.}\n `;\n protected description = \"Display a personalized greeting.\";\n\n async handle() {\n const options = this.options();\n const pathName = this.argument(\"location\");\n // const defaultName = pathName ? Str.of(pathName).afterLast(\"/\") : undefined;\n\n console.log(altLogo, `font-family: monospace`);\n\n let { template } = await inquirer\n .prompt([\n {\n type: \"list\",\n name: \"template\",\n message: \"Choose starter template kit:\",\n choices: <never>templates.map((e) => ({\n name: e.name,\n value: e.alias,\n disabled: !e.source ? \"(Unavailable at this time)\" : false,\n })),\n default: \"full\",\n when: () => !options.kit,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n let { appName, description } = await inquirer\n .prompt([\n {\n type: \"input\",\n name: \"appName\",\n message: \"What is the name of your project:\",\n default: `arcstack-${template}`,\n // default: defaultName ?? `arcstack-${template}`,\n when: () => !options.name,\n },\n {\n type: \"input\",\n name: \"description\",\n message: \"Project Description:\",\n default: `Simple ${Str.of(template).ucfirst()}.js project created with Arcstack.`,\n when: () => !options.desc,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n let { location } = await inquirer\n .prompt([\n {\n type: \"input\",\n name: \"location\",\n message: \"Installation location relative to the current dir:\",\n default: Str.slugify(options.name ?? appName ?? basename(process.cwd()), \"-\"),\n when: () => !pathName,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n /**\n * Find selected template kit\n */\n const kit = templates.find((e) => e.alias === template)!;\n\n let { install, token, pre } = await inquirer\n .prompt([\n {\n type: \"confirm\",\n name: \"pre\",\n message: `An alpha version of the ${kit.name.replace(/\\s*kit$/i, \"\").trim()} kit is available. Would you like to use it instead?`,\n default: false,\n when: () => kit.prereleaseSource && !options.pre,\n } as never,\n {\n type: \"input\",\n name: \"token\",\n message: \"Authentication token:\",\n when: () => options.kit && !options.token,\n },\n {\n type: \"confirm\",\n name: \"install\",\n message: \"Would you want to install node_modules right away:\",\n default: true,\n when: () => !options.install,\n },\n ])\n .catch((err) => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n this.info(\"Thanks for trying out our starter kit.\");\n process.exit(0);\n }\n return err;\n });\n\n pre = options.pre ?? pre;\n token = options.token ?? token;\n appName = options.name ?? appName;\n install = options.install ?? install;\n template = options.kit ?? template;\n location = pathName ?? location;\n description = options.description ?? description;\n\n /**\n * Validate selected kit\n */\n if (kit && !kit.source) {\n this.error(`ERROR: The ${kit.name} kit is not currently available`);\n process.exit(1);\n }\n\n const source: string = pre && kit.prereleaseSource ? kit.prereleaseSource! : kit.source;\n const actions = new Actions(join(process.cwd(), location), appName, description);\n const spinner = ora(`Loading Template...`).start();\n\n const result = await actions.download(source, install, token, options.overwrite);\n\n if (result.dir && kit.alias) {\n await cleanDirectoryExcept(result.dir, kit.alias);\n await hoistDirectoryContents(result.dir, join(result.dir, kit.alias));\n }\n\n spinner.info(Logger.parse([[\"Cleaning Up...\", \"green\"]], \"\", false)).start();\n await actions.cleanup();\n\n spinner.info(Logger.parse([[\"Initializing Project...\", \"green\"]], \"\", false)).start();\n await actions.copyExampleEnv();\n\n spinner.succeed(Logger.parse([[\"Project initialization complete!\", \"green\"]], \"\", false));\n\n await actions.complete(install);\n }\n}\n","#!/usr/bin/env node\n\nimport { CreateArcstackCommand } from \"./Commands/CreateArcstackCommand\";\nimport { Kernel } from \"@h3ravel/musket\";\n\nclass Application {}\n\nKernel.init(new Application(), {\n rootCommand: CreateArcstackCommand,\n});\n"],"mappings":";;;;;;;;;;;;;;;AAAA,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;;;;ACYjC,MAAaA,YAMP,CACJ;CACE,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACT,EACD;CACE,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACT,CACF;;;;ACpBD,4BAAqB;CACnB;CAEA,YACE,AAAQC,UACR,AAAQC,SACR,AAAQC,aACR;EAHQ;EACA;EACA;AAER,MAAI,CAAC,KAAK,SACR,MAAK,WAAW,KAAK,QAAQ,KAAK,EAAE,QAAQ;;CAIhD,MAAM,KAAK;AACT,SAAQ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