@ranger1/dx 0.1.53 → 0.1.54

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.
@@ -110,7 +110,7 @@ function appendTargetArgs(baseArgs, { cwd, orgId, projectId, explicitEnvArgs = [
110
110
  return args
111
111
  }
112
112
 
113
- function collectExplicitVercelEnvArgs(sourceEnv = {}) {
113
+ function collectExplicitVercelEnvEntries(sourceEnv = {}) {
114
114
  const includeKeys = new Set(EXPLICIT_ENV_VARS)
115
115
 
116
116
  Object.keys(sourceEnv).forEach(name => {
@@ -129,7 +129,12 @@ function collectExplicitVercelEnvArgs(sourceEnv = {}) {
129
129
  )
130
130
  })
131
131
  .sort()
132
- .flatMap(name => ['--env', `${name}=${String(sourceEnv[name])}`])
132
+ .map(name => `${name}=${String(sourceEnv[name])}`)
133
+ }
134
+
135
+ function withEnvFlag(entries, flag) {
136
+ if (!Array.isArray(entries) || entries.length === 0) return []
137
+ return entries.flatMap(entry => [flag, entry])
133
138
  }
134
139
 
135
140
  function maskIdentifier(value) {
@@ -368,7 +373,7 @@ export async function deployToVercel(target, options = {}) {
368
373
  `[deploy-context] env=${environment} target=${t} strict=${strictContext ? 1 : 0} org=${maskIdentifier(orgId)} project=${maskIdentifier(projectId)} linked=${linkedContext.exists ? 'yes' : 'no'} token=env`,
369
374
  )
370
375
 
371
- const explicitEnvArgs = collectExplicitVercelEnvArgs({
376
+ const explicitEnvEntries = collectExplicitVercelEnvEntries({
372
377
  ...process.env,
373
378
  APP_ENV: buildEnv,
374
379
  NODE_ENV: envManager.mapAppEnvToNodeEnv(environment),
@@ -376,6 +381,9 @@ export async function deployToVercel(target, options = {}) {
376
381
  VERCEL_PROJECT_ID: projectId,
377
382
  })
378
383
 
384
+ const buildEnvArgs = withEnvFlag(explicitEnvEntries, '--build-env')
385
+ const deployEnvArgs = withEnvFlag(explicitEnvEntries, '--env')
386
+
379
387
  const envVars = {
380
388
  ...process.env,
381
389
  VERCEL_PROJECT_ID: projectId,
@@ -415,7 +423,7 @@ export async function deployToVercel(target, options = {}) {
415
423
  cwd: projectRoot,
416
424
  orgId,
417
425
  projectId,
418
- explicitEnvArgs,
426
+ explicitEnvArgs: buildEnvArgs,
419
427
  },
420
428
  )
421
429
 
@@ -435,7 +443,7 @@ export async function deployToVercel(target, options = {}) {
435
443
  cwd: projectRoot,
436
444
  orgId,
437
445
  projectId,
438
- explicitEnvArgs,
446
+ explicitEnvArgs: deployEnvArgs,
439
447
  },
440
448
  )
441
449
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ranger1/dx",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {