File tree Expand file tree Collapse file tree
packages/cli/src/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ export interface Env {
3434 OS_CONTROL_PG_POOL_MAX ?: string ;
3535 TURSO_DATABASE_URL ?: string ;
3636 TURSO_AUTH_TOKEN ?: string ;
37+ // Used by ProjectProvisioning's Turso adapter to create per-project DBs.
38+ TURSO_API_TOKEN ?: string ;
39+ TURSO_ORG_NAME ?: string ;
3740
3841 // — Auth (better-auth) —
3942 AUTH_SECRET ?: string ;
@@ -120,6 +123,8 @@ const FORWARDED_ENV_KEYS: readonly (keyof Env)[] = [
120123 'OS_CONTROL_PG_POOL_MAX' ,
121124 'TURSO_DATABASE_URL' ,
122125 'TURSO_AUTH_TOKEN' ,
126+ 'TURSO_API_TOKEN' ,
127+ 'TURSO_ORG_NAME' ,
123128 // auth
124129 'AUTH_SECRET' ,
125130 'OS_AUTH_SECRET' ,
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ compatibility_flags = ["nodejs_compat"]
4545# rebuild + re-push to ship a new version, then run `wrangler deploy`.
4646[[containers ]]
4747class_name = " CloudContainer"
48- image = " registry.cloudflare.com/2846eb40a60f4738e292b90dcd8cce10/objectstack-cloud:seed-fix-1 "
48+ image = " registry.cloudflare.com/2846eb40a60f4738e292b90dcd8cce10/objectstack-cloud:turso-token-v2 "
4949max_instances = 3
5050instance_type = " standard-1"
5151
Original file line number Diff line number Diff line change @@ -107,9 +107,17 @@ export default class Dev extends Command {
107107 printStep ( 'Starting dev server (local mode)...' ) ;
108108
109109 const projectId = flags [ 'project-id' ] ?? process . env . OS_PROJECT_ID ?? 'proj_local' ;
110+ // NOTE: Do NOT set NODE_ENV='development' here. Oclif's tsx-based
111+ // TypeScript source loader (activated when NODE_ENV is 'test' or
112+ // 'development') currently mis-handles `.json` requires inside
113+ // CommonJS deps (e.g. dotenv's `require('../package.json')` is
114+ // transformed as JS, then JSON.parse fails) — which causes the
115+ // child process to report `command serve not found`. The `--dev`
116+ // flag below already opts the serve command into dev semantics,
117+ // and serve.ts will set NODE_ENV='development' internally before
118+ // any runtime modules are imported.
110119 const localEnv : NodeJS . ProcessEnv = {
111120 ...process . env ,
112- NODE_ENV : 'development' ,
113121 OS_PROJECT_ID : projectId ,
114122 OS_ARTIFACT_PATH : artifactPath ,
115123 ...( flags . database ? { OS_DATABASE_URL : flags . database } : { } ) ,
Original file line number Diff line number Diff line change @@ -100,6 +100,15 @@ export default class Serve extends Command {
100100 async run ( ) : Promise < void > {
101101 const { args, flags } = await this . parse ( Serve ) ;
102102
103+ // When --dev is passed, set NODE_ENV early so any runtime modules
104+ // imported below (and any deps that branch on NODE_ENV at import
105+ // time) see development mode. We deliberately do NOT inherit
106+ // NODE_ENV from the parent `os dev` spawn — see the note in
107+ // commands/dev.ts for why.
108+ if ( flags . dev && ! process . env . NODE_ENV ) {
109+ process . env . NODE_ENV = 'development' ;
110+ }
111+
103112 let port = parseInt ( flags . port ) ;
104113 try {
105114 const availablePort = await getAvailablePort ( port ) ;
You can’t perform that action at this time.
0 commit comments