generator-discord 1.2.5 → 1.2.7

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,7 +1,7 @@
1
1
  <div id="logo" align="center">
2
2
  <a href="https://github.com/emilkrebs/Generator-Discord" target="_blank" rel="noopener noreferrer">
3
- <img width="256" alt="Generator-Discord Logo" src="https://raw.githubusercontent.com/emilkrebs/Generator-Discord/main/assets/icon.svg">
4
- </a>
3
+ <img width="256" alt="Generator-Discord Logo" src="./assets/icon.svg">
4
+ </a>
5
5
  <h3>
6
6
  Yeoman Generator for Discord.js
7
7
  </h3>
@@ -10,11 +10,10 @@
10
10
  <div id="badges" align="center">
11
11
 
12
12
  [![Build](https://github.com/emilkrebs/generator-discord/actions/workflows/build.yml/badge.svg)](https://github.com/emilkrebs/generator-discord/actions/workflows/build.yml)
13
- [![Tests](https://github.com/emilkrebs/generator-discord/actions/workflows/test.yml/badge.svg)](https://github.com/emilkrebs/generator-discord/actions/workflows/test.yml)
13
+ [![Tests](https://github.com/emilkrebs/generator-discord/actions/workflows/test.yml/badge.svg)](https://github.com/emilkrebs/generator-discord/actions/workflows/test.yml)
14
14
  [![downloads](https://img.shields.io/npm/dw/generator-discord?color=orange)](https://www.npmjs.com/package/generator-discord)
15
- [![version](https://img.shields.io/npm/v/generator-discord)](https://www.npmjs.com/package/generator-discord)
15
+ [![version](https://img.shields.io/npm/v/generator-discord)](https://www.npmjs.com/package/generator-discord)
16
16
 
17
-
18
17
  </div>
19
18
 
20
19
  <hr>
@@ -22,6 +21,7 @@
22
21
  Generate a basic starter project for a new Discord-bot in your favorite programming language.
23
22
 
24
23
  ### Supported programming languages
24
+
25
25
  - TypeScript
26
26
  - JavaScript
27
27
  - Python
@@ -33,20 +33,24 @@ Generate a basic starter project for a new Discord-bot in your favorite programm
33
33
 
34
34
  # Installing the Generator
35
35
 
36
- Install Yeoman using
36
+ Install Yeoman using
37
+
37
38
  ```bash
38
39
  npm install -g yo
39
40
  ```
40
- Install this Generator using
41
+
42
+ Install this Generator using
43
+
41
44
  ```bash
42
45
  npm install -g generator-discord
43
46
  ```
47
+
44
48
  # Run using yo
49
+
45
50
  ```bash
46
51
  yo discord
47
52
  ```
48
53
 
49
-
50
54
  [![Example](https://user-images.githubusercontent.com/68400102/175165919-473536d8-c7c0-4881-a438-d11dc8001ee1.png)](https://github.com/emilkrebs/Sound-Bot)
51
55
 
52
56
  ## Known Issues
package/app/index.js CHANGED
@@ -18,6 +18,7 @@ const TEMPLATE_DIR = '../templates/';
18
18
  const USER_DIR = '.';
19
19
  const BOT_NAME = /<%= bot-name %>/g;
20
20
  const BOT_TOKEN = /<%= bot-token %>/g;
21
+ // needed for rust
21
22
  const BOT_NAME_RUST = /bot_name/g;
22
23
  class DiscordGenerator extends yeoman_generator_1.default {
23
24
  constructor(args, options) {
@@ -70,35 +71,40 @@ class DiscordGenerator extends yeoman_generator_1.default {
70
71
  });
71
72
  }
72
73
  logo() {
73
- this.log(' \x1b[36m_____ _ _ \x1b[31m_ ');
74
- this.log(' \x1b[36m| __ \\(_) | | \x1b[31m(_) ');
75
- this.log(' \x1b[36m| | | |_ ___ ___ ___ _ __ __| | \x1b[33m_ ___ ');
74
+ this.log(' \x1b[36m_____ _ _ \x1b[31m_');
75
+ this.log(' \x1b[36m| __ \\(_) | | \x1b[31m(_)');
76
+ this.log(' \x1b[36m| | | |_ ___ ___ ___ _ __ __| | \x1b[33m_ ___');
76
77
  this.log(' \x1b[36m| | | | / __|/ __/ _ \\| \'__/ _` | \x1b[33m| / __|');
77
78
  this.log(' \x1b[36m| |__| | \\__ \\ (_| (_) | | | (_| |\x1b[37m_\x1b[32m| \\__ \\');
78
79
  this.log(' \x1b[36m|_____/|_|___/\\___\\___/|_| \\__,_\x1b[37m(_) \x1b[32m|___/');
79
- this.log(' \x1b[34m_/ | ');
80
- this.log(' \x1b[35m|__/ ');
80
+ this.log(' \x1b[34m_/ |');
81
+ this.log(' \x1b[35m|__/');
81
82
  this.log('\x1b[0m');
82
83
  }
83
84
  writing() {
84
85
  this.sourceRoot(path_1.default.join(__dirname, TEMPLATE_DIR + this.answers.botType));
85
- ['.'].forEach((path) => {
86
+ const paths = ['.'];
87
+ // iterate over all files
88
+ for (let i = 0, len = paths.length; i < len; i++) {
89
+ const path = paths[i];
86
90
  this.fs.copy(this.templatePath(path), this.destinationPath(USER_DIR, this.answers.botName, path), {
87
91
  process: (content) => this._replaceWords(content, this.answers)
88
92
  });
89
- });
93
+ }
90
94
  }
91
95
  install() {
92
96
  return __awaiter(this, void 0, void 0, function* () {
93
97
  this.log('');
94
98
  if (this.answers.botType === 'typescript' || this.answers.botType === 'javascript') {
95
99
  const options = { cwd: this.destinationPath(USER_DIR, this.answers.botName) };
100
+ this.log('Installing dependencies...');
96
101
  this.spawnCommandSync('npm', ['install'], options);
97
102
  if (this.answers.botType === 'typescript') {
103
+ this.log('Building your Discord Bot...');
98
104
  this.spawnCommandSync('npm', ['run', 'build'], options);
99
105
  }
100
106
  }
101
- this.log('Your Discord Bot ' + this.answers.botName + ' has been created!');
107
+ this.log('Your Discord Bot \'\x1b[32m' + this.answers.botName + '\x1b[0m\' has been created!');
102
108
  });
103
109
  }
104
110
  end() {
@@ -106,7 +112,7 @@ class DiscordGenerator extends yeoman_generator_1.default {
106
112
  const answer = yield this.prompt({
107
113
  type: 'list',
108
114
  name: 'openWithCode',
109
- message: 'Do you want to open your Discord Bot with Visual Studio Code?',
115
+ message: 'Do you want to open your Discord Bot with \x1b[36mVisual Studio Code\x1b[0m?',
110
116
  choices: [
111
117
  {
112
118
  name: 'open with `code`',
package/app/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,wEAAyC;AACzC,gDAAwB;AAExB,MAAM,YAAY,GAAG,eAAe,CAAC;AACrC,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB,MAAM,Q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I,EAAE,kBAAkB;wBACxB,KAAK,EAAE,IAAI;qBACX;oBACD;wBACC,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,KAAK;qBACZ;iBACD;aACD,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,MAAM,IAAI,MAAM,CAAC,YAAY,EAAE;gBAClC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,eAAe,CAC9C,QAAQ,EACR,IAAI,CAAC,OAAO,CAAC,OAAO,CACpB,CAAC,CAAC,CAAC;aACJ;QACF,CAAC;KAAA;IAED,aAAa,CAAC,OAAe,EAAE,OAAgB;QAC9C,IAAI,OAAO,CAAC,OAAO,KAAK,MAAM,EAAE;YAC/B,OAAO,OAAO,CAAC,QAAQ,EAAE;iBACvB,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC;iBACpC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;SAC1C;QAED,OAAO,OAAO,CAAC,QAAQ,EAAE;aACvB,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC;aACpC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACD;AA3ID,mCA2IC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "generator-discord",
3
3
  "displayName": "Generator-Discord",
4
- "version": "1.2.5",
4
+ "version": "1.2.7",
5
5
  "main": "./app/index.js",
6
6
  "description": "Yeoman generator for Discord.js",
7
7
  "keywords": [
@@ -39,11 +39,11 @@
39
39
  "yeoman-generator": "^5.9.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@typescript-eslint/eslint-plugin": "^6.6.0",
43
- "@typescript-eslint/parser": "^6.6.0",
44
- "eslint": "^8.49.0",
42
+ "@typescript-eslint/eslint-plugin": "^6.7.5",
43
+ "@typescript-eslint/parser": "^6.7.5",
44
+ "eslint": "^8.51.0",
45
45
  "typescript": "^5.2.2",
46
- "vitest": "^0.34.4",
46
+ "vitest": "^0.34.6",
47
47
  "yeoman-test": "^7.4.0"
48
48
  }
49
49
  }
package/src/index.ts CHANGED
@@ -7,15 +7,16 @@ const USER_DIR = '.';
7
7
  const BOT_NAME = /<%= bot-name %>/g;
8
8
  const BOT_TOKEN = /<%= bot-token %>/g;
9
9
 
10
+ // needed for rust
10
11
  const BOT_NAME_RUST = /bot_name/g;
11
12
 
12
13
  type BotType = 'typescript' | 'javascript' | 'python' | 'rust';
13
14
 
14
15
  interface Answers {
15
- botName: string;
16
- botType: BotType;
17
- botToken: string;
18
- openWithCode: boolean;
16
+ botName: string;
17
+ botType: BotType;
18
+ botToken: string;
19
+ openWithCode: boolean;
19
20
  }
20
21
 
21
22
 
@@ -72,47 +73,53 @@ export default class DiscordGenerator extends Generator {
72
73
  }
73
74
 
74
75
  logo(): void {
75
- this.log(' \x1b[36m_____ _ _ \x1b[31m_ ');
76
- this.log(' \x1b[36m| __ \\(_) | | \x1b[31m(_) ');
77
- this.log(' \x1b[36m| | | |_ ___ ___ ___ _ __ __| | \x1b[33m_ ___ ');
76
+ this.log(' \x1b[36m_____ _ _ \x1b[31m_');
77
+ this.log(' \x1b[36m| __ \\(_) | | \x1b[31m(_)');
78
+ this.log(' \x1b[36m| | | |_ ___ ___ ___ _ __ __| | \x1b[33m_ ___');
78
79
  this.log(' \x1b[36m| | | | / __|/ __/ _ \\| \'__/ _` | \x1b[33m| / __|');
79
80
  this.log(' \x1b[36m| |__| | \\__ \\ (_| (_) | | | (_| |\x1b[37m_\x1b[32m| \\__ \\');
80
81
  this.log(' \x1b[36m|_____/|_|___/\\___\\___/|_| \\__,_\x1b[37m(_) \x1b[32m|___/');
81
- this.log(' \x1b[34m_/ | ');
82
- this.log(' \x1b[35m|__/ ');
82
+ this.log(' \x1b[34m_/ |');
83
+ this.log(' \x1b[35m|__/');
83
84
  this.log('\x1b[0m');
84
85
  }
85
86
 
86
87
  writing(): void {
87
88
  this.sourceRoot(path.join(__dirname, TEMPLATE_DIR + this.answers.botType));
88
- ['.'].forEach(
89
- (path: string) => {
90
- this.fs.copy(
91
- this.templatePath(path),
92
- this.destinationPath(
93
- USER_DIR,
94
- this.answers.botName,
95
- path
96
- ),
97
- {
98
- process: (content: Buffer) => this._replaceWords(content, this.answers)
99
- }
100
- );
101
- }
102
- );
89
+ const paths = ['.'];
90
+
91
+ // iterate over all files
92
+ for (let i = 0, len = paths.length; i < len; i++) {
93
+ const path = paths[i];
94
+ this.fs.copy(
95
+ this.templatePath(path),
96
+ this.destinationPath(
97
+ USER_DIR,
98
+ this.answers.botName,
99
+ path
100
+ ),
101
+ {
102
+ process: (content) => this._replaceWords(content, this.answers)
103
+ }
104
+ );
105
+ }
103
106
  }
104
107
 
105
108
  async install(): Promise<void> {
106
109
  this.log('');
107
110
  if (this.answers.botType === 'typescript' || this.answers.botType === 'javascript') {
108
111
  const options = { cwd: this.destinationPath(USER_DIR, this.answers.botName) };
112
+
113
+ this.log('Installing dependencies...');
109
114
  this.spawnCommandSync('npm', ['install'], options);
110
- if(this.answers.botType === 'typescript') {
115
+
116
+ if (this.answers.botType === 'typescript') {
117
+ this.log('Building your Discord Bot...');
111
118
  this.spawnCommandSync('npm', ['run', 'build'], options);
112
119
  }
113
120
  }
114
121
 
115
- this.log('Your Discord Bot ' + this.answers.botName + ' has been created!');
122
+ this.log('Your Discord Bot \'\x1b[32m' + this.answers.botName + '\x1b[0m\' has been created!');
116
123
 
117
124
  }
118
125
 
@@ -120,7 +127,7 @@ export default class DiscordGenerator extends Generator {
120
127
  const answer = await this.prompt({
121
128
  type: 'list',
122
129
  name: 'openWithCode',
123
- message: 'Do you want to open your Discord Bot with Visual Studio Code?',
130
+ message: 'Do you want to open your Discord Bot with \x1b[36mVisual Studio Code\x1b[0m?',
124
131
  choices: [
125
132
  {
126
133
  name: 'open with `code`',
@@ -142,14 +149,14 @@ export default class DiscordGenerator extends Generator {
142
149
  }
143
150
 
144
151
  _replaceWords(content: Buffer, answers: Answers): string {
145
- if(answers.botType === 'rust') {
152
+ if (answers.botType === 'rust') {
146
153
  return content.toString()
147
154
  .replace(BOT_TOKEN, answers.botToken)
148
155
  .replace(BOT_NAME_RUST, answers.botName);
149
156
  }
150
157
 
151
158
  return content.toString()
152
- .replace(BOT_TOKEN,answers.botToken)
159
+ .replace(BOT_TOKEN, answers.botToken)
153
160
  .replace(BOT_NAME, answers.botName);
154
161
  }
155
162
  }