create-bot-ts 1.0.4 → 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 +83 -99
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -161,123 +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
|
+
});
|
|
192
|
+
|
|
193
|
+
cp.execSync("yarn dlx @yarnpkg/sdks vscode", {
|
|
194
|
+
cwd: process.cwd(),
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
spinner.update({
|
|
198
|
+
text: "Adding scripts...",
|
|
199
|
+
color: "magenta",
|
|
191
200
|
});
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
"package.json"
|
|
212
|
-
),
|
|
213
|
-
{ encoding: "utf-8" }
|
|
214
|
-
)
|
|
215
|
-
);
|
|
216
|
-
package.scripts = {
|
|
217
|
-
test: "yarn eslint",
|
|
218
|
-
prod: "ts-node --transpile-only ./src/index.ts",
|
|
219
|
-
dev: "ts-node-dev --respawn --transpile-only --notify --rs ./src/index.ts",
|
|
220
|
-
prettier: "prettier ./src/**/*.ts",
|
|
221
|
-
"prettier:fix":
|
|
222
|
-
"prettier --write ./src/**/*.ts",
|
|
223
|
-
eslint: "eslint ./src/**/*.ts",
|
|
224
|
-
"eslint:fix":
|
|
225
|
-
"eslint --fix ./src/**/*.ts",
|
|
226
|
-
};
|
|
227
|
-
package["lint-staged"] = {
|
|
228
|
-
"./src/**/*.ts": ["eslint --fix"],
|
|
229
|
-
};
|
|
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
|
+
};
|
|
230
220
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
),
|
|
236
|
-
JSON.stringify(package, null, 4)
|
|
237
|
-
);
|
|
221
|
+
fs.writeFileSync(
|
|
222
|
+
path.join(process.cwd(), "package.json"),
|
|
223
|
+
JSON.stringify(package, null, 4)
|
|
224
|
+
);
|
|
238
225
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
226
|
+
spinner.update({
|
|
227
|
+
text: "Generating README.md...",
|
|
228
|
+
color: "magenta",
|
|
229
|
+
});
|
|
243
230
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
|
260
247
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
248
|
+
Next Steps, run:
|
|
249
|
+
\`\`\`sh
|
|
250
|
+
yarn create @eslint/config
|
|
251
|
+
\`\`\`
|
|
265
252
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
);
|
|
269
|
-
const diff = process.hrtime(time);
|
|
270
|
-
const seconds =
|
|
271
|
-
(diff[0] * NS_PER_SEC +
|
|
272
|
-
diff[1] * MS_PER_NS) /
|
|
273
|
-
NS_PER_SEC;
|
|
274
|
-
spinner.success({
|
|
275
|
-
text: `Sucessfully Generated ${
|
|
276
|
-
package.name
|
|
277
|
-
} template in ${seconds.toFixed(3)}s`,
|
|
278
|
-
});
|
|
279
|
-
}
|
|
253
|
+
to fully initialize eslint.
|
|
254
|
+
`
|
|
280
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
|
+
});
|
|
281
265
|
}
|
|
282
266
|
);
|
|
283
267
|
}
|