@take-out/scripts 0.0.73 → 0.0.74
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 +2 -2
- package/src/env-update.ts +14 -2
- package/src/release.ts +13 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@take-out/scripts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/run.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@take-out/helpers": "0.0.
|
|
31
|
+
"@take-out/helpers": "0.0.73"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"vxrn": "1.4.10-1770207233041"
|
package/src/env-update.ts
CHANGED
|
@@ -137,9 +137,21 @@ function updateDockerCompose() {
|
|
|
137
137
|
return
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
// detect indent from the marker line
|
|
141
|
+
const markerMatch = dockerCompose.match(new RegExp(`^(\\s*)${yamlStartMarker}`, 'm'))
|
|
142
|
+
const indent = markerMatch?.[1] || ' '
|
|
143
|
+
|
|
144
|
+
// detect format: if markers are under an x- anchor block, use map syntax (KEY: val)
|
|
145
|
+
// otherwise use list syntax (- KEY=val)
|
|
146
|
+
const beforeMarker = dockerCompose.slice(0, dockerCompose.indexOf(yamlStartMarker))
|
|
147
|
+
const isMap = /x-[\w-]+:.*&[\w-]+/s.test(beforeMarker)
|
|
148
|
+
|
|
141
149
|
const envLines = Object.keys(envVars)
|
|
142
|
-
.map((key) =>
|
|
150
|
+
.map((key) =>
|
|
151
|
+
isMap
|
|
152
|
+
? `${indent}${key}: \${${key}:-}`
|
|
153
|
+
: `${indent}- ${key}=\${${key}:-}`
|
|
154
|
+
)
|
|
143
155
|
.join('\n')
|
|
144
156
|
|
|
145
157
|
const newDockerCompose = replaceYamlSection(dockerCompose, envLines, { indent })
|
package/src/release.ts
CHANGED
|
@@ -317,7 +317,9 @@ async function syncOnZeroIn() {
|
|
|
317
317
|
return
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
const newCommits = commits
|
|
320
|
+
const newCommits = commits
|
|
321
|
+
.slice(0, lastSyncIdx)
|
|
322
|
+
.filter((c) => !c.match(/^v\d+\.\d+\.\d+/))
|
|
321
323
|
if (!newCommits.length) {
|
|
322
324
|
console.info(' ← on-zero: no new github commits to sync in')
|
|
323
325
|
return
|
|
@@ -331,7 +333,9 @@ async function syncOnZeroIn() {
|
|
|
331
333
|
return
|
|
332
334
|
}
|
|
333
335
|
|
|
334
|
-
await fs.copy(join(onZeroGithub, 'src'), join(onZeroTakeout, 'src'), {
|
|
336
|
+
await fs.copy(join(onZeroGithub, 'src'), join(onZeroTakeout, 'src'), {
|
|
337
|
+
overwrite: true,
|
|
338
|
+
})
|
|
335
339
|
|
|
336
340
|
const status = (await $`git status --porcelain`.text()).trim()
|
|
337
341
|
if (status) {
|
|
@@ -344,7 +348,9 @@ async function syncOnZeroOut(version: string) {
|
|
|
344
348
|
if (!(await fs.pathExists(onZeroGithub))) return
|
|
345
349
|
|
|
346
350
|
// copy src files from takeout to github
|
|
347
|
-
await fs.copy(join(onZeroTakeout, 'src'), join(onZeroGithub, 'src'), {
|
|
351
|
+
await fs.copy(join(onZeroTakeout, 'src'), join(onZeroGithub, 'src'), {
|
|
352
|
+
overwrite: true,
|
|
353
|
+
})
|
|
348
354
|
await fs.copy(join(onZeroTakeout, 'cli.cjs'), join(onZeroGithub, 'cli.cjs'))
|
|
349
355
|
await fs.copy(join(onZeroTakeout, 'tsconfig.json'), join(onZeroGithub, 'tsconfig.json'))
|
|
350
356
|
|
|
@@ -353,7 +359,10 @@ async function syncOnZeroOut(version: string) {
|
|
|
353
359
|
const githubPkg = await fs.readJSON(join(onZeroGithub, 'package.json'))
|
|
354
360
|
const convertDeps = (deps: Record<string, string>) =>
|
|
355
361
|
Object.fromEntries(
|
|
356
|
-
Object.entries(deps || {}).map(([k, v]) => [
|
|
362
|
+
Object.entries(deps || {}).map(([k, v]) => [
|
|
363
|
+
k,
|
|
364
|
+
v.startsWith('workspace:') ? `^${version}` : v,
|
|
365
|
+
])
|
|
357
366
|
)
|
|
358
367
|
await fs.writeJSON(
|
|
359
368
|
join(onZeroGithub, 'package.json'),
|