create-commandkit 1.2.0-next-beta.20240202110252 → 1.2.0-next-beta.20240203230621

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});import{intro,text,select,password,confirm,outro}from"@clack/prompts";import colors from"colors";import gradient from"gradient-string";import path from"node:path";import url from"node:url";var __dirname=path.dirname(url.fileURLToPath(import.meta.url)),templates={js:{esm:path.join(__dirname,"..","templates","JavaScript","esm"),cjs:path.join(__dirname,"..","templates","JavaScript","cjs")},ts:{esm:path.join(__dirname,"..","templates","TypeScript","esm"),cjs:path.join(__dirname,"..","templates","TypeScript","cjs")}},textColors={commandkit:["#fdba74","#e4a5a2","#c288de","#b27bf9"],import:["#c586c0","#c586c0"],export:["#569cd6","#569cd6"],require:["#dcdcaa","#dcdcaa"],module:["#4ec9b0","#4ec9b0"],js:["#f7e01c","#f7e01c"],ts:["#2480c5","#2480c5"]},baseDependencies=["commandkit","discord.js","dotenv"],dependencies={js:{dependencies:baseDependencies},ts:{dependencies:baseDependencies,devDependencies:["@types/node","typescript"]}},commands={init:{npm:"npm init -y",yarn:"yarn init -y; yarn config set nodeLinker node-modules; yarn set version stable",pnpm:"pnpm init"}},hints={import:gradient(textColors.import)("import"),export:gradient(textColors.export)("export"),require:gradient(textColors.require)("require"),module:gradient(textColors.module)("exports"),javascript:gradient(textColors.js)("JavaScript"),typescript:gradient(textColors.ts)("TypeScript")},commandkit=gradient(textColors.commandkit)("CommandKit"),outroMsg=`
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});import{intro,text,select,password,confirm,outro}from"@clack/prompts";import colors from"colors";import gradient from"gradient-string";import path from"node:path";import url from"node:url";var __dirname=path.dirname(url.fileURLToPath(import.meta.url));var templates={js:{esm:path.join(__dirname,"..","templates","JavaScript","esm"),cjs:path.join(__dirname,"..","templates","JavaScript","cjs")},ts:{esm:path.join(__dirname,"..","templates","TypeScript","esm"),cjs:path.join(__dirname,"..","templates","TypeScript","cjs")}};var textColors={commandkit:["#fdba74","#e4a5a2","#c288de","#b27bf9"],import:["#c586c0","#c586c0"],export:["#569cd6","#569cd6"],require:["#dcdcaa","#dcdcaa"],module:["#4ec9b0","#4ec9b0"],js:["#f7e01c","#f7e01c"],ts:["#2480c5","#2480c5"]};var baseDependencies=["commandkit","discord.js","dotenv"];var dependencies={js:{dependencies:baseDependencies},ts:{dependencies:baseDependencies,devDependencies:["@types/node","typescript"]}};var commands={init:{npm:"npm init -y",yarn:"yarn init -y; yarn config set nodeLinker node-modules; yarn set version stable",pnpm:"pnpm init"}};var hints={import:gradient(textColors.import)("import"),export:gradient(textColors.export)("export"),require:gradient(textColors.require)("require"),module:gradient(textColors.module)("exports"),javascript:gradient(textColors.js)("JavaScript"),typescript:gradient(textColors.ts)("TypeScript")};var commandkit=gradient(textColors.commandkit)("CommandKit");var outroMsg=`
3
3
  ${gradient(textColors.commandkit)("Thank you for choosing CommandKit!")}
4
4
 
5
5
  \u2022 Documentation: ${colors.blue("https://commandkit.js.org")}
6
6
  \u2022 Join us on Discord: ${colors.blue("https://ctrl.lol/discord")}
