@wolfstar/create-http-framework 2.2.0 → 2.3.0-next-20260904111115

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,4 +1,19 @@
1
- # `@wolfstar/create-http-framework`
1
+ <div align="center">
2
+ <picture>
3
+ <img src="https://cdn.wolfstar.rocks/assets/stars-components/wordmark.webp" alt="Stars Components" width="440" />
4
+ </picture>
5
+
6
+ # @wolfstar/create-http-framework
7
+
8
+ **Scaffold a new <a href="https://github.com/wolfstar-project/stars-components/tree/main/packages/http-framework">@wolfstar/http-framework</a> bot in seconds.**
9
+
10
+ [![version](https://npmx.dev/api/registry/badge/version/@wolfstar/create-http-framework)](https://npmx.dev/package/@wolfstar/create-http-framework)
11
+ [![downloads](https://npmx.dev/api/registry/badge/downloads/@wolfstar/create-http-framework)](https://npmx.dev/package/@wolfstar/create-http-framework)
12
+ [![license](https://img.shields.io/github/license/wolfstar-project/stars-components?style=flat-square&color=informational)](https://github.com/wolfstar-project/stars-components/blob/main/LICENSE)
13
+
14
+ </div>
15
+
16
+ ## Description
2
17
 
3
18
  A CLI scaffolding tool for creating new [WolfStar HTTP Framework](https://github.com/wolfstar-project/stars-components/tree/main/packages/http-framework) bot projects.
4
19
 
package/dist/index.js CHANGED
@@ -82,9 +82,9 @@ async function fetchDependencyVersions(selections) {
82
82
  "@sapphire/pieces",
83
83
  "discord-api-types",
84
84
  "@wolfstar/env-utilities",
85
- "@wolfstar/logger",
86
85
  "@wolfstar/start-banner",
87
- "gradient-string"
86
+ "gradient-string",
87
+ "@wolfstar/cli"
88
88
  ]);
89
89
  if (selections.i18n) names.add("@wolfstar/plugin-i18next").add("@wolfstar/i18next-type-generator");
90
90
  if (selections.testing) names.add("vitest").add("@wolfstar/http-framework-test-utils");
@@ -92,11 +92,9 @@ async function fetchDependencyVersions(selections) {
92
92
  names.add("@types/node");
93
93
  switch (selections.buildTool) {
94
94
  case "tsc6":
95
- names.add("typescript").add("tsc-watch");
96
- break;
97
- case "tsc7":
98
- names.add("tsc-watch");
95
+ names.add("typescript");
99
96
  break;
97
+ case "tsc7": break;
100
98
  case "tsdown": names.add("tsdown").add("typescript");
101
99
  }
102
100
  }
@@ -186,30 +184,10 @@ function json(value) {
186
184
  return `${JSON.stringify(value, null, " ")}\n`;
187
185
  }
188
186
  function buildScripts(ctx) {
189
- const { packageManager: pm, buildTool } = ctx;
190
- const start = "node dist/main.js";
191
- let scripts;
192
- if (ctx.language === "js") scripts = {
193
- start: "node src/main.js",
194
- dev: "node --watch src/main.js"
195
- };
196
- else if (buildTool === "tsdown") scripts = {
197
- build: "tsdown",
198
- dev: getRunScript(pm, "build", ["--onSuccess", getRunScript(pm, "start")]),
199
- watch: getRunScript(pm, "build", ["--watch"]),
200
- "watch:start": getRunScript(pm, "build", [
201
- "--watch",
202
- "--onSuccess",
203
- getRunScript(pm, "start")
204
- ]),
205
- start
206
- };
207
- else scripts = {
208
- build: "tsc -b src",
209
- dev: `${getRunScript(pm, "build")} && ${getRunScript(pm, "start")}`,
210
- watch: "tsc -b src -w",
211
- "watch:start": `tsc-watch -b src --onSuccess "${getRunScript(pm, "start")}"`,
212
- 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"
213
191
  };
214
192
  if (ctx.linter === "oxlint") {
215
193
  scripts["lint"] = "oxlint src";
@@ -225,7 +203,7 @@ function buildScripts(ctx) {
225
203
  scripts["format"] = "prettier --write src";
226
204
  scripts["format:check"] = "prettier --check src";
227
205
  }
228
- 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";
229
207
  if (ctx.testing) scripts["test"] = "vitest run";
230
208
  return scripts;
231
209
  }
@@ -236,7 +214,6 @@ function buildDependencies(ctx) {
236
214
  "@sapphire/pieces": caret(v["@sapphire/pieces"]),
237
215
  "discord-api-types": caret(v["discord-api-types"]),
238
216
  "@wolfstar/env-utilities": caret(v["@wolfstar/env-utilities"]),
239
- "@wolfstar/logger": caret(v["@wolfstar/logger"]),
240
217
  "@wolfstar/start-banner": caret(v["@wolfstar/start-banner"]),
241
218
  "gradient-string": caret(v["gradient-string"])
242
219
  };
@@ -245,17 +222,15 @@ function buildDependencies(ctx) {
245
222
  }
246
223
  function buildDevDependencies(ctx) {
247
224
  const v = ctx.versions;
248
- const dev = {};
225
+ const dev = { "@wolfstar/cli": caret(v["@wolfstar/cli"]) };
249
226
  if (ctx.language === "ts") {
250
227
  dev["@types/node"] = caret(v["@types/node"]);
251
228
  switch (ctx.buildTool) {
252
229
  case "tsc6":
253
230
  dev["typescript"] = caret(v["typescript"]);
254
- dev["tsc-watch"] = caret(v["tsc-watch"]);
255
231
  break;
256
232
  case "tsc7":
257
233
  dev["typescript"] = v["typescript"];
258
- dev["tsc-watch"] = caret(v["tsc-watch"]);
259
234
  break;
260
235
  case "tsdown":
261
236
  dev["tsdown"] = caret(v["tsdown"]);
@@ -354,6 +329,21 @@ function writeBuildConfig(targetDir, ctx) {
354
329
  ].join("\n");
355
330
  writeFile(join(targetDir, "tsdown.config.ts"), content);
356
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
+ }
357
347
  function writeLinterConfig(targetDir, ctx) {
358
348
  if (ctx.linter === "oxlint") writeFile(join(targetDir, ".oxlintrc.json"), json({
359
349
  $schema: "./node_modules/oxlint/configuration_schema.json",
@@ -409,6 +399,7 @@ function writeProjectFiles(targetDir, ctx) {
409
399
  writeFile(join(targetDir, "package.json"), packageJson(ctx));
410
400
  writeTsconfig(targetDir, ctx);
411
401
  writeBuildConfig(targetDir, ctx);
402
+ writeStarsConfig(targetDir, ctx);
412
403
  writeLinterConfig(targetDir, ctx);
413
404
  writeFormatterConfig(targetDir, ctx);
414
405
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolfstar/create-http-framework",
3
- "version": "2.2.0",
3
+ "version": "2.3.0-next-20260904111115",
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}}
@@ -1,6 +1,4 @@
1
1
  import { setup as envRun } from '@wolfstar/env-utilities';
2
- /* oxlint-disable import/first -- side-effect setup modules must run after env load preparation */
3
- import './logger.js';
4
2
 
5
3
  export function setup() {
6
4
  // From src/lib/setup → .env at the project root
@@ -1,6 +1,4 @@
1
1
  import { setup as envRun } from '@wolfstar/env-utilities';
2
- /* oxlint-disable import/first -- side-effect setup modules must run after env load preparation */
3
- import './logger.js';
4
2
 
5
3
  export function setup() {
6
4
  // From dist/lib/setup → .env at the project root
@@ -1,4 +0,0 @@
1
- import { container } from '@wolfstar/http-framework';
2
- import { Logger } from '@wolfstar/logger';
3
-
4
- container.logger = new Logger();
@@ -1,10 +0,0 @@
1
- import { container } from '@wolfstar/http-framework';
2
- import { Logger } from '@wolfstar/logger';
3
-
4
- container.logger = new Logger();
5
-
6
- declare module '@sapphire/pieces' {
7
- interface Container {
8
- logger: Logger;
9
- }
10
- }