create-commandkit 1.1.4-dev.20250514040502 → 1.1.4-dev.20250514120740

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/dist/index.js CHANGED
@@ -1,49 +1,14 @@
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"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:path.join(__dirname,"..","templates","JavaScript"),ts:path.join(__dirname,"..","templates","TypeScript")};var textColors={commandkit:["#fdba74","#e4a5a2","#c288de","#b27bf9"],js:["#f7e01c","#f7e01c"],ts:["#2480c5","#2480c5"]};var baseDependencies=["commandkit@dev","discord.js@14"];var dependencies={js:{dependencies:baseDependencies,devDependencies:["@types/node"]},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={javascript:gradient(textColors.js)("JavaScript"),typescript:gradient(textColors.ts)("TypeScript")};var commandkit=gradient(textColors.commandkit)("CommandKit");var outroMsg=__name(({manager:manager2})=>`
3
- ${gradient(textColors.commandkit)("Thank you for choosing CommandKit!")}
2
+ var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:true});import{confirm,intro,outro,password,select,text}from"@clack/prompts";import fs3 from"fs-extra";import gradient from"gradient-string";import{execSync as execSync3}from"node:child_process";import path3 from"node:path";import colors from"picocolors";import fs from"fs-extra";import path from"node:path";import url from"node:url";var __dirname=path.dirname(url.fileURLToPath(import.meta.url));var templates={js:path.join(__dirname,"..","templates","JavaScript"),ts:path.join(__dirname,"..","templates","TypeScript")};async function copyTemplates({dir:dir2,lang:lang2}){await fs.copy(templates[lang2],dir2)}__name(copyTemplates,"copyTemplates");import{execSync}from"node:child_process";var baseDependencies=["commandkit@dev","discord.js"];var dependencies={js:{dependencies:baseDependencies,devDependencies:["@types/node"]},ts:{dependencies:baseDependencies,devDependencies:["@types/node","typescript"]}};function installDeps({manager:manager2,dir:dir2,lang:lang2,stdio="pipe"}){if(dependencies[lang2].dependencies.length){const depsCommand=`${manager2} add ${dependencies[lang2].dependencies.join(" ")}`;execSync(depsCommand,{cwd:dir2,stdio})}if(dependencies[lang2].devDependencies.length){const devDepsCommand=`${manager2} add -D ${dependencies[lang2].devDependencies.join(" ")}`;execSync(devDepsCommand,{cwd:dir2,stdio})}}__name(installDeps,"installDeps");import{execSync as execSync2}from"child_process";import fs2 from"fs-extra";import path2 from"node:path";var textColors={commandkit:["#fdba74","#e4a5a2","#c288de","#b27bf9"],js:["#f7e01c","#f7e01c"],ts:["#2480c5","#2480c5"]};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"}};async function setup({manager:manager2,token:token2,dir:dir2,stdio="pipe"}){await fs2.emptyDir(dir2);execSync2(commands.init[manager2],{cwd:dir2,stdio});const packageJsonPath=path2.join(dir2,"package.json");const packageJson=await fs2.readJSON(packageJsonPath);delete packageJson.main;packageJson.name=packageJson.name.toLowerCase();packageJson.type="module";packageJson.version="0.1.0";packageJson.private=true;packageJson.description="A CommandKit project";packageJson.scripts={dev:"commandkit dev",build:"commandkit build",start:"commandkit start"};await fs2.writeJSON(packageJsonPath,packageJson,{spaces:2});await fs2.writeFile(`${dir2}/.env`,`DISCORD_TOKEN="${token2}"`)}__name(setup,"setup");console.clear();var commandkitGradient=gradient(textColors.commandkit)("CommandKit");intro(`Welcome to ${commandkitGradient}!`);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:"TypeScript",value:"ts"},{label:"JavaScript",value:"js"}]});var token=await password({message:"Enter your bot token (stored in .env):",mask:colors.gray("*")});var gitInit=await confirm({message:"Initialize a git repository?",initialValue:true});outro(colors.cyan("Setup complete."));await setup({manager,dir,token});await copyTemplates({dir,lang});if(gitInit){try{execSync3("git init",{cwd:dir,stdio:"pipe"})}catch(error){console.log(colors.yellow("Warning: Git initialization failed. Make sure Git is installed on your system."))}}installDeps({dir,manager,lang,stdio:"pipe"});console.log(`${gradient(textColors.commandkit)("Thank you for choosing CommandKit!")}
4
3
 
5
4
  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
5
+ ${colors.magenta(`${manager} run dev`)} - Run your bot in development mode
6
+ ${colors.magenta(`${manager} run build`)} - Build your bot for production
7
+ ${colors.magenta(`${manager} run start`)} - Run your bot in production mode
9
8
 
