fix(release): pin optionalDependencies to bootstrap version in committed source
CI was failing because apps/cli/package.json declared optionalDependencies at 0.16.0 but only 0.0.0-bootstrap exists on npm for those packages. The lockfile couldn't resolve, and `pnpm install --frozen-lockfile` rejected the working tree. Pin optionalDependencies to 0.0.0-bootstrap in the committed source so the lockfile resolves cleanly. The release workflow now bumps them to the real version inside publish-npm.sh, just before publishing main kandev — at which point the matching @kdlbs/runtime-*@VERSION tarballs have already been published earlier in the same step. This avoids the chicken-and-egg where the prepare job tried to bump optional deps to a version that didn't yet exist on npm. Workflow changes: - prepare job: only bumps the main package version, not optional deps. - publish-npm.sh: rewrites optionalDependencies to $VERSION right before the main `npm publish`, after the 5 runtime packages have been published. The published kandev@X.Y.Z still has its optionalDependencies pinned to matching @kdlbs/runtime-*@X.Y.Z. Only the local source uses the bootstrap pin for development convenience.
This commit is contained in:
@@ -104,6 +104,27 @@ for pkg in "${RUNTIME_PACKAGES[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
# -- Pin optionalDependencies before publishing main kandev ------------------
|
||||
#
|
||||
# In committed source, optionalDependencies reference 0.0.0-bootstrap so the
|
||||
# lockfile resolves during normal development. For the published kandev@VERSION
|
||||
# package, we want optionalDependencies to point at @kdlbs/runtime-*@VERSION
|
||||
# so users get matching runtime bundles. The runtime packages were just
|
||||
# published above, so this version exists on npm now.
|
||||
log "Pinning optionalDependencies to $VERSION before publishing main package..."
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
const path = '$ROOT_DIR/apps/cli/package.json';
|
||||
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
|
||||
if (pkg.optionalDependencies) {
|
||||
for (const k of Object.keys(pkg.optionalDependencies)) {
|
||||
pkg.optionalDependencies[k] = '$VERSION';
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
|
||||
"
|
||||
log_ok "optionalDependencies pinned to $VERSION"
|
||||
|
||||
# -- Publish main kandev package ----------------------------------------------
|
||||
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user