create-commandkit 1.1.4-dev.20250215122011 → 1.1.4-dev.20250215123740

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 +10 -2
  2. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -1,8 +1,16 @@
1
1
  #!/usr/bin/env node
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:{app:{esm:path.join(__dirname,"..","templates","JavaScript","app","esm"),cjs:path.join(__dirname,"..","templates","JavaScript","app","cjs")},legacy:{esm:path.join(__dirname,"..","templates","JavaScript","legacy","esm"),cjs:path.join(__dirname,"..","templates","JavaScript","legacy","cjs")}},ts:{app:{esm:path.join(__dirname,"..","templates","TypeScript","app","esm"),cjs:path.join(__dirname,"..","templates","TypeScript","app","cjs")},legacy:{esm:path.join(__dirname,"..","templates","TypeScript","legacy","esm"),cjs:path.join(__dirname,"..","templates","TypeScript","legacy","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"],app:["#e4a5a2","#e4a5a2"],legacy:["#dcdcaa","#dcdcaa"]};var baseDependencies=["commandkit","discord.js"];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"),app:gradient(textColors.app)("app"),legacy:gradient(textColors.legacy)("legacy")};var commandkit=gradient(textColors.commandkit)("CommandKit");var 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"picocolors";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:{app:{esm:path.join(__dirname,"..","templates","JavaScript","app","esm"),cjs:path.join(__dirname,"..","templates","JavaScript","app","cjs")},legacy:{esm:path.join(__dirname,"..","templates","JavaScript","legacy","esm"),cjs:path.join(__dirname,"..","templates","JavaScript","legacy","cjs")}},ts:{app:{esm:path.join(__dirname,"..","templates","TypeScript","app","esm"),cjs:path.join(__dirname,"..","templates","TypeScript","app","cjs")},legacy:{esm:path.join(__dirname,"..","templates","TypeScript","legacy","esm"),cjs:path.join(__dirname,"..","templates","TypeScript","legacy","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"],app:["#e4a5a2","#e4a5a2"],legacy:["#dcdcaa","#dcdcaa"]};var baseDependencies=["commandkit","discord.js"];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",bun:"bun init -y"}};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=__name(({manager:manager2})=>`
3
3
  ${gradient(textColors.commandkit)("Thank you for choosing CommandKit!")}
4
4
 
5
+ To start your bot, use the following commands:
6
+ ${colors.magenta(`${manager2} run dev`)} - Run your bot in development mode
7
+ ${colors.magenta(`${manager2} run build`)} - Build your bot for production
8
+ ${colors.magenta(`${manager2} run start`)} - Run your bot in production mode
9
+
5
10
  \u2022 Documentation: ${colors.blue("https://commandkit.dev")}
6
11
  \u2022 GitHub: ${colors.blue("https://github.com/underctrl-io/commandkit")}
12
+ \u2022 UnderCtrl: ${colors.blue("https://underctrl.io")}
7
13
  \u2022 Join us on Discord: ${colors.blue("https://ctrl.lol/discord")}
8
- `;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`,`DISCORD_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,handler}){await fs2.copy(templates[lang2][handler][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:__name(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!"},"validate")}));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);
14
+
15
+ Happy coding! \u{1F680}
16
+ `,"outroMsg");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`,`DISCORD_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,handler:handler2}){await fs2.copy(templates[lang2][handler2][type2],dir2)}__name(copyTemplates,"copyTemplates");import path3 from"node:path";import colors2 from"picocolors";import fs3 from"fs-extra";import{execSync as execSync3}from"node:child_process";async function initializeGit(dir2){try{execSync3("git init",{cwd:dir2,stdio:"pipe"})}catch{}}__name(initializeGit,"initializeGit");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:__name(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!"},"validate")}));var manager=await select({message:"Select a package manager:",initialValue:"npm",options:[{label:"npm",value:"npm"},{label:"pnpm",value:"pnpm"},{label:"yarn",value:"yarn"},{label:"bun",value:"bun"}]});var lang=await select({message:"Select the language to use:",initialValue:"ts",options:[{label:"JavaScript",value:"js"},{label:"TypeScript",value:"ts"}]});var handler=await select({message:"Select a command handler:",initialValue:"app",options:[{label:"App",value:"app",hint:"recommended"},{label:"Legacy",value:"legacy"}]});var type=await select({message:"Select a module type:",initialValue:"esm",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 (stored in .env):",mask:colors2.gray("*")});var installNow=await confirm({message:"Install dependencies now?",initialValue:true});var gitInit=await confirm({message:"Initialize a git repository?",initialValue:true});outro(colors2.cyan("Setup complete."));await setup({manager,dir,token,type});await copyTemplates({type,dir,lang,handler});if(gitInit){await initializeGit(dir)}if(installNow){await installDeps({manager,dir,lang:"js",stdio:"inherit"})}console.log(outroMsg({manager}));
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.1.4-dev.20250215122011",
4
+ "version": "1.1.4-dev.20250215123740",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "bin": "./dist/index.js",
@@ -35,16 +35,16 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@clack/prompts": "^0.7.0",
38
- "colors": "^1.4.0",
39
38
  "fs-extra": "^11.1.1",
40
- "gradient-string": "^2.0.2"
39
+ "gradient-string": "^2.0.2",
40
+ "picocolors": "^1.1.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@types/node": "^20.11.6",
44
- "@types/gradient-string": "^1.1.5",
45
43
  "@types/fs-extra": "^11.0.4",
46
- "typescript": "^5.3.3",
44
+ "@types/gradient-string": "^1.1.5",
45
+ "@types/node": "^20.11.6",
47
46
  "tsconfig": "workspace:*",
48
- "tsup": "^8.0.1"
47
+ "tsup": "^8.0.1",
48
+ "typescript": "^5.3.3"
49
49
  }
50
50
  }