7
- `;import{execSync}from"child_process";import fs from"fs-extra";import path2 from"node:path";async function setup({manager:manager2,type:type2,token:token2,dir:dir2,stdio="pipe"}){await fs.emptyDir(dir2),execSync(commands.init[manager2],{cwd:dir2,stdio});let packageJsonPath=path2.join(dir2,"package.json"),packageJson=await fs.readJSON(packageJsonPath);delete packageJson.main,packageJson.name=packageJson.name.toLowerCase(),packageJson.type=type2=="esm"?"module":"commonjs",packageJson.version="0.0.0",packageJson.scripts={dev:"commandkit dev",build:"commandkit build",start:"commandkit start"},await fs.writeJSON(packageJsonPath,packageJson,{spaces:2}),await fs.writeFile(`${dir2}/.env`,`TOKEN="${token2}"`)}__name(setup,"setup");import{execSync as execSync2}from"node:child_process";function installDeps({manager:manager2,dir:dir2,lang:lang2,stdio="pipe"}){let depsCommand=`${manager2} add ${dependencies[lang2].dependencies.join(" ")}`,devDepsCommand=`${manager2} add ${dependencies.ts.devDependencies.join(" ")}`;execSync2(depsCommand,{cwd:dir2,stdio}),lang2=="ts"&&execSync2(devDepsCommand,{cwd:dir2,stdio})}__name(installDeps,"installDeps");import fs2 from"fs-extra";async function copyTemplates({type:type2,dir:dir2,lang:lang2}){await fs2.copy(templates[lang2][type2],dir2)}__name(copyTemplates,"copyTemplates");import path3 from"node:path";import colors2 from"colors";import fs3 from"fs-extra";console.clear();await intro(`Welcome to ${commandkit}!`);var dir=path3.resolve(process.cwd(),await text({message:"Enter a project directory:",placeholder:"Leave blank for current directory",defaultValue:".",validate:value=>{value=path3.resolve(process.cwd(),value);let isEmpty;try{isEmpty=fs3.readdirSync(value).length===0}catch{isEmpty=!0}return isEmpty?void 0:"Directory is not empty!"}})),manager=await select({message:"Select a package manager:",options:[{label:"npm",value:"npm"},{label:"pnpm",value:"pnpm"},{label:"yarn",value:"yarn"}]}),lang=await select({message:"Select the language to use:",options:[{label:"JavaScript",value:"js"},{label:"TypeScript",value:"ts"}]}),type=await select({message:"Select a module type:",options:[{label:"CommonJS",value:"cjs",hint:`${hints.require} & ${hints.module}`},{label:"ES Modules",value:"esm",hint:`${hints.import} & ${hints.export}`}]}),token=await password({message:"Enter your bot token:",mask:colors2.gray("*")}),installNow=await confirm({message:"Install dependencies now?",initialValue:!0});outro(colors2.cyan("Setup complete."));await setup({manager,dir,token,type});await copyTemplates({type,dir,lang});installNow&&await installDeps({manager,dir,lang:"js",stdio:"inherit"});console.log(outroMsg);
7
+ `;import{execSync}from"child_process";import fs from"fs-extra";import path2 from"node:path";async function setup({manager:manager2,type:type2,token:token2,dir:dir2,stdio="pipe"}){await fs.emptyDir(dir2);execSync(commands.init[manager2],{cwd:dir2,stdio});const packageJsonPath=path2.join(dir2,"package.json");const packageJson=await fs.readJSON(packageJsonPath);delete packageJson.main;packageJson.name=packageJson.name.toLowerCase();packageJson.type=type2=="esm"?"module":"commonjs";packageJson.version="0.0.0";packageJson.scripts={dev:"commandkit dev",build:"commandkit build",start:"commandkit start"};await fs.writeJSON(packageJsonPath,packageJson,{spaces:2});await fs.writeFile(`${dir2}/.env`,`TOKEN="${token2}"`)}__name(setup,"setup");import{execSync as execSync2}from"node:child_process";function installDeps({manager:manager2,dir:dir2,lang:lang2,stdio="pipe"}){const depsCommand=`${manager2} add ${dependencies[lang2].dependencies.join(" ")}`;const devDepsCommand=`${manager2} add ${dependencies.ts.devDependencies.join(" ")}`;execSync2(depsCommand,{cwd:dir2,stdio});if(lang2=="ts"){execSync2(devDepsCommand,{cwd:dir2,stdio})}}__name(installDeps,"installDeps");import fs2 from"fs-extra";async function copyTemplates({type:type2,dir:dir2,lang:lang2}){await fs2.copy(templates[lang2][type2],dir2)}__name(copyTemplates,"copyTemplates");import path3 from"node:path";import colors2 from"colors";import fs3 from"fs-extra";console.clear();await intro(`Welcome to ${commandkit}!`);var dir=path3.resolve(process.cwd(),await text({message:"Enter a project directory:",placeholder:"Leave blank for current directory",defaultValue:".",validate:value=>{value=path3.resolve(process.cwd(),value);let isEmpty;try{const contents=fs3.readdirSync(value);isEmpty=contents.length===0}catch{isEmpty=true}return isEmpty?void 0:"Directory is not empty!"}}));var manager=await select({message:"Select a package manager:",options:[{label:"npm",value:"npm"},{label:"pnpm",value:"pnpm"},{label:"yarn",value:"yarn"}]});var lang=await select({message:"Select the language to use:",options:[{label:"JavaScript",value:"js"},{label:"TypeScript",value:"ts"}]});var type=await select({message:"Select a module type:",options:[{label:"CommonJS",value:"cjs",hint:`${hints.require} & ${hints.module}`},{label:"ES Modules",value:"esm",hint:`${hints.import} & ${hints.export}`}]});var token=await password({message:"Enter your bot token:",mask:colors2.gray("*")});var installNow=await confirm({message:"Install dependencies now?",initialValue:true});outro(colors2.cyan("Setup complete."));await setup({manager,dir,token,type});await copyTemplates({type,dir,lang});if(installNow){await installDeps({manager,dir,lang:"js",stdio:"inherit"})}console.log(outroMsg);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-commandkit",
3
3
  "description": "Effortlessly create a CommandKit project!",
4
- "version": "1.2.0-next-beta.20240202110252",
4
+ "version": "1.2.0-next-beta.20240203230621",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "bin": "./dist/index.js",