create-commandkit 1.1.3 → 1.1.4-dev.20240202064011

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/README.md CHANGED
@@ -1,33 +1,32 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/underctrl-io/commandkit/master/apps/docs/public/ckit_logo.png" width="60%" />
2
+ <img src="https://raw.githubusercontent.com/underctrl-io/commandkit/master/apps/docs/public/ckit_logo.svg" width="60%" />
3
3
  <br />
4
4
  <a href="https://ctrl.lol/discord"><img src="https://img.shields.io/discord/1055188344188973066?color=5865F2&logo=discord&logoColor=white" alt="support server" /></a>
5
- <a href="https://www.npmjs.com/package/commandkit"><img src="https://img.shields.io/npm/v/commandkit?maxAge=3600&label=commandkit" alt="commandkit version" /></a>
6
- <a href="https://www.npmjs.com/package/create-commandkit"><img src="https://img.shields.io/npm/v/create-commandkit?maxAge=3600&label=create-commandkit" alt="create-commandkit version" /></a>
7
- <a href="https://www.npmjs.com/package/commandkit"><img src="https://img.shields.io/npm/dt/commandkit?maxAge=3600" alt="npm downloads" /></a>
5
+ <a href="https://www.npmjs.com/package/create-commandkit"><img src="https://img.shields.io/npm/v/create-commandkit?maxAge=3600" alt="npm version" /></a>
6
+ <a href="https://www.npmjs.com/package/create-commandkit"><img src="https://img.shields.io/npm/dt/create-commandkit?maxAge=3600" alt="npm downloads" /></a>
8
7
  </div>
9
8
 
10
9
  # create-commandkit
11
10
 
12
- A command-line interface (CLI) to quickly generate a discord.js bot using CommandKit.
11
+ create-commandkit is a CLI utility to quickly instantiate a Discord bot with CommandKit.
12
+
13
+ ## Features
14
+
15
+ - Interactive, beautiful command-line interface 🖥️
16
+ - Supports CommonJS and ES Modules 📦
17
+
18
+ ## Documentation
19
+
20
+ You can find the full documentation [here](https://commandkit.js.org).
13
21
 
14
22
  ## Usage
15
23
 
16
24
  Run the following command in your terminal:
17
25
 
18
26
  ```sh
19
- npm create commandkit@latest
27
+ npx create-commandkit@latest
20
28
  ```
21
29
 
22
- ## Setup Options
23
-
24
- - Project directory
25
- - Package manager (npm/pnpm/yarn)
26
- - Module type (ESM/CommonJS)
27
- - Bot token (written to .env)
28
-
29
- ## Links
30
+ ## Support and Suggestions
30
31
 
31
- - [GitHub](https://github.com/m1-dev/create-commandkit)
32
- - [Discord](https://ctrl.lol/discord)
33
- - [npm](https://npmjs.com/package/create-commandkit)
32
+ Submit any queries or suggestions in our [Discord community](https://ctrl.lol/discord).
package/package.json CHANGED
@@ -1,20 +1,50 @@
1
1
  {
2
- "name": "create-commandkit",
3
- "description": "Start a new CommandKit project with ease.",
4
- "version": "1.1.3",
5
- "main": "src/index.js",
6
- "bin": "src/index.js",
7
- "type": "commonjs",
8
- "license": "MIT",
9
- "keywords": [
10
- "commandkit",
11
- "discord.js",
12
- "cli"
13
- ],
14
- "dependencies": {
15
- "@clack/prompts": "^0.7.0",
16
- "colors": "^1.4.0",
17
- "fs-extra": "^11.1.1",
18
- "gradient-string": "^2.0.2"
19
- }
20
- }
2
+ "name": "create-commandkit",
3
+ "description": "Effortlessly create a CommandKit project",
4
+ "version": "1.1.4-dev.20240202064011",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "bin": "./dist/index.js",
8
+ "type": "module",
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "commandkit",
12
+ "create-commandkit",
13
+ "discord.js",
14
+ "discord",
15
+ "node",
16
+ "client",
17
+ "cli",
18
+ "commands"
19
+ ],
20
+ "files": [
21
+ "dist",
22
+ "templates"
23
+ ],
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/underctrl-io/commandkit",
27
+ "directory": "packages/create-commandkit"
28
+ },
29
+ "homepage": "https://commandkit.js.org",
30
+ "scripts": {
31
+ "lint": "tsc --noEmit",
32
+ "dev": "tsup --watch",
33
+ "build": "tsup",
34
+ "deploy": "npm publish"
35
+ },
36
+ "dependencies": {
37
+ "@clack/prompts": "^0.7.0",
38
+ "colors": "^1.4.0",
39
+ "fs-extra": "^11.1.1",
40
+ "gradient-string": "^2.0.2"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^20.11.6",
44
+ "@types/gradient-string": "^1.1.5",
45
+ "@types/fs-extra": "^11.0.4",
46
+ "typescript": "^5.3.3",
47
+ "tsconfig": "workspace:*",
48
+ "tsup": "^8.0.1"
49
+ }
50
+ }
@@ -0,0 +1,10 @@
1
+ # Welcome to CommandKit
2
+
3
+ > This project was generated by [create-commandkit](https://npmjs.com/package/create-commandkit).
4
+
5
+ Thanks for choosing CommandKit to build your Discord bot!
6
+
7
+ ## Useful links
8
+
9
+ - [Documentation](https://commandkit.js.org)
10
+ - [Discord](https://ctrl.lol/discord)
@@ -0,0 +1,6 @@
1
+ const { defineConfig } = require('commandkit');
2
+
3
+ module.exports = defineConfig({
4
+ src: 'src',
5
+ main: 'index.mjs',
6
+ });
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ /** @type {import('commandkit').CommandData} */
3
+ data: {
4
+ name: 'ping',
5
+ description: 'Replies with Pong',
6
+ },
7
+
8
+ /**
9
+ * @param {import('commandkit').SlashCommandProps} param0
10
+ */
11
+ run: ({ interaction }) => {
12
+ interaction.reply('Pong!');
13
+ },
14
+
15
+ /** @type {import('commandkit').CommandOptions} */
16
+ options: {
17
+ // https://commandkit.js.org/typedef/CommandOptions
18
+ },
19
+ };
@@ -1,4 +1,4 @@
1
1
  /** * @param {import('discord.js').Client} client */
2
2
  module.exports = (client) => {
3
- console.log(`${client.user.tag} is online!`);
4
- }
3
+ console.log(`${client.user.tag} is online!`);
4
+ };
@@ -0,0 +1,22 @@
1
+ require('dotenv/config');
2
+
3
+ const { Client, IntentsBitField } = require('discord.js');
4
+ const { CommandKit } = require('commandkit');
5
+ const { join } = require('path');
6
+
7
+ const client = new Client({
8
+ intents: [
9
+ IntentsBitField.Flags.Guilds,
10
+ IntentsBitField.Flags.GuildMembers,
11
+ IntentsBitField.Flags.GuildMessages,
12
+ IntentsBitField.Flags.MessageContent,
13
+ ],
14
+ });
15
+
16
+ new CommandKit({
17
+ client,
18
+ eventsPath: join(__dirname, 'events'),
19
+ commandsPath: join(__dirname, 'commands'),
20
+ });
21
+
22
+ client.login(process.env.TOKEN);
@@ -0,0 +1,10 @@
1
+ # Welcome to CommandKit
2
+
3
+ > This project was generated by [create-commandkit](https://npmjs.com/package/create-commandkit).
4
+
5
+ Thanks for choosing CommandKit to build your Discord bot!
6
+
7
+ ## Useful links
8
+
9
+ - [Documentation](https://commandkit.js.org)
10
+ - [Discord](https://ctrl.lol/discord)
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from 'commandkit';
2
+
3
+ export default defineConfig({
4
+ src: 'src',
5
+ main: 'index.js',
6
+ });
@@ -0,0 +1,17 @@
1
+ /** @type {import('commandkit').CommandData} */
2
+ export const data = {
3
+ name: 'ping',
4
+ description: 'Replies with Pong',
5
+ };
6
+
7
+ /**
8
+ * @param {import('commandkit').SlashCommandProps} param0
9
+ */
10
+ export const run = ({ interaction }) => {
11
+ interaction.reply('Pong!');
12
+ };
13
+
14
+ /** @type {import('commandkit').CommandOptions} */
15
+ export const options = {
16
+ // https://commandkit.js.org/typedef/CommandOptions
17
+ };
@@ -1,4 +1,4 @@
1
1
  /** * @param {import('discord.js').Client} client */
2
2
  export default (client) => {
3
- console.log(`${client.user.tag} is online!`);
4
- }
3
+ console.log(`${client.user.tag} is online!`);
4
+ };
@@ -0,0 +1,26 @@
1
+ import 'dotenv/config';
2
+
3
+ import { Client, IntentsBitField } from 'discord.js';
4
+ import { CommandKit } from 'commandkit';
5
+
6
+ import { join, dirname } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+
11
+ const client = new Client({
12
+ intents: [
13
+ IntentsBitField.Flags.Guilds,
14
+ IntentsBitField.Flags.GuildMembers,
15
+ IntentsBitField.Flags.GuildMessages,
16
+ IntentsBitField.Flags.MessageContent,
17
+ ],
18
+ });
19
+
20
+ new CommandKit({
21
+ client,
22
+ eventsPath: join(__dirname, 'events'),
23
+ commandsPath: join(__dirname, 'commands'),
24
+ });
25
+
26
+ client.login(process.env.TOKEN);
package/src/constants.js DELETED
@@ -1,46 +0,0 @@
1
- const gradient = require('gradient-string');
2
- const colors = require('colors');
3
- const fs = require('fs-extra');
4
-
5
- exports.templates = {
6
- js: {
7
- esm: `${__dirname}/templates/JavaScript/esm`,
8
- cjs: `${__dirname}/templates/JavaScript/cjs`,
9
- }
10
- }
11
-
12
- exports.colors = {
13
- commandkit: ['#fdba74', '#e4a5a2', '#c288de', '#b27bf9'],
14
- import: ['#c586c0', '#c586c0'],
15
- export: ['#569cd6', '#569cd6'],
16
- require: ['#dcdcaa', '#dcdcaa'],
17
- module: ['#4ec9b0', '#4ec9b0'],
18
- js: ['#f7e01c', '#f7e01c'],
19
- ts: ['#2480c5', '#2480c5']
20
- }
21
-
22
- exports.commands = {
23
- init: { npm: 'npm init -y', yarn: 'yarn init -y', pnpm: 'pnpm init' },
24
- install: {
25
- npm: 'npm install commandkit discord.js dotenv nodemon',
26
- yarn: 'yarn add commandkit discord.js dotenv nodemon',
27
- pnpm: 'pnpm add commandkit discord.js dotenv nodemon',
28
- }
29
- }
30
-
31
- exports.hints = {
32
- import: gradient(exports.colors.import)('import'),
33
- export: gradient(exports.colors.export)('export'),
34
- require: gradient(exports.colors.require)('require'),
35
- module: gradient(exports.colors.module)('exports'),
36
- javascript: gradient(exports.colors.js)('JavaScript'),
37
- typescript: gradient(exports.colors.ts)('TypeScript')
38
- }
39
-
40
- exports.commandkit = gradient(exports.colors.commandkit)('CommandKit');
41
- exports.outroMsg = `
42
- ${gradient(exports.colors.commandkit)('Thank you for choosing CommandKit!')}
43
-
44
- • Documentation: ${colors.blue('https://commandkit.js.org')}
45
- • Join us on Discord: ${colors.blue('https://ctrl.lol/discord')}
46
- `;
@@ -1,6 +0,0 @@
1
- const { templates } = require('../constants');
2
- const fs = require('fs-extra');
3
-
4
- module.exports = async ({ type, dir, lang }) => {
5
- await fs.copy(templates[lang][type], dir);
6
- }
@@ -1,6 +0,0 @@
1
- const { commands } = require('../constants');
2
- const { execSync: ex } = require('child_process');
3
-
4
- module.exports = async ({ manager, dir, stdio = 'pipe' }) => {
5
- ex(commands.install[manager], { cwd: dir, stdio });
6
- }
@@ -1,33 +0,0 @@
1
- const { execSync: ex } = require('child_process');
2
- const { commands } = require('../constants');
3
-
4
- const fs = require('fs-extra');
5
- const path = require('path');
6
-
7
- module.exports = async ({ manager, dir, token, type, stdio = 'pipe' }) => {
8
- await fs.emptyDir(dir);
9
- ex(commands.init[manager], { cwd: dir, stdio });
10
-
11
- const packageJsonPath = path.join(dir, 'package.json');
12
- const packageJson = await fs.readJSON(packageJsonPath);
13
-
14
- const nameCleansed = packageJson.name.replace(
15
- /^(?:(?:@(?:[a-z0-9-*~][a-z0-9-*._~]*)?\/[a-z0-9-._~])|[a-z0-9-~])[a-z0-9-._~]*$/, ''
16
- );
17
-
18
- packageJson.name = nameCleansed.length > 0 ? nameCleansed.replace(' ', '') : 'commandkit-app';
19
-
20
- packageJson.name = packageJson.name.toLowerCase();
21
- packageJson.type = type == 'esm' ? 'module' : 'commonjs';
22
-
23
- packageJson.main = './src/index.js';
24
- packageJson.version = '0.0.0';
25
-
26
- packageJson.scripts = {
27
- start: 'node ./src/index.js',
28
- dev: 'nodemon --ext js,json,ts ./src/index.js'
29
- };
30
-
31
- await fs.writeJSON(packageJsonPath, packageJson, { spaces: 4 });
32
- await fs.writeFile(`${dir}/.env`, `TOKEN = ${token}`);
33
- }
package/src/index.js DELETED
@@ -1,61 +0,0 @@
1
- #!/usr/bin/env node
2
- console.clear();
3
-
4
- const prompts = require('@clack/prompts');
5
-
6
- const { gray, cyan } = require('colors');
7
- const { commandkit, hints, outroMsg } = require('./constants');
8
-
9
- const setup = require('./functions/setup');
10
- const installDeps = require('./functions/installDeps');
11
- const copyTemplates = require('./functions/copyTemplates');
12
-
13
- const path = require('path');
14
- const fs = require('fs-extra');
15
-
16
- (async () => {
17
- prompts.intro(`Welcome to ${commandkit}!`);
18
-
19
- const dir = path.resolve(process.cwd(), await prompts.text({
20
- message: 'Enter a project directory:',
21
- placeholder: 'Leave blank for current directory',
22
- defaultValue: '.',
23
- validate: (value) => {
24
- value = path.resolve(process.cwd(), value);
25
- let isEmpty;
26
-
27
- try {
28
- const contents = fs.readdirSync(value);
29
- isEmpty = contents.length === 0;
30
- } catch { isEmpty = true }
31
-
32
- return isEmpty ? undefined : 'Directory is not empty!';
33
- }
34
- }));
35
-
36
- const manager = await prompts.select({
37
- message: 'Select a package manager:',
38
- options: [{ value: 'npm' }, { value: 'pnpm' }, { value: 'yarn' }],
39
- });
40
-
41
- const type = await prompts.select({
42
- message: 'Select a module type:',
43
- options: [
44
- { label: 'CommonJS', value: 'cjs', hint: `${hints.require} & ${hints.module}` },
45
- { label: 'ES Modules', value: 'esm', hint: `${hints.import} & ${hints.export}` },
46
- ]
47
- });
48
-
49
- const token = await prompts.password({
50
- message: 'Enter your bot token:',
51
- mask: gray('*')
52
- });
53
-
54
- prompts.outro(cyan('Setup complete.'));
55
-
56
- await setup({ manager, dir, token, type });
57
- await copyTemplates({ type, dir, lang: 'js' });
58
- await installDeps({ manager, dir, stdio: 'inherit' });
59
-
60
- console.log(outroMsg);
61
- })();
@@ -1,5 +0,0 @@
1
- Thank you for using CommandKit!
2
-
3
- Helpful resources:
4
- • Documentation — https://commandkit.js.org
5
- • Join us on Discord — https://ctrl.lol/discord
@@ -1,19 +0,0 @@
1
- module.exports = {
2
- /** @type {import('commandkit').CommandData} */
3
- data: {
4
- name: 'ping',
5
- description: 'Replies with Pong'
6
- },
7
-
8
- /**
9
- * @param {import('commandkit').SlashCommandProps} param0
10
- */
11
- run: ({ interaction }) => {
12
- interaction.reply('Pong!');
13
- },
14
-
15
- /** @type {import('commandkit').CommandOptions} */
16
- options: {
17
- // https://commandkit.js.org/typedef/CommandOptions
18
- }
19
- }
@@ -1,21 +0,0 @@
1
- require('dotenv/config');
2
-
3
- const { Client, IntentsBitField } = require('discord.js');
4
- const { CommandKit } = require('commandkit');
5
-
6
- const client = new Client({
7
- intents: [
8
- IntentsBitField.Flags.Guilds,
9
- IntentsBitField.Flags.GuildMembers,
10
- IntentsBitField.Flags.GuildMessages,
11
- IntentsBitField.Flags.MessageContent
12
- ]
13
- });
14
-
15
- new CommandKit({
16
- client,
17
- eventsPath: `${__dirname}/events`,
18
- commandsPath: `${__dirname}/commands`
19
- });
20
-
21
- client.login(process.env.TOKEN);
@@ -1,8 +0,0 @@
1
- # Welcome to CommandKit
2
-
3
- Thanks for choosing CommandKit to build your Discord bot!
4
-
5
- ## Useful links
6
-
7
- - [Documentation](https://commandkit.js.org)
8
- - [Discord](https://ctrl.lol/discord)
@@ -1,17 +0,0 @@
1
- /** @type {import('commandkit').CommandData} */
2
- export const data = {
3
- name: 'ping',
4
- description: 'Replies with Pong'
5
- }
6
-
7
- /**
8
- * @param {import('commandkit').SlashCommandProps} param0
9
- */
10
- export const run = ({ interaction }) => {
11
- interaction.reply('Pong!');
12
- }
13
-
14
- /** @type {import('commandkit').CommandOptions} */
15
- export const options = {
16
- // https://commandkit.js.org/typedef/CommandOptions
17
- }
@@ -1,26 +0,0 @@
1
- import 'dotenv/config';
2
-
3
- import { Client, IntentsBitField } from 'discord.js';
4
- import { CommandKit } from 'commandkit';
5
-
6
- import { dirname as dn } from 'node:path';
7
- import { fileURLToPath } from 'node:url';
8
-
9
- const dirname = dn(fileURLToPath(import.meta.url));
10
-
11
- const client = new Client({
12
- intents: [
13
- IntentsBitField.Flags.Guilds,
14
- IntentsBitField.Flags.GuildMembers,
15
- IntentsBitField.Flags.GuildMessages,
16
- IntentsBitField.Flags.MessageContent
17
- ]
18
- });
19
-
20
- new CommandKit({
21
- client,
22
- eventsPath: `${dirname}/events`,
23
- commandsPath: `${dirname}/commands`
24
- });
25
-
26
- client.login(process.env.TOKEN);
@@ -1,8 +0,0 @@
1
- # Welcome to CommandKit
2
-
3
- Thanks for choosing CommandKit to build your Discord bot!
4
-
5
- ## Useful links
6
-
7
- - [Documentation](https://commandkit.js.org)
8
- - [Discord](https://ctrl.lol/discord)