@willbooster/wb 19.7.2 → 20.1.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
- # Force-overwrites the npm / yarn / bun config files inside a Docker image with the
4
- # organization-standard content. The release-age gate values come from the wbfy-generated
5
- # bunfig.toml in the current directory, so the image needs no other source of the org policy.
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
- # Unconditional overwrites are intentional: images never hold package-manager credentials
8
- # (private packages are materialized on the host; see WillBooster/shared#964), and a production
9
- # image never runs `bun test`, so existing config lines and `[test]` sections need no preserving.
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
- seconds=$(sed -n 's/^minimumReleaseAge = \([0-9]*\).*/\1/p' bunfig.toml)
16
- # sed exits 0 on no match, so an unregenerated bunfig.toml (older than wbfy's gate) must be
17
- # rejected here; otherwise the gate silently becomes 0 and the generated bunfig.toml is invalid.
18
- case "${seconds}" in
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/wb",
3
- "version": "19.7.2",
3
+ "version": "20.1.0",
4
4
  "description": "CLI tool for WillBooster projects",
5
5
  "repository": {
6
6
  "type": "git",