@sanity/cli 3.69.0 → 3.70.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli",
3
- "version": "3.69.0",
3
+ "version": "3.70.0",
4
4
  "description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
5
5
  "keywords": [
6
6
  "sanity",
@@ -57,17 +57,17 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@babel/traverse": "^7.23.5",
60
- "@sanity/client": "^6.24.1",
61
- "@sanity/codegen": "3.69.0",
60
+ "@sanity/client": "^6.24.3",
61
+ "@sanity/codegen": "3.70.0",
62
62
  "@sanity/telemetry": "^0.7.7",
63
- "@sanity/template-validator": "^2.0.0",
64
- "@sanity/util": "3.69.0",
63
+ "@sanity/template-validator": "^2.3.2",
64
+ "@sanity/util": "3.70.0",
65
65
  "chalk": "^4.1.2",
66
66
  "debug": "^4.3.4",
67
67
  "decompress": "^4.2.0",
68
68
  "esbuild": "0.21.5",
69
69
  "esbuild-register": "^3.5.0",
70
- "get-it": "^8.6.5",
70
+ "get-it": "^8.6.6",
71
71
  "groq-js": "^1.14.2",
72
72
  "pkg-dir": "^5.0.0",
73
73
  "prettier": "^3.3.0",
@@ -75,13 +75,13 @@
75
75
  "validate-npm-package-name": "^3.0.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@repo/package.config": "3.69.0",
79
- "@repo/test-config": "3.69.0",
78
+ "@repo/package.config": "3.70.0",
79
+ "@repo/test-config": "3.70.0",
80
80
  "@rexxars/gitconfiglocal": "^3.0.1",
81
81
  "@rollup/plugin-node-resolve": "^15.2.3",
82
82
  "@sanity/eslint-config-studio": "^4.0.0",
83
83
  "@sanity/generate-help-url": "^3.0.0",
84
- "@sanity/types": "3.69.0",
84
+ "@sanity/types": "3.70.0",
85
85
  "@types/babel__traverse": "^7.20.5",
86
86
  "@types/configstore": "^5.0.1",
87
87
  "@types/cpx": "^1.5.2",
@@ -133,5 +133,5 @@
133
133
  "engines": {
134
134
  "node": ">=18"
135
135
  },
136
- "gitHead": "55aff5d4304c8dd5f32aadd54d86718afe2fc63b"
136
+ "gitHead": "53767836c1ed9cd28169f582bba4b958e99f6285"
137
137
  }
@@ -217,9 +217,11 @@ export async function applyEnvVariables(
217
217
  await access(join(root, file))
218
218
  return file
219
219
  }),
220
- ).catch(() => {
221
- throw new Error('Could not find .env.template, .env.example or .env.local.example file')
222
- })
220
+ ).catch(() => undefined)
221
+
222
+ if (!templatePath) {
223
+ return // No template .env file found, skip
224
+ }
223
225
 
224
226
  try {
225
227
  const templateContent = await readFile(join(root, templatePath), 'utf8')
@@ -231,15 +233,17 @@ export async function applyEnvVariables(
231
233
  value: string,
232
234
  useQuotes: boolean,
233
235
  ) => {
234
- const pattern = varRegex instanceof RegExp ? varRegex : new RegExp(`${varRegex}=.*$`, 'm')
235
- const match = content.match(pattern)
236
- if (!match) return content
237
-
238
- const varName = match[0].split('=')[0]
239
- return content.replace(
240
- new RegExp(`${varName}=.*$`, 'm'),
241
- `${varName}=${useQuotes ? `"${value}"` : value}`,
242
- )
236
+ const varPattern = typeof varRegex === 'string' ? varRegex : varRegex.source
237
+ const pattern = new RegExp(`.*${varPattern}=.*$`, 'gm')
238
+ const matches = content.matchAll(pattern)
239
+ return Array.from(matches).reduce((updatedContent, match) => {
240
+ if (!match[0]) return updatedContent
241
+ const varName = match[0].split('=')[0].trim()
242
+ return updatedContent.replace(
243
+ new RegExp(`${varName}=.*$`, 'gm'),
244
+ `${varName}=${useQuotes ? `"${value}"` : value}`,
245
+ )
246
+ }, content)
243
247
  }
244
248
 
245
249
  let envContent = templateContent