create-commandkit 1.0.1 → 1.1.0
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 +7 -8
- package/package.json +4 -4
- package/src/{config.js → constants.js} +9 -1
- package/src/functions/copyTemplates.js +1 -1
- package/src/functions/installDeps.js +1 -1
- package/src/functions/setup.js +1 -1
- package/src/index.js +44 -39
- package/src/static/outroMessage.txt +5 -0
- /package/src/templates/JavaScript/cjs/{README.md → welcome.md} +0 -0
- /package/src/templates/JavaScript/esm/{README.md → welcome.md} +0 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
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/commandkit"><img src="https://img.shields.io/npm/v/create-commandkit?maxAge=3600&label=create-commandkit" alt="create-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
7
|
<a href="https://www.npmjs.com/package/commandkit"><img src="https://img.shields.io/npm/dt/commandkit?maxAge=3600" alt="npm downloads" /></a>
|
|
8
8
|
</div>
|
|
9
9
|
|
|
@@ -13,12 +13,10 @@ A command-line interface (CLI) to quickly generate a discord.js bot using Comman
|
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
|
-
Run
|
|
16
|
+
Run the following command in your terminal:
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
-
npm create commandkit
|
|
20
|
-
pnpm create commandkit
|
|
21
|
-
yarn create commandkit
|
|
19
|
+
npm create commandkit@latest
|
|
22
20
|
```
|
|
23
21
|
|
|
24
22
|
## Setup Options
|
|
@@ -28,7 +26,8 @@ yarn create commandkit
|
|
|
28
26
|
- Module type (ESM/CommonJS)
|
|
29
27
|
- Bot token (written to .env)
|
|
30
28
|
|
|
31
|
-
##
|
|
29
|
+
## Links
|
|
32
30
|
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
31
|
+
- [GitHub](https://github.com/m1-dev/create-commandkit)
|
|
32
|
+
- [Discord](https://ctrl.lol/discord)
|
|
33
|
+
- [npm](https://npmjs.com/package/create-commandkit)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-commandkit",
|
|
3
3
|
"description": "Start a new CommandKit project with ease.",
|
|
4
|
-
"version": "1.0
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": "src/index.js",
|
|
7
7
|
"type": "commonjs",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@clack/prompts": "^0.7.0",
|
|
16
|
-
"
|
|
16
|
+
"colors": "^1.4.0",
|
|
17
17
|
"fs-extra": "^11.1.1",
|
|
18
|
-
"
|
|
18
|
+
"gradient-string": "^2.0.2"
|
|
19
19
|
}
|
|
20
|
-
}
|
|
20
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const gradient = require('gradient-string');
|
|
2
|
+
const colors = require('colors');
|
|
3
|
+
const fs = require('fs-extra');
|
|
2
4
|
|
|
3
5
|
exports.templates = {
|
|
4
6
|
js: {
|
|
@@ -35,4 +37,10 @@ exports.hints = {
|
|
|
35
37
|
typescript: gradient(exports.colors.ts)('TypeScript')
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
exports.commandkit = gradient(exports.colors.commandkit)('CommandKit');
|
|
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
|
+
`;
|
package/src/functions/setup.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,55 +1,60 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
console.clear();
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const prompts = require('@clack/prompts');
|
|
5
|
+
|
|
6
|
+
const { gray, cyan } = require('colors');
|
|
7
|
+
const { commandkit, hints, outroMsg } = require('./constants');
|
|
6
8
|
|
|
7
9
|
const setup = require('./functions/setup');
|
|
8
10
|
const installDeps = require('./functions/installDeps');
|
|
9
11
|
const copyTemplates = require('./functions/copyTemplates');
|
|
10
12
|
|
|
11
|
-
const prompts = require('@clack/prompts');
|
|
12
13
|
const path = require('path');
|
|
13
|
-
|
|
14
|
-
const gradient = require('gradient-string');
|
|
14
|
+
const fs = require('fs-extra');
|
|
15
15
|
|
|
16
16
|
(async () => {
|
|
17
17
|
prompts.intro(`Welcome to ${commandkit}!`);
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
let isEmpty;
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const contents = fs.readdirSync(value);
|
|
28
|
+
isEmpty = contents.length === 0;
|
|
29
|
+
} catch { isEmpty = true }
|
|
30
|
+
|
|
31
|
+
return isEmpty ? undefined : 'Directory is not empty!';
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
const manager = await prompts.select({
|
|
36
|
+
message: 'Select a package manager:',
|
|
37
|
+
options: [{ value: 'npm' }, { value: 'pnpm' }, { value: 'yarn' }],
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const type = await prompts.select({
|
|
41
|
+
message: 'Select a module type:',
|
|
42
|
+
options: [
|
|
43
|
+
{ label: 'CommonJS', value: 'cjs', hint: `${hints.require} & ${hints.module}` },
|
|
44
|
+
{ label: 'ES Modules', value: 'esm', hint: `${hints.import} & ${hints.export}` },
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const token = await prompts.password({
|
|
49
|
+
message: 'Enter your bot token:',
|
|
50
|
+
mask: gray('*')
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
prompts.outro(cyan('Setup complete.'));
|
|
54
|
+
|
|
55
|
+
await setup({ manager, dir, token, type });
|
|
50
56
|
await copyTemplates({ type, dir, lang: 'js' });
|
|
57
|
+
await installDeps({ manager, dir, stdio: 'inherit' });
|
|
51
58
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
prompts.outro(gradient.summer('Happy coding!'));
|
|
59
|
+
console.log(outroMsg);
|
|
55
60
|
})();
|
|
File without changes
|
|
File without changes
|