@wolfstar/create-http-framework 2.2.1-next-20260903210435 → 2.3.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/dist/index.js CHANGED
@@ -83,7 +83,8 @@ async function fetchDependencyVersions(selections) {
83
83
  "discord-api-types",
84
84
  "@wolfstar/env-utilities",
85
85
  "@wolfstar/start-banner",
86
- "gradient-string"
86
+ "gradient-string",
87
+ "@wolfstar/cli"
87
88
  ]);
88
89
  if (selections.i18n) names.add("@wolfstar/plugin-i18next").add("@wolfstar/i18next-type-generator");
89
90
  if (selections.testing) names.add("vitest").add("@wolfstar/http-framework-test-utils");
@@ -91,11 +92,9 @@ async function fetchDependencyVersions(selections) {
91
92
  names.add("@types/node");
92
93
  switch (selections.buildTool) {
93
94
  case "tsc6":
94
- names.add("typescript").add("tsc-watch");
95
- break;
96
- case "tsc7":
97
- names.add("tsc-watch");
95
+ names.add("typescript");
98
96
  break;
97
+ case "tsc7": break;
99
98
  case "tsdown": names.add("tsdown").add("typescript");
100
99
  }
101
100
  }
@@ -185,30 +184,10 @@ function json(value) {
185
184
  return `${JSON.stringify(value, null, " ")}\n`;
186
185
  }
187
186
  function buildScripts(ctx) {
188
- const { packageManager: pm, buildTool } = ctx;
189
- const start = "node dist/main.js";
190
- let scripts;
191
- if (ctx.language === "js") scripts = {
192
- start: "node src/main.js",
193
- dev: "node --watch src/main.js"
194
- };
195
- else if (buildTool === "tsdown") scripts = {
196
- build: "tsdown",
197
- dev: getRunScript(pm, "build", ["--onSuccess", getRunScript(pm, "start")]),
198
- watch: getRunScript(pm, "build", ["--watch"]),
199
- "watch:start": getRunScript(pm, "build", [
200
- "--watch",
201
- "--onSuccess",
202
- getRunScript(pm, "start")
203
- ]),
204
- start
205
- };
206
- else scripts = {
207
- build: "tsc -b src",
208
- dev: `${getRunScript(pm, "build")} && ${getRunScript(pm, "start")}`,
209
- watch: "tsc -b src -w",
210
- "watch:start": `tsc-watch -b src --onSuccess "${getRunScript(pm, "start")}"`,
211
- start
187
+ const scripts = {
188
+ dev: "stars dev",
189
+ ...ctx.language === "js" ? {} : { build: "stars build" },
190
+ start: ctx.language === "js" ? "node src/main.js" : "node dist/main.js"
212
191
  };
213
192
  if (ctx.linter === "oxlint") {
214
193
  scripts["lint"] = "oxlint src";
@@ -224,7 +203,7 @@ function buildScripts(ctx) {
224
203
  scripts["format"] = "prettier --write src";
225
204
  scripts["format:check"] = "prettier --check src";
226
205
  }
227
- if (ctx.i18n) scripts["generate:i18n"] = "i18next-type-generator ./src/locales/en-US/ ./src/@types/i18next.d.ts";
206
+ if (ctx.i18n) scripts["generate:i18n"] = "stars codegen";
228
207
  if (ctx.testing) scripts["test"] = "vitest run";
229
208
  return scripts;
230
209
  }
@@ -243,17 +222,15 @@ function buildDependencies(ctx) {
243
222
  }
244
223
  function buildDevDependencies(ctx) {
245
224
  const v = ctx.versions;
246
- const dev = {};
225
+ const dev = { "@wolfstar/cli": caret(v["@wolfstar/cli"]) };
247
226
  if (ctx.language === "ts") {
248
227
  dev["@types/node"] = caret(v["@types/node"]);
249
228
  switch (ctx.buildTool) {
250
229
  case "tsc6":
251
230
  dev["typescript"] = caret(v["typescript"]);
252
- dev["tsc-watch"] = caret(v["tsc-watch"]);
253
231
  break;
254
232
  case "tsc7":
255
233
  dev["typescript"] = v["typescript"];
256
- dev["tsc-watch"] = caret(v["tsc-watch"]);
257
234
  break;
258
235
  case "tsdown":
259
236
  dev["tsdown"] = caret(v["tsdown"]);
@@ -352,6 +329,21 @@ function writeBuildConfig(targetDir, ctx) {
352
329
  ].join("\n");
353
330
  writeFile(join(targetDir, "tsdown.config.ts"), content);
354
331
  }
332
+ /** Writes the `stars.config.*` file read by the `stars` CLI (`dev`, `build`, `info`, `codegen` scripts). */
333
+ function writeStarsConfig(targetDir, ctx) {
334
+ const isJs = ctx.language === "js";
335
+ const build = isJs ? "{ tool: 'none' }" : ctx.buildTool === "tsdown" ? "{ tool: 'tsdown' }" : "{ tool: 'tsc', tsconfig: 'src/tsconfig.json' }";
336
+ const content = [
337
+ "import { defineConfig } from '@wolfstar/http-framework/config';",
338
+ "",
339
+ "export default defineConfig({",
340
+ `\tentry: 'src/main.${isJs ? "js" : "ts"}',`,
341
+ `\tbuild: ${build}`,
342
+ "});",
343
+ ""
344
+ ].join("\n");
345
+ writeFile(join(targetDir, isJs ? "stars.config.js" : "stars.config.ts"), content);
346
+ }
355
347
  function writeLinterConfig(targetDir, ctx) {
356
348
  if (ctx.linter === "oxlint") writeFile(join(targetDir, ".oxlintrc.json"), json({
357
349
  $schema: "./node_modules/oxlint/configuration_schema.json",
@@ -407,6 +399,7 @@ function writeProjectFiles(targetDir, ctx) {
407
399
  writeFile(join(targetDir, "package.json"), packageJson(ctx));
408
400
  writeTsconfig(targetDir, ctx);
409
401
  writeBuildConfig(targetDir, ctx);
402
+ writeStarsConfig(targetDir, ctx);
410
403
  writeLinterConfig(targetDir, ctx);
411
404
  writeFormatterConfig(targetDir, ctx);
412
405
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolfstar/create-http-framework",
3
- "version": "2.2.1-next-20260903210435",
3
+ "version": "2.3.0",
4
4
  "description": "Create a new WolfStar HTTP Framework bot project",
5
5
  "keywords": [
6
6
  "cli",
@@ -13,9 +13,12 @@ A Discord bot built with [`@wolfstar/http-framework`](https://www.npmjs.com/pack
13
13
 
14
14
  ## Scripts
15
15
 
16
- - `npm run dev` — run the bot in watch mode.
16
+ The `dev` and `build` scripts are powered by the [`stars`](https://www.npmjs.com/package/@wolfstar/cli) CLI and read the `stars.config` file at the project root.
17
+
18
+ - `npm run dev` — build, run and restart the bot on changes, with an interactive terminal UI (`npm run dev -- --no-tui` for plain logs).
17
19
  - `npm run build` — compile the project (TypeScript projects only).
18
20
  - `npm start` — run the bot.
21
+ - `npx stars info` — print the resolved configuration.
19
22
  {{#if testing}}
20
23
  - `npm test` — run the test suite with vitest.
21
24
  {{/if}}