Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/pkg-pr-new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Package Previews

on:
pull_request:
branches: [main]

permissions: {}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: 24.19.0
package-manager-cache: false

- name: Install Pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
with:
run_install: true

- name: Build Packages
run: node --run build

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include native bindings in the rstack preview

On a clean Linux x64 installation of this preview, rs fmt and the formatting stage of rs check will throw Cannot find native binding. This step runs the manifest's build script (node --help: “Run a script specified in package.json”), which is only rslib for rstack. A repo-wide artifact search found no checked-in .node binaries, and packages/rstack/package.json declares no platform-native optional dependencies, so the formatter's loadNativeBinding() call has neither a local binary nor an installed fallback package. Ensure previews include or depend on matching native bindings before publishing, analogous to the native preparation in .github/workflows/release.yml:88-102.

Useful? React with 👍 / 👎.


- name: Publish Package Previews
run: pnpm exec pkg-pr-new publish --pnpm --previewVersion --no-template './packages/rstack' './packages/create-rstack'
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@types/node": "catalog:",
"cspell-ban-words": "catalog:",
"heading-case": "catalog:",
"pkg-pr-new": "catalog:",
"prettier": "catalog:",
"rstack": "workspace:*",
"typescript": "catalog:"
Expand Down
20 changes: 20 additions & 0 deletions packages/rstack/tests/pkgPrNew.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { readFile } from 'node:fs/promises';
import { expect, test } from 'rstack/test';

test('publishes pull request previews for public packages', async () => {
const [workflow, packageJson, workspace] = await Promise.all([
readFile(
new URL('../../../.github/workflows/pkg-pr-new.yml', import.meta.url),
'utf8',
),
readFile(new URL('../../../package.json', import.meta.url), 'utf8'),
readFile(new URL('../../../pnpm-workspace.yaml', import.meta.url), 'utf8'),
]);

expect(workflow).toContain('pkg-pr-new publish --pnpm --previewVersion');
expect(workflow).toContain("'./packages/rstack'");
expect(workflow).toContain("'./packages/create-rstack'");
expect(workflow).not.toContain('head.repo.full_name == github.repository');
expect(packageJson).toContain('"pkg-pr-new": "catalog:"');
expect(workspace).toContain('pkg-pr-new: 0.0.87');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove the hard-coded publisher version from the test

When pkg-pr-new is upgraded in the catalog, an otherwise-valid dependency update will make the package test suite fail solely because this assertion requires 0.0.87. AGENTS.md requires tests to be “focused on observable behavior”; this check instead locks an implementation detail without establishing that previews publish correctly. Remove the fixed-version expectation or check manifest/catalog consistency without hard-coding a release.

AGENTS.md reference: AGENTS.md:L33-L33

Useful? React with 👍 / 👎.

});
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ catalog:
is-binary-path: 3.0.0
'lint-staged': '^17.6.0'
'micromatch': '4.0.8'
pkg-pr-new: 0.0.87
prettier: '3.9.10'
'prettier-plugin-tailwindcss': '0.8.1'
'prettier-plugin-svelte': '^4.1.1'
Expand Down
Loading