switch to single npm package on npmjs.com (firecrawl-pdf-inspector)

Drop platform-specific optional deps — ship all .node binaries in one
package (~4 MB total). Simplifies publishing and consumer install.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Abimael Martell
2026-04-02 12:07:36 -07:00
co-authored by Claude Opus 4.6
parent 7dd1a69413
commit be032b0696
3 changed files with 62 additions and 107 deletions
+6 -47
View File
@@ -57,7 +57,7 @@ jobs:
if-no-files-found: error
publish:
name: Publish to GitHub Packages
name: Publish to npm
needs: build
runs-on: ubuntu-latest
steps:
@@ -76,56 +76,15 @@ jobs:
with:
path: napi/artifacts
- name: Prepare and publish
- name: Collect binaries and publish
working-directory: napi
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
echo "@firecrawl:registry=https://npm.pkg.github.com" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
VERSION=$(node -p "require('./package.json').version")
# Create platform package dirs and package.json files
mkdir -p npm/linux-x64-gnu npm/darwin-arm64
cat > npm/linux-x64-gnu/package.json << PKGEOF
{
"name": "@firecrawl/pdf-inspector-js-linux-x64-gnu",
"version": "${VERSION}",
"os": ["linux"],
"cpu": ["x64"],
"main": "pdf-inspector.linux-x64-gnu.node",
"files": ["pdf-inspector.linux-x64-gnu.node"],
"license": "MIT",
"repository": { "type": "git", "url": "https://github.com/firecrawl/pdf-inspector" },
"publishConfig": { "registry": "https://npm.pkg.github.com", "access": "public" }
}
PKGEOF
cat > npm/darwin-arm64/package.json << PKGEOF
{
"name": "@firecrawl/pdf-inspector-js-darwin-arm64",
"version": "${VERSION}",
"os": ["darwin"],
"cpu": ["arm64"],
"main": "pdf-inspector.darwin-arm64.node",
"files": ["pdf-inspector.darwin-arm64.node"],
"license": "MIT",
"repository": { "type": "git", "url": "https://github.com/firecrawl/pdf-inspector" },
"publishConfig": { "registry": "https://npm.pkg.github.com", "access": "public" }
}
PKGEOF
# Move binaries into platform dirs
cp artifacts/bindings-x86_64-unknown-linux-gnu/*.node npm/linux-x64-gnu/
cp artifacts/bindings-aarch64-apple-darwin/*.node npm/darwin-arm64/
# Copy all .node binaries into the package directory
cp artifacts/bindings-*/*.node .
echo "=== Package contents ==="
ls -R npm/
ls -la *.node index.js index.d.ts
# Publish platform packages first, then main package
for dir in npm/*/; do
echo "Publishing $dir"
(cd "$dir" && npm publish --access public)
done
echo "Publishing main package"
npm publish --access public