@wolfstar/create-http-framework 2.6.1 → 2.7.0-next-20261001111011

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
@@ -382,11 +382,14 @@ function writeTsconfig(targetDir, ctx) {
382
382
  }
383
383
  /**
384
384
  * Writes the `stars.config.*` file read by the `stars` CLI (`dev`, `build`, `info`, `codegen` scripts). Conventional
385
- * JavaScript and tsdown projects need no options; an explicit tsc, Vite or Nitro selection is the only generated override.
385
+ * tsdown projects need no options; an explicit tsc, Vite or Nitro selection is the only generated build override.
386
+ * JavaScript and tsc projects also turn the automatic `env` registration off: their output never passes through the
387
+ * entry transform that registers it, so `src/lib/setup` loads the environment itself (see `registersEnv` in the
388
+ * template processor).
386
389
  */
387
390
  function writeStarsConfig(targetDir, ctx) {
388
391
  const isJs = ctx.language === "js";
389
- let options = !isJs && (ctx.buildTool === "tsc6" || ctx.buildTool === "tsc7") ? "{ build: { tool: 'tsc' } }" : "{}";
392
+ let options = !isJs && (ctx.buildTool === "tsc6" || ctx.buildTool === "tsc7") ? "{ build: { tool: 'tsc' }, env: false }" : isJs ? "{ env: false }" : "{}";
390
393
  if (!isJs && isViteBuild(ctx.buildTool)) options = `{ build: { tool: 'vite' }, experimental: { enableVite: true${isNitroBuild(ctx.buildTool) ? ", enableNitro: true, nitro: { preset: 'node-server' }" : ""} } }`;
391
394
  const content = [
392
395
  "import { defineConfig } from '@wolfstar/http-framework/config';",
@@ -515,6 +518,7 @@ function toRenderContext(context) {
515
518
  ...context,
516
519
  vite: typescript && isViteBuild(context.buildTool),
517
520
  nitro: typescript && isNitroBuild(context.buildTool),
521
+ registersEnv: Boolean(context.autoEnv) && typescript && (context.buildTool === "tsdown" || context.buildTool === "vite"),
518
522
  commands
519
523
  };
520
524
  }
@@ -609,7 +613,8 @@ function buildLegacyVariantMatchers(absoluteSource, context) {
609
613
  gateway: false,
610
614
  cache: false,
611
615
  redis: false,
612
- sharder: false
616
+ sharder: false,
617
+ autoEnv: false
613
618
  };
614
619
  return [false, true].map((i18n) => {
615
620
  const rendered = renderSource(absoluteSource, {
@@ -1162,7 +1167,8 @@ async function main() {
1162
1167
  cache: wantsCache,
1163
1168
  redis: wantsRedis,
1164
1169
  sharder: wantsSharder,
1165
- buildTool
1170
+ buildTool,
1171
+ autoEnv: true
1166
1172
  });
1167
1173
  writeProjectFiles(targetDir, {
1168
1174
  name: projectName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolfstar/create-http-framework",
3
- "version": "2.6.1",
3
+ "version": "2.7.0-next-20261001111011",
4
4
  "description": "Create a new WolfStar HTTP Framework bot project",
5
5
  "keywords": [
6
6
  "cli",
@@ -1,5 +1,11 @@
1
+ {{#if registersEnv}}
2
+ export function setup() {
3
+ // `stars` loads the environment (`env` in stars.config.ts) before any module of the bot runs.
4
+ }
5
+ {{else}}
1
6
  import { setup as envRun } from '@wolfstar/env-utilities';
2
7
 
3
8
  export function setup() {
4
9
  envRun();
5
10
  }
11
+ {{/if}}