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
14 changes: 0 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -648,26 +648,12 @@ jobs:
save-if: ${{ github.ref == 'refs/heads/main' }}
cache-on-failure: false

- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 22

- name: Build wright CLI and LSP
run: cargo build --locked -p wright-cli -p wright-lsp

- name: Validate package-manager metadata and install script
run: python scripts/verify-dist.py

# #183 moved the npm tarball determinism/executable-bit regressions
# (#123) to scripts/tests and declared them part of distribution
# validation; this step is that wiring.
- name: Run npm packaging unit regressions (#123)
run: python -m unittest discover -s scripts/tests

- name: Run installer functional tests
if: runner.os != 'Windows'
run: scripts/test-install.sh

- name: Run npm distribution smoke tests
run: python scripts/test-npm.py --binaries-dir target/debug
2 changes: 0 additions & 2 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,3 @@ jobs:
secrets: inherit
permissions:
contents: write
id-token: write
packages: write
172 changes: 0 additions & 172 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@ on:
GH_TOKEN:
description: Dedicated cross-repository token with write access to wrightkit/homebrew-tap
required: true
NPM_TOKEN:
description: Optional npmjs.org publication token
required: false

permissions:
contents: write
id-token: write
packages: write

jobs:
release-gates:
Expand Down Expand Up @@ -356,177 +351,10 @@ jobs:
git push origin HEAD
echo "pushed wright.rb for ${RELEASE_TAG} to wrightkit/homebrew-tap"

package-npm:
name: Package npm distribution
needs: upload-artifacts
runs-on: ubuntu-latest
env:
RELEASE_TAG: ${{ inputs.tag }}
steps:
- name: Check out repository
uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version: 22
registry-url: "https://registry.npmjs.org"

- name: Download release artifacts
uses: actions/download-artifact@v8
with:
pattern: wright-*
path: artifacts

- name: Package npm distribution tarballs
run: |
set -euo pipefail
VERSION="${RELEASE_TAG#v}"
python3 scripts/package-npm.py \
--version "$VERSION" \
--artifacts-dir artifacts \
--out-dir "$GITHUB_WORKSPACE/npm-packages"
ls -lh "$GITHUB_WORKSPACE/npm-packages"

- name: Smoke test host npm package (Linux x64)
run: |
set -euo pipefail
VERSION="${RELEASE_TAG#v}"
SANDBOX="$(mktemp -d)"
cd "$SANDBOX"
npm init -y
PLATFORM_TB="$(ls "$GITHUB_WORKSPACE"/npm-packages/wrightkit-wright-linux-x64-*.tgz "$GITHUB_WORKSPACE"/npm-packages/*wright-linux-x64-*.tgz 2>/dev/null | head -n 1)"
META_TB="$(ls "$GITHUB_WORKSPACE"/npm-packages/wrightkit-wright-[0-9]*.tgz "$GITHUB_WORKSPACE"/npm-packages/*wright-[0-9]*.tgz 2>/dev/null | head -n 1)"
npm install "$PLATFORM_TB" "$META_TB"
npx wright --version | grep -F "$VERSION"
npx wright-lsp --version | grep -F "$VERSION"
npx wright compile "$GITHUB_WORKSPACE/compatibility/fixtures/synthetic/basic-rule/source.opy" --profile compat >/dev/null
npx wright check "$GITHUB_WORKSPACE/scenarios/loops.opy" --profile compat >/dev/null
node -e '
const { getBinaryPath, getPlatformPackageName } = require("@wrightkit/wright");
const p = getBinaryPath("wright");
console.log("Resolved:", p);
'
echo "npm packages smoke test passed on $(uname -s) $(uname -m)"

- name: Attach npm tarballs to the draft Release
env:
GH_TOKEN: ${{ github.token }}
run: >-
gh release upload "${RELEASE_TAG}" npm-packages/*.tgz --clobber
--repo "${GITHUB_REPOSITORY}"

- name: Upload npm tarballs for registry publishing
uses: actions/upload-artifact@v7
with:
name: npm-packages
path: npm-packages/*.tgz
if-no-files-found: error

publish-npm:
name: Publish packages to npm registry
needs:
- package-npm
- publish-release
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Download npm tarballs
uses: actions/download-artifact@v8
with:
name: npm-packages
path: npm-packages

- name: Set up Node.js for npmjs.org
uses: actions/setup-node@v7
with:
node-version: 22
registry-url: "https://registry.npmjs.org"

- name: Publish to npmjs.org
if: env.NPM_TOKEN != ''
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
set -euo pipefail
publish_if_missing() {
local pkg="$1"
local metadata name version published
metadata="$(tar -xOf "${pkg}" package/package.json)"
name="$(node -e 'let s=""; process.stdin.on("data", c => s += c).on("end", () => process.stdout.write(JSON.parse(s).name))' <<<"${metadata}")"
version="$(node -e 'let s=""; process.stdin.on("data", c => s += c).on("end", () => process.stdout.write(JSON.parse(s).version))' <<<"${metadata}")"
published="$(npm view "${name}@${version}" version --registry=https://registry.npmjs.org 2>/dev/null || true)"
if [[ "${published}" == "${version}" ]]; then
echo "${name}@${version} is already published; skipping"
return
fi
echo "Publishing ${pkg} to npmjs.org..."
npm publish "${pkg}" --access public --provenance
}
for pkg in "$GITHUB_WORKSPACE"/npm-packages/*.tgz; do
publish_if_missing "${pkg}"
done

- name: Skip npmjs.org publication
if: env.NPM_TOKEN == ''
run: echo "NPM_TOKEN is not configured; skipping npmjs.org publication."

publish-github-packages:
name: Publish packages to GitHub Packages
needs:
- package-npm
- publish-release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Download npm tarballs
uses: actions/download-artifact@v8
with:
name: npm-packages
path: npm-packages

- name: Set up Node.js for GitHub Packages
uses: actions/setup-node@v7
with:
node-version: 22
registry-url: "https://npm.pkg.github.com"

- name: Publish to GitHub Packages
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
publish_if_missing() {
local pkg="$1"
local metadata name version published
metadata="$(tar -xOf "${pkg}" package/package.json)"
name="$(node -e 'let s=""; process.stdin.on("data", c => s += c).on("end", () => process.stdout.write(JSON.parse(s).name))' <<<"${metadata}")"
version="$(node -e 'let s=""; process.stdin.on("data", c => s += c).on("end", () => process.stdout.write(JSON.parse(s).version))' <<<"${metadata}")"
published="$(npm view "${name}@${version}" version --registry=https://npm.pkg.github.com 2>/dev/null || true)"
if [[ "${published}" == "${version}" ]]; then
echo "${name}@${version} is already published; skipping"
return
fi
echo "Publishing ${pkg} to GitHub Packages..."
npm publish "${pkg}" \
--registry=https://npm.pkg.github.com \
--access public
}
for pkg in "$GITHUB_WORKSPACE"/npm-packages/*.tgz; do
publish_if_missing "${pkg}"
done

publish-release:
name: Publish completed GitHub Release
needs:
- package-manifests
- package-npm
runs-on: ubuntu-latest
environment: release
steps:
Expand Down
48 changes: 5 additions & 43 deletions dist/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Wright Package-Manager Distribution (#108, #121)
# Wright Package-Manager Distribution (#108)

This directory holds the package-manager, installer, and npm distribution
metadata that make the canonical GitHub Release artifacts installable through
This directory holds the package-manager and installer metadata that make the
canonical GitHub Release artifacts installable through
platform-native channels. Nothing in here rebuilds Wright: every manifest and
package consumes the published `wright-<version>-<target-triple>.<ext>`
archives and their `.sha256` checksums from
Expand All @@ -13,7 +13,6 @@ archives and their `.sha256` checksums from
| Homebrew | `homebrew/wright.rb` | macOS `.tar.gz` archives (arm64 + x86_64) with per-arch `sha256` |
| WinGet | `winget/manifests/w/WrightKit/Wright/<version>/` | Windows `.zip` with `InstallerSha256` |
| Scoop | `scoop/wright.json` | Windows `.zip` with `hash` |
| npm / npx | `npm/wright/`, `npm/wright-*/` | Native release binaries packaged directly into platform npm packages |

Standalone installs (the Unix installer or manual archives) upgrade in place
with `wright update`, which consumes the same release archives and checksums
Expand Down Expand Up @@ -49,14 +48,8 @@ stages complete:
- `wright-<version>.winget.zip` (unzip into a winget-pkgs checkout)
- `wright-<version>.scoop.json`

2. `package-npm` packages the release binaries into platform-native npm packages
via `scripts/package-npm.py`, runs smoke tests on the packaged artifacts,
attaches the `.tgz` tarballs to the draft Release, and publishes the same
tarballs to npmjs.org and GitHub Packages.

3. `publish-release` marks the draft Release public only after the Homebrew tap
and registry jobs succeed. Re-running an already completed registry stage
skips package versions that already exist.
2. `publish-release` marks the draft Release public after the native and
package-manager stages succeed.

### Homebrew

Expand Down Expand Up @@ -101,35 +94,6 @@ stages complete:
- User experience: `scoop bucket add wrightkit
https://github.com/wrightkit/scoop-bucket && scoop install wright`.

### npm / npx (#121)

Wright distributes native binaries via npm for seamless integration with Node.js
tooling and CI environments without requiring Rust/Cargo compilation or
postinstall download scripts.

- **Meta package**: `@wrightkit/wright` exposes `wright` and `wright-lsp` CLI
binaries and exports `getBinaryPath()` for programmatic Node.js consumers.
It selects the matching native platform package via `optionalDependencies`.
- **Platform packages**:
- `@wrightkit/wright-darwin-arm64` (macOS Apple Silicon)
- `@wrightkit/wright-darwin-x64` (macOS Intel)
- `@wrightkit/wright-linux-x64` (Linux x64)
- `@wrightkit/wright-win32-x64` (Windows x64)
- **User experience**:
- Direct execution: `npx wright --version`
- Project dependency: `npm install @wrightkit/wright`
- **Programmatic usage**:
```javascript
const { getBinaryPath } = require('@wrightkit/wright');
const wrightBin = getBinaryPath('wright');
```
- **Boundary**: npm is strictly a package/distribution layer for the native Rust
CLI; there is no JavaScript reimplementation of the Wright compiler.
- **Registries**: the release workflow publishes to npmjs.org when `NPM_TOKEN`
is configured, and always publishes to GitHub Packages with the workflow
`GITHUB_TOKEN`. GitHub Packages consumers must configure the `@wrightkit`
scope to use `https://npm.pkg.github.com` and authenticate with GitHub.

## Shell completions (#186)

- Standalone installations (`install.sh`) automatically run `wright completion install`
Expand All @@ -143,8 +107,6 @@ postinstall download scripts.
- CI runs `scripts/verify-dist.py` on every commit: it regenerates the
checked-in manifests with the workspace version and fails on any mismatch,
so a version bump without regenerated metadata is caught before merge.
- CI also runs `scripts/test-npm.py` to package and execute clean-install smoke
tests across supported platforms.
- The release workflow consumes the published `.sha256` files when generating
the attached manifests, so the attached metadata cannot drift from the
actual artifacts of that release.
Expand Down
9 changes: 0 additions & 9 deletions dist/npm/wright-darwin-arm64/README.md

This file was deleted.

27 changes: 0 additions & 27 deletions dist/npm/wright-darwin-arm64/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions dist/npm/wright-darwin-x64/README.md

This file was deleted.

27 changes: 0 additions & 27 deletions dist/npm/wright-darwin-x64/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions dist/npm/wright-linux-x64/README.md

This file was deleted.

Loading