Skip to content

Commit 1f367a1

Browse files
committed
refactor(ci): update prod deps only instead of deleting lockfile
Replace the blunt 'rm pnpm-lock.yaml' approach with targeted 'pnpm update --prod' for all published packages. This only re-resolves production dependencies, keeping devDependencies pinned to the lockfile so test tooling churn doesn't cause false positives. A node one-liner dynamically discovers non-private workspace packages, so no workflow changes are needed when packages are added or removed.
1 parent 6dfcadd commit 1f367a1

1 file changed

Lines changed: 33 additions & 16 deletions

File tree

.github/workflows/fresh-install-tests.yml

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
name: Fresh Install Tests
22

3-
# Periodically tests BlockNote with the latest versions of its dependencies
4-
# (within declared ranges), without a lockfile. This catches breakage when a
3+
# Periodically tests BlockNote with the latest versions of its production
4+
# dependencies (within declared semver ranges). This catches breakage when a
55
# new release of a dep like @tiptap/* or prosemirror-* ships and conflicts
66
# with BlockNote's declared ranges — the kind of failure a user would hit when
77
# running `npm install @blocknote/react` in a fresh project.
88
#
9-
# DevDependencies (vitest, vite, typescript, etc.) are still bounded by their
10-
# declared ranges in package.json; only prod/peer deps get freshly resolved.
9+
# Only production dependencies of published (non-private) packages are updated.
10+
# DevDependencies (vitest, vite, typescript, etc.) stay pinned to the lockfile,
11+
# so test tooling churn doesn't cause false positives.
1112

1213
on:
14+
push:
15+
branches:
16+
- package-upgrades
1317
schedule:
1418
- cron: "0 2 * * *" # Daily at 02:00 UTC
1519
workflow_dispatch: # Allow manual runs
@@ -36,19 +40,32 @@ jobs:
3640
uses: actions/setup-node@v6
3741
with:
3842
node-version-file: ".nvmrc"
39-
# Intentionally no pnpm cache — we want a genuinely fresh install
40-
41-
- id: remove_lockfile
42-
name: Remove lockfile to force fresh dep resolution
43-
# Removing pnpm-lock.yaml causes pnpm to resolve all dependencies to
44-
# the latest versions that satisfy the ranges declared in package.json
45-
# (including pnpm-workspace.yaml overrides). This is equivalent to what
46-
# a new user experiences when installing BlockNote in a blank project.
47-
run: rm pnpm-lock.yaml
43+
# Intentionally no pnpm cache — we want fresh prod dep resolution
4844

4945
- id: install_dependencies
5046
name: Install dependencies
51-
run: pnpm install --no-frozen-lockfile
47+
run: pnpm install
48+
49+
- id: update_prod_deps
50+
name: Update prod deps of published packages
51+
# Resolves production dependencies of every published (non-private)
52+
# workspace package to the latest version within their declared semver
53+
# ranges. This simulates what a user gets when running
54+
# `npm install @blocknote/react` in a fresh project.
55+
# DevDependencies are left at their lockfile versions.
56+
run: |
57+
FILTERS=$(node -e "
58+
const fs = require('fs');
59+
const path = require('path');
60+
fs.readdirSync('packages').forEach(dir => {
61+
try {
62+
const pkg = JSON.parse(fs.readFileSync(path.join('packages', dir, 'package.json'), 'utf8'));
63+
if (!pkg.private && pkg.name) process.stdout.write('--filter ' + pkg.name + ' ');
64+
} catch {}
65+
});
66+
")
67+
echo "Updating prod deps for: $FILTERS"
68+
eval pnpm update --prod $FILTERS
5269
5370
- id: build_packages
5471
name: Build packages
@@ -85,10 +102,10 @@ jobs:
85102
failed_step="Install pnpm"
86103
elif [ "${{ steps.setup_node.outcome }}" = "failure" ]; then
87104
failed_step="Setup Node.js"
88-
elif [ "${{ steps.remove_lockfile.outcome }}" = "failure" ]; then
89-
failed_step="Remove lockfile to force fresh dep resolution"
90105
elif [ "${{ steps.install_dependencies.outcome }}" = "failure" ]; then
91106
failed_step="Install dependencies"
107+
elif [ "${{ steps.update_prod_deps.outcome }}" = "failure" ]; then
108+
failed_step="Update prod deps of published packages"
92109
elif [ "${{ steps.build_packages.outcome }}" = "failure" ]; then
93110
failed_step="Build packages"
94111
elif [ "${{ steps.run_unit_tests.outcome }}" = "failure" ]; then

0 commit comments

Comments
 (0)