10
9
  \u2022 Documentation: ${colors.blue("https://commandkit.dev")}
11
10
  \u2022 GitHub: ${colors.blue("https://github.com/underctrl-io/commandkit")}
12
- \u2022 UnderCtrl: ${colors.blue("https://underctrl.io")}
13
- \u2022 Join us on Discord: ${colors.blue("https://ctrl.lol/discord")}
11
+ \u2022 Under Ctrl: ${colors.blue("https://underctrl.io")}
12
+ \u2022 Discord community: ${colors.blue("https://ctrl.lol/discord")}
14
13
 
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,token:token2,dir:dir2,stdio="pipe",installDeps:installDeps2=false,devDeps=false}){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="module";packageJson.version="0.1.0";packageJson.private=true;packageJson.description="A CommandKit project";if(!installDeps2){packageJson.dependencies={commandkit:"^0.1.1-dev.20250330115847","discord.js":"^14.18.0"};if(devDeps){packageJson.devDependencies={"@types/node":"^22.13.14",typescript:"^5.8.2"}}}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"}){if(dependencies[lang2].dependencies.length){const depsCommand=`${manager2} add ${dependencies[lang2].dependencies.join(" ")}`;execSync2(depsCommand,{cwd:dir2,stdio})}if(dependencies[lang2].devDependencies.length){const devDepsCommand=`${manager2} add -D ${dependencies[lang2].devDependencies.join(" ")}`;execSync2(devDepsCommand,{cwd:dir2,stdio})}}__name(installDeps,"installDeps");import fs2 from"fs-extra";async function copyTemplates({dir:dir2,lang:lang2}){await fs2.copy(templates[lang2],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";import{writeFile}from"node:fs/promises";var gitignore=`# dependencies
17
- node_modules
18
-
19
- # build output
20
- build
21
- out
22
- dist
23
-
24
- # commandkit
25
- .commandkit
26
-
27
- # env
28
- **/*.env*
29
- !**/*.env.example*
30
-
31
- # logging
32
- logs
33
- *.log
34
- npm-debug.log*
35
- yarn-debug.log*
36
- yarn-error.log*
37
- lerna-debug.log*
38
- .pnpm-debug.log*
39
-
40
- # yarn v2+
41
- .yarn/cache
42
- .yarn/unplugged
43
- .yarn/build-state.yml
44
- .yarn/install-state.gz
45
- .pnp.*
46
-
47
- # other
48
- **/*.DS_Store
49
- `;async function writeGitignore(dir2){await writeFile(`${dir2}/.gitignore`,gitignore)}__name(writeGitignore,"writeGitignore");async function initializeGit(dir2){try{await writeGitignore(dir2);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 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,devDeps:lang==="ts",installDeps:installNow});await copyTemplates({dir,lang});if(gitInit){await initializeGit(dir)}else{await writeGitignore(dir)}if(installNow){await installDeps({manager,dir,lang:"js",stdio:"inherit"})}console.log(outroMsg({manager}));
14
+ Happy coding! \u{1F680}`);
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.20250514040502",
4
+ "version": "1.1.4-dev.20250514120740",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
7
7
  "bin": "./dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "@types/node": "^20.11.6",
40
40
  "tsup": "^8.0.1",
41
41
  "typescript": "^5.3.3",
42
- "tsconfig": "0.0.0-dev.20250514040502"
42
+ "tsconfig": "0.0.0-dev.20250514120740"
43
43
  },
44
44
  "scripts": {
45
45
  "lint": "tsc --noEmit",
@@ -1,12 +1,7 @@
1
- import { Client, IntentsBitField } from 'discord.js';
1
+ import { Client } from 'discord.js';
2
2
 
3
3
  const client = new Client({
4
- intents: [
5
- IntentsBitField.Flags.Guilds,
6
- IntentsBitField.Flags.GuildMembers,
7
- IntentsBitField.Flags.GuildMessages,
8
- IntentsBitField.Flags.MessageContent,
9
- ],
4
+ intents: ['Guilds', 'GuildMembers', 'GuildMessages', 'MessageContent'],
10
5
  });
11
6
 
12
7
  export default client;
@@ -1,12 +1,7 @@
1
- import { Client, IntentsBitField } from 'discord.js';
1
+ import { Client } from 'discord.js';
2
2
 
3
3
  const client = new Client({
4
- intents: [
5
- IntentsBitField.Flags.Guilds,
6
- IntentsBitField.Flags.GuildMembers,
7
- IntentsBitField.Flags.GuildMessages,
8
- IntentsBitField.Flags.MessageContent,
9
- ],
4
+ intents: ['Guilds', 'GuildMembers', 'GuildMessages', 'MessageContent'],
10
5
  });
11
6
 
12
7
  export default client;