@willbooster/wb 19.7.2 → 20.0.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.
|
@@ -1,49 +1,21 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
3
|
+
# Adapts the wbfy-generated bunfig.toml in the current directory to a Docker image: drops the
|
|
4
|
+
# project-owned [test] sections (a production image never runs `bun test`) and forces globalStore
|
|
5
|
+
# off (a single-use image never reuses a global store, and store symlinks outside the project root
|
|
6
|
+
# break multi-stage COPY of node_modules).
|
|
6
7
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
# Like the wbfy global gate, this assumes up-to-date package managers (e.g. Yarn >= 4.10 for
|
|
11
|
-
# npmMinimalAgeGate); older versions must be upgraded, not accommodated.
|
|
8
|
+
# No global config is written: bun reads this very file, whose minimumReleaseAge and
|
|
9
|
+
# minimumReleaseAgeExcludes carry the organization's release-age policy, and images resolve
|
|
10
|
+
# dependencies with bun only.
|
|
12
11
|
|
|
13
12
|
set -euo pipefail
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'' | *[!0-9]*)
|
|
20
|
-
echo 'bunfig.toml has no numeric minimumReleaseAge; run wbfy to regenerate it.' >&2
|
|
21
|
-
exit 1
|
|
22
|
-
;;
|
|
23
|
-
esac
|
|
24
|
-
excludes=$(sed -n '/^minimumReleaseAgeExcludes = \[/,/^]/s/^[[:space:]]*"\(.*\)",$/\1/p' bunfig.toml)
|
|
25
|
-
days=$((seconds / 86400))
|
|
26
|
-
minutes=$((seconds / 60))
|
|
14
|
+
# The image's only release-age gate is this file, so an unregenerated bunfig.toml (older than wbfy's
|
|
15
|
+
# gate) must fail the build instead of silently producing an ungated image.
|
|
16
|
+
grep -q '^minimumReleaseAge = [0-9]' bunfig.toml ||
|
|
17
|
+
{ echo 'bunfig.toml has no minimumReleaseAge; run wbfy to regenerate it.' >&2; exit 1; }
|
|
27
18
|
|
|
28
|
-
{
|
|
29
|
-
echo "min-release-age=${days}"
|
|
30
|
-
for package in ${excludes}; do
|
|
31
|
-
echo "min-release-age-exclude[]=${package}"
|
|
32
|
-
done
|
|
33
|
-
} > ~/.npmrc
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
echo "npmMinimalAgeGate: ${minutes} # ${days} days"
|
|
37
|
-
echo 'npmPreapprovedPackages:'
|
|
38
|
-
for package in ${excludes}; do
|
|
39
|
-
echo " - '${package}'"
|
|
40
|
-
done
|
|
41
|
-
} > ~/.yarnrc.yml
|
|
42
|
-
|
|
43
|
-
# Keep the wbfy-generated bunfig.toml as the single source of the Bun settings; drop only the
|
|
44
|
-
# project-owned [test] sections and force globalStore off (a single-use image never reuses a
|
|
45
|
-
# global store, and store symlinks outside the project root break multi-stage COPY of
|
|
46
|
-
# node_modules).
|
|
47
19
|
awk '/^\[/ { inTestSection = ($0 ~ /^\[test/) } !inTestSection' bunfig.toml |
|
|
48
20
|
sed 's/^globalStore = true$/globalStore = false/' > bunfig.toml.tmp
|
|
49
21
|
mv bunfig.toml.tmp bunfig.toml
|