fix(ci): exécuter prepack explicitement avant npm pack (embarquement @arboretum/shared)
Some checks failed
CI / Build & test (Node 22) (push) Successful in 9m48s
CI / Build & test (Node 24) (push) Successful in 9m41s
CI / Pack & boot smoke (Node 22) (push) Failing after 5m2s

Le job pack-smoke échouait sur le runner Gitea : « npm pack -w » n'y déclenche
pas le hook prepack (contrairement à « npm publish -w », d'où la 1.2.0 publiée
intacte). vendor-shared ne matérialisait donc pas @arboretum/shared, et npm
retombait sur le symlink workspace (non bundlé) → tarball sans le runtime partagé.

On lance désormais prepack explicitement, on vérifie la matérialisation de
@arboretum/shared/dist/index.js, puis on packe en --ignore-scripts. On nettoie
aussi /tmp/tarballs (runner persistant). Validé en repro locale (npm 10 et 11).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Johan LEROY
2026-06-18 13:13:48 +02:00
parent 9d40fb4aa0
commit 0fd1d1f55c

View File

@@ -46,8 +46,18 @@ jobs:
# et on l'installe seul, comme un vrai consommateur depuis le registre. # et on l'installe seul, comme un vrai consommateur depuis le registre.
- name: Pack tarball - name: Pack tarball
run: | run: |
mkdir -p /tmp/tarballs rm -rf /tmp/tarballs && mkdir -p /tmp/tarballs
npm pack -w @johanleroy/git-arboretum --pack-destination /tmp/tarballs # Le hook prepack (copy-web + vendor-shared + copy-meta) matérialise
# @arboretum/shared comme VRAI dossier dans le node_modules du serveur —
# condition pour que npm l'embarque via bundleDependencies. Selon la version
# de npm du runner, « npm pack -w » ne déclenche PAS toujours ce lifecycle
# (contrairement à « npm publish -w », qui lance bien prepack). On l'exécute
# donc explicitement, on vérifie la matérialisation, puis on packe avec
# --ignore-scripts (prepack déjà fait, dossier physique présent → bundlé).
npm run prepack -w @johanleroy/git-arboretum
test -f packages/server/node_modules/@arboretum/shared/dist/index.js \
|| { echo "ERREUR: prepack n'a pas matérialisé @arboretum/shared/dist/index.js"; exit 1; }
npm pack -w @johanleroy/git-arboretum --pack-destination /tmp/tarballs --ignore-scripts
ls -l /tmp/tarballs ls -l /tmp/tarballs
- name: Assert @arboretum/shared is bundled in the tarball - name: Assert @arboretum/shared is bundled in the tarball
run: | run: |