create-commandkit 1.1.4-dev.20250514120740 → 1.1.4-dev.20250514123624
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 +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
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="
|
|
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";import ora from"ora";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="inherit"}){const spinner=ora("Installing dependencies...").start();try{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})}spinner.succeed("Dependencies installed successfully!")}catch(error){spinner.fail("Failed to install dependencies");throw error}}__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 Discord bot token (stored in .env, optional):",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!")}
|
|
3
3
|
|
|
4
4
|
To start your bot, use the following commands:
|
|
5
5
|
${colors.magenta(`${manager} run dev`)} - Run your bot in development mode
|
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.
|
|
4
|
+
"version": "1.1.4-dev.20250514123624",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"bin": "./dist/index.js",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@clack/prompts": "^0.7.0",
|
|
32
32
|
"fs-extra": "^11.1.1",
|
|
33
33
|
"gradient-string": "^2.0.2",
|
|
34
|
+
"ora": "^8.0.1",
|
|
34
35
|
"picocolors": "^1.1.1"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
"@types/node": "^20.11.6",
|
|
40
41
|
"tsup": "^8.0.1",
|
|
41
42
|
"typescript": "^5.3.3",
|
|
42
|
-
"tsconfig": "0.0.0-dev.
|
|
43
|
+
"tsconfig": "0.0.0-dev.20250514123624"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
45
46
|
"lint": "tsc --noEmit",
|