create-bot-ts 1.0.5 → 1.0.6
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/index.js +84 -112
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -161,135 +161,107 @@ cp.exec("npm init -y", { cwd: process.cwd() }, () => {
|
|
|
161
161
|
// Synchronize git
|
|
162
162
|
cp.execSync("git init", { cwd: process.cwd() });
|
|
163
163
|
|
|
164
|
-
spinner.update({
|
|
165
|
-
text: "Installing yarn plugins...",
|
|
166
|
-
color: "blue",
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// Install yarn plugins
|
|
170
|
-
cp.execSync("yarn plugin import version", { cwd: process.cwd() });
|
|
171
|
-
cp.execSync("yarn plugin import interactive-tools", {
|
|
172
|
-
cwd: process.cwd(),
|
|
173
|
-
});
|
|
174
|
-
|
|
175
164
|
cp.exec("yarn", { cwd: process.cwd() }, () => {
|
|
165
|
+
spinner.update({
|
|
166
|
+
text: "Adding discord dependencies",
|
|
167
|
+
color: "blue",
|
|
168
|
+
});
|
|
176
169
|
cp.exec(
|
|
177
170
|
"yarn add discord.js bufferutil erlpack zlib-sync utf-8-validate",
|
|
178
171
|
{ cwd: process.cwd() },
|
|
179
172
|
() => {
|
|
180
173
|
spinner.update({
|
|
181
|
-
text: "Adding
|
|
182
|
-
color: "
|
|
174
|
+
text: "Adding necessary devDependencies",
|
|
175
|
+
color: "yellow",
|
|
183
176
|
});
|
|
184
177
|
cp.exec(
|
|
185
|
-
|
|
178
|
+
`yarn add --dev eslint eslint-config-airbnb-base eslint-config-prettier eslint-import-resolver-node eslint-plugin-import eslint-plugin-prettier @typescript-eslint/eslint-plugin @types/node @typescript-eslint/parser husky lint-staged node-notifier prettier ts-node ts-node-dev typescript`,
|
|
186
179
|
{ cwd: process.cwd() },
|
|
187
180
|
() => {
|
|
188
181
|
spinner.update({
|
|
189
|
-
text: "
|
|
190
|
-
color: "
|
|
182
|
+
text: "Setting up husky...",
|
|
183
|
+
color: "cyan",
|
|
184
|
+
});
|
|
185
|
+
cp.execSync("yarn dlx husky-init --yarn2", {
|
|
186
|
+
cwd: process.cwd(),
|
|
187
|
+
});
|
|
188
|
+
spinner.update({
|
|
189
|
+
text: "Setting up sdks...",
|
|
190
|
+
color: "cyan",
|
|
191
191
|
});
|
|
192
|
-
cp.exec(
|
|
193
|
-
`yarn add --dev eslint eslint-config-airbnb-base eslint-config-prettier eslint-import-resolver-node eslint-plugin-import eslint-plugin-prettier @typescript-eslint/eslint-plugin @types/node @typescript-eslint/parser husky lint-staged node-notifier prettier ts-node ts-node-dev typescript`,
|
|
194
|
-
{ cwd: process.cwd() },
|
|
195
|
-
() => {
|
|
196
|
-
spinner.update({
|
|
197
|
-
text: "Setting up husky...",
|
|
198
|
-
color: "cyan",
|
|
199
|
-
});
|
|
200
|
-
cp.execSync("yarn dlx husky-init --yarn2", {
|
|
201
|
-
cwd: process.cwd(),
|
|
202
|
-
});
|
|
203
|
-
spinner.update({
|
|
204
|
-
text: "Setting up sdks...",
|
|
205
|
-
color: "cyan",
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
cp.execSync(
|
|
209
|
-
"yarn dlx @yarnpkg/sdks vscode",
|
|
210
|
-
{
|
|
211
|
-
cwd: process.cwd(),
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
|
|
215
|
-
spinner.update({
|
|
216
|
-
text: "Adding scripts...",
|
|
217
|
-
color: "magenta",
|
|
218
|
-
});
|
|
219
|
-
const package = JSON.parse(
|
|
220
|
-
fs.readFileSync(
|
|
221
|
-
path.join(
|
|
222
|
-
process.cwd(),
|
|
223
|
-
"package.json"
|
|
224
|
-
),
|
|
225
|
-
{ encoding: "utf-8" }
|
|
226
|
-
)
|
|
227
|
-
);
|
|
228
|
-
package.scripts = {
|
|
229
|
-
test: "yarn eslint",
|
|
230
|
-
prod: "ts-node --transpile-only ./src/index.ts",
|
|
231
|
-
dev: "ts-node-dev --respawn --transpile-only --notify --rs ./src/index.ts",
|
|
232
|
-
prettier: "prettier ./src/**/*.ts",
|
|
233
|
-
"prettier:fix":
|
|
234
|
-
"prettier --write ./src/**/*.ts",
|
|
235
|
-
eslint: "eslint ./src/**/*.ts",
|
|
236
|
-
"eslint:fix":
|
|
237
|
-
"eslint --fix ./src/**/*.ts",
|
|
238
|
-
};
|
|
239
|
-
package["lint-staged"] = {
|
|
240
|
-
"./src/**/*.ts": ["eslint --fix"],
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
fs.writeFileSync(
|
|
244
|
-
path.join(
|
|
245
|
-
process.cwd(),
|
|
246
|
-
"package.json"
|
|
247
|
-
),
|
|
248
|
-
JSON.stringify(package, null, 4)
|
|
249
|
-
);
|
|
250
192
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
});
|
|
193
|
+
cp.execSync("yarn dlx @yarnpkg/sdks vscode", {
|
|
194
|
+
cwd: process.cwd(),
|
|
195
|
+
});
|
|
255
196
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
197
|
+
spinner.update({
|
|
198
|
+
text: "Adding scripts...",
|
|
199
|
+
color: "magenta",
|
|
200
|
+
});
|
|
201
|
+
const package = JSON.parse(
|
|
202
|
+
fs.readFileSync(
|
|
203
|
+
path.join(process.cwd(), "package.json"),
|
|
204
|
+
{ encoding: "utf-8" }
|
|
205
|
+
)
|
|
206
|
+
);
|
|
207
|
+
package.scripts = {
|
|
208
|
+
test: "yarn eslint",
|
|
209
|
+
prod: "ts-node --transpile-only ./src/index.ts",
|
|
210
|
+
dev: "ts-node-dev --respawn --transpile-only --notify --rs ./src/index.ts",
|
|
211
|
+
prettier: "prettier ./src/**/*.ts",
|
|
212
|
+
"prettier:fix":
|
|
213
|
+
"prettier --write ./src/**/*.ts",
|
|
214
|
+
eslint: "eslint ./src/**/*.ts",
|
|
215
|
+
"eslint:fix": "eslint --fix ./src/**/*.ts",
|
|
216
|
+
};
|
|
217
|
+
package["lint-staged"] = {
|
|
218
|
+
"./src/**/*.ts": ["eslint --fix"],
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
fs.writeFileSync(
|
|
222
|
+
path.join(process.cwd(), "package.json"),
|
|
223
|
+
JSON.stringify(package, null, 4)
|
|
224
|
+
);
|
|
272
225
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
226
|
+
spinner.update({
|
|
227
|
+
text: "Generating README.md...",
|
|
228
|
+
color: "magenta",
|
|
229
|
+
});
|
|
277
230
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
231
|
+
fs.writeFileSync(
|
|
232
|
+
path.join(process.cwd(), "README.md"),
|
|
233
|
+
outdent`
|
|
234
|
+
# ${package.name}
|
|
235
|
+
|
|
236
|
+
Created with created with [create-bot-ts](https://github.com/MahoMuri/create-bot-ts)
|
|
237
|
+
|
|
238
|
+
Based from [create-ts-pro](https://github.com/Milo123456789/create-ts-pro)
|
|
239
|
+
|
|
240
|
+
Features:
|
|
241
|
+
- Yarn PnP
|
|
242
|
+
- Husky
|
|
243
|
+
- ESlint and prettier
|
|
244
|
+
- TypeScript
|
|
245
|
+
- Version Plugin
|
|
246
|
+
- Upgrade-interactive plugin
|
|
247
|
+
|
|
248
|
+
Next Steps, run:
|
|
249
|
+
\`\`\`sh
|
|
250
|
+
yarn create @eslint/config
|
|
251
|
+
\`\`\`
|
|
252
|
+
|
|
253
|
+
to fully initialize eslint.
|
|
254
|
+
`
|
|
292
255
|
);
|
|
256
|
+
const diff = process.hrtime(time);
|
|
257
|
+
const seconds =
|
|
258
|
+
(diff[0] * NS_PER_SEC + diff[1] * MS_PER_NS) /
|
|
259
|
+
NS_PER_SEC;
|
|
260
|
+
spinner.success({
|
|
261
|
+
text: `Successfully Generated ${
|
|
262
|
+
package.name
|
|
263
|
+
} template in ${seconds.toFixed(3)}s`,
|
|
264
|
+
});
|
|
293
265
|
}
|
|
294
266
|
);
|
|
295
267
|
}
|