@wolfstar/create-http-framework 2.3.0 → 2.4.0-next-20260905171250

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
@@ -279,6 +279,16 @@ const sharedCompilerOptions = {
279
279
  experimentalDecorators: true,
280
280
  emitDecoratorMetadata: true
281
281
  };
282
+ /**
283
+ * The `paths` that make `stars`' built-in aliases type-check. Only the `tsdown` build resolves them, so only its
284
+ * tsconfig declares them: `tsc` emits imports untouched and would leave `~/lib/…` in the output.
285
+ */
286
+ const STARS_ALIAS_PATHS = {
287
+ "~/*": ["./src/*"],
288
+ "@/*": ["./src/*"],
289
+ "~~/*": ["./*"],
290
+ "@@/*": ["./*"]
291
+ };
282
292
  /** Writes the tsconfig(s). The tsc branches use a composite build so `tsc -b src` resolves `src/tsconfig.json`. */
283
293
  function writeTsconfig(targetDir, ctx) {
284
294
  if (ctx.language === "js") return;
@@ -287,9 +297,10 @@ function writeTsconfig(targetDir, ctx) {
287
297
  compilerOptions: {
288
298
  ...sharedCompilerOptions,
289
299
  outDir: "./dist",
290
- rootDir: "./src"
300
+ rootDir: "./src",
301
+ paths: STARS_ALIAS_PATHS
291
302
  },
292
- include: ["src/**/*.ts"],
303
+ include: ["src/**/*.ts", ".stars/*.d.ts"],
293
304
  exclude: ["node_modules", "dist"]
294
305
  }));
295
306
  return;
@@ -309,36 +320,23 @@ function writeTsconfig(targetDir, ctx) {
309
320
  include: ["**/*.ts"]
310
321
  }));
311
322
  }
312
- function writeBuildConfig(targetDir, ctx) {
313
- if (ctx.language === "js" || ctx.buildTool !== "tsdown") return;
314
- const content = [
315
- "import { defineConfig } from 'tsdown';",
316
- "",
317
- "export default defineConfig({",
318
- " entry: ['src/**/*.ts'],",
319
- " format: ['esm'],",
320
- " target: 'node20',",
321
- " // Mirror the src/ structure so the framework can load command pieces from dist/commands at runtime.",
322
- " unbundle: true,",
323
- " // Emit dist/main.js so the shared `start` script (node dist/main.js) works.",
324
- " outExtensions: () => ({ js: '.js' }),",
325
- " clean: true,",
326
- " sourcemap: true",
327
- "});",
328
- ""
329
- ].join("\n");
330
- writeFile(join(targetDir, "tsdown.config.ts"), content);
331
- }
332
- /** Writes the `stars.config.*` file read by the `stars` CLI (`dev`, `build`, `info`, `codegen` scripts). */
323
+ /**
324
+ * Writes the `stars.config.*` file read by the `stars` CLI (`dev`, `build`, `info`, `codegen` scripts). It carries
325
+ * the build too: `tsdown` projects are configured here rather than in a `tsdown.config.ts` of their own, which is
326
+ * what `future.compatibilityVersion: 4` means for a generated project.
327
+ */
333
328
  function writeStarsConfig(targetDir, ctx) {
334
329
  const isJs = ctx.language === "js";
335
- const build = isJs ? "{ tool: 'none' }" : ctx.buildTool === "tsdown" ? "{ tool: 'tsdown' }" : "{ tool: 'tsc', tsconfig: 'src/tsconfig.json' }";
330
+ const isTsdown = !isJs && ctx.buildTool === "tsdown";
336
331
  const content = [
337
332
  "import { defineConfig } from '@wolfstar/http-framework/config';",
338
333
  "",
339
334
  "export default defineConfig({",
340
335
  `\tentry: 'src/main.${isJs ? "js" : "ts"}',`,
341
- `\tbuild: ${build}`,
336
+ `\tbuild: ${isJs ? "{ tool: 'none' }" : isTsdown ? "{ tool: 'tsdown' }" : "{ tool: 'tsc', tsconfig: 'src/tsconfig.json' }"},`,
337
+ " // The next major's defaults: auto imports wired into the build, and `tsdown` configured from this file.",
338
+ " future: { compatibilityVersion: 4 }",
339
+ ...isTsdown ? [" // The build needs nothing else. Add a `tsdown` block for what the defaults cannot know,", " // such as a plugin that copies assets into dist/."] : [],
342
340
  "});",
343
341
  ""
344
342
  ].join("\n");
@@ -398,7 +396,6 @@ function writeFormatterConfig(targetDir, ctx) {
398
396
  function writeProjectFiles(targetDir, ctx) {
399
397
  writeFile(join(targetDir, "package.json"), packageJson(ctx));
400
398
  writeTsconfig(targetDir, ctx);
401
- writeBuildConfig(targetDir, ctx);
402
399
  writeStarsConfig(targetDir, ctx);
403
400
  writeLinterConfig(targetDir, ctx);
404
401
  writeFormatterConfig(targetDir, ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolfstar/create-http-framework",
3
- "version": "2.3.0",
3
+ "version": "2.4.0-next-20260905171250",
4
4
  "description": "Create a new WolfStar HTTP Framework bot project",
5
5
  "keywords": [
6
6
  "cli",
@@ -1,5 +1,6 @@
1
1
  node_modules/
2
2
  dist/
3
+ .stars/
3
4
  .env
4
5
  *.js.map
5
6
  .create-http-framework.json