create-trokky 0.1.3 → 0.1.4

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/config.js CHANGED
@@ -22,7 +22,8 @@ export function withDefaults(input) {
22
22
  images: pick('images'),
23
23
  parts: pick('parts'),
24
24
  content: pick('content'),
25
- trokkyVersion: input.trokkyVersion ?? '^3.4.1',
25
+ // 3.6: TrokkyCore takes `env`, which the Workers entry passes
26
+ trokkyVersion: input.trokkyVersion ?? '^3.6.0',
26
27
  };
27
28
  }
28
29
  export const hasStudio = (config) => config.parts !== 'api';
package/dist/emit.js CHANGED
@@ -196,6 +196,8 @@ export interface TrokkyEnv {
196
196
  MEDIA: R2Bucket
197
197
  ${config.images === 'cloudflare-images' ? ' IMAGES: ImagesBinding\n' : ''}${hasStudio(config) || config.content !== 'blank' ? ' ASSETS: { fetch(request: Request): Promise<Response> }\n' : ''} TROKKY_JWT_SECRET?: string
198
198
  TROKKY_CLAIM_SECRET?: string
199
+ /** 'development' in .dev.vars for \`wrangler dev\`; unset when deployed */
200
+ TROKKY_ENV?: string
199
201
  }
200
202
 
201
203
  export const API_PATH = '/api'
@@ -226,6 +228,9 @@ ${mediaConfig} },
226
228
  {
227
229
  jwtSecret: env.TROKKY_JWT_SECRET,
228
230
  claimSecret: env.TROKKY_CLAIM_SECRET,
231
+ // A Worker has no NODE_ENV: say production unless .dev.vars says otherwise, so a deploy
232
+ // without a real signing key refuses to start instead of signing with a random one
233
+ env: env.TROKKY_ENV === 'development' ? 'development' : 'production',
229
234
  },
230
235
  )
231
236
  // Creates the image processor; nothing serves images without it.
@@ -451,6 +456,9 @@ export function envExample(config) {
451
456
  for (const secret of secrets) {
452
457
  lines.push(...comment(secret.why), `${secret.name}=`, '');
453
458
  }
459
+ if (edge) {
460
+ lines.push(...comment('Local development only: keep this line in .dev.vars and never set it on the deployed'), ...comment('Worker, which must run with the production checks.'), 'TROKKY_ENV=development', '');
461
+ }
454
462
  if (config.data === 'postgres-data')
455
463
  lines.push('# Postgres connection string.', 'DATABASE_URL=', '');
456
464
  // Only where something is actually written to disk. A Worker has none, and with s3-media the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-trokky",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Compose a Trokky project: pick the target, adapters and parts you want.",
5
5
  "type": "module",
6
6
  "license": "MIT",