@take-out/scripts 0.1.8 → 0.1.10
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 +4 -4
- package/src/build-initial.ts +7 -13
- package/src/env-update.ts +8 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@take-out/scripts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/run.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@clack/prompts": "^0.8.2",
|
|
32
|
-
"@take-out/helpers": "0.1.
|
|
32
|
+
"@take-out/helpers": "0.1.10",
|
|
33
33
|
"picocolors": "^1.1.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"vxrn": "^1.6.
|
|
36
|
+
"vxrn": "^1.6.9"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
39
39
|
"vxrn": {
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"vxrn": "1.6.
|
|
44
|
+
"vxrn": "1.6.9"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/src/build-initial.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { cmd } from './cmd'
|
|
|
4
4
|
|
|
5
5
|
await cmd`bootstrap project workspace and build initial packages`.run(
|
|
6
6
|
async ({ $, fs, path }) => {
|
|
7
|
-
|
|
7
|
+
// use our own file because we know its takeout-like packages if it exists
|
|
8
|
+
const hasPackages = fs.existsSync(`./packages/scripts/src/build-initial.ts`)
|
|
8
9
|
|
|
9
10
|
// only run once
|
|
10
11
|
if (!fs.existsSync(`./node_modules/.bin/tko`)) {
|
|
@@ -15,23 +16,16 @@ await cmd`bootstrap project workspace and build initial packages`.run(
|
|
|
15
16
|
|
|
16
17
|
// check if critical packages are built
|
|
17
18
|
if (hasPackages) {
|
|
18
|
-
const hasHelpers = fs.existsSync(`./packages/helpers`)
|
|
19
|
-
const hasCli = fs.existsSync(`./packages/cli`)
|
|
20
|
-
|
|
21
19
|
const needsBuild =
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
!fs.existsSync(`./packages/helpers/dist`) ||
|
|
21
|
+
!fs.existsSync(`./packages/cli/dist/esm`)
|
|
24
22
|
|
|
25
23
|
if (needsBuild) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
await $`cd packages/helpers && bun run build`
|
|
29
|
-
}
|
|
24
|
+
// build helpers first as other packages depend on it
|
|
25
|
+
await $`cd packages/helpers && bun run build`
|
|
30
26
|
|
|
31
27
|
// then build all other packages in parallel
|
|
32
|
-
|
|
33
|
-
await $`bun ./packages/scripts/src/run.ts build --no-root`
|
|
34
|
-
}
|
|
28
|
+
await $`bun ./packages/scripts/src/run.ts build --no-root`
|
|
35
29
|
}
|
|
36
30
|
}
|
|
37
31
|
|
package/src/env-update.ts
CHANGED
|
@@ -130,10 +130,14 @@ await cmd`sync environment variables from package.json to CI and server configs`
|
|
|
130
130
|
const beforeMarker = dockerCompose.slice(0, dockerCompose.indexOf(yamlStartMarker))
|
|
131
131
|
const isMap = /x-[\w-]+:.*&[\w-]+/s.test(beforeMarker)
|
|
132
132
|
|
|
133
|
-
const envLines = Object.
|
|
134
|
-
.map((key) =>
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
const envLines = Object.entries(envVars)
|
|
134
|
+
.map(([key, value]) => {
|
|
135
|
+
const resolved = resolveDepVersion(value, packageJson.dependencies)
|
|
136
|
+
const defaultVal = resolved || (typeof value === 'string' ? value : '')
|
|
137
|
+
return isMap
|
|
138
|
+
? `${indent}${key}: \${${key}:-${defaultVal}}`
|
|
139
|
+
: `${indent}- ${key}=\${${key}:-${defaultVal}}`
|
|
140
|
+
})
|
|
137
141
|
.join('\n')
|
|
138
142
|
|
|
139
143
|
const newDockerCompose = replaceYamlSection(dockerCompose, envLines, { indent })
|