Skip to content

Commit e431a56

Browse files
ryan-williamsclaude
andcommitted
ci: use runsascoded/npm-dist@v1, switch to pnpm, remove upstream test workflow
- Replace manual dist branch workflow with `npm-dist@v1` action using `exports_map` and `preserve_dirs` - Switch all workflows from npm to pnpm - Remove `package-lock.json` (using `pnpm-lock.yaml`) - Remove always-failing upstream "No CI Test" workflow - Add `fork_bundles.mjs` for minimal/lite bundles (separate from upstream's partial bundle system which requires trace lists) - Simplify dist output names: `plotly-basic.min.js` → `basic.min.js` - Remove hardcoded Mapbox token (use `$MAPBOX_ACCESS_TOKEN` env var) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3d1fdb4 commit e431a56

File tree

8 files changed

+125
-11212
lines changed

8 files changed

+125
-11212
lines changed

.github/workflows/build-dist.yml

Lines changed: 22 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -14,83 +14,26 @@ jobs:
1414
build-dist:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: runsascoded/npm-dist@v1
1818
with:
19-
ref: ${{ inputs.source_ref || github.ref_name }}
20-
fetch-depth: 0
21-
22-
- name: Get source info
23-
id: info
24-
run: |
25-
echo "source_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
26-
echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
27-
echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
28-
29-
- uses: actions/setup-node@v4
30-
with:
31-
node-version: '20'
32-
cache: 'npm'
33-
34-
- name: Install dependencies
35-
run: npm ci
36-
37-
- name: Build all bundles
38-
run: npm run build
39-
40-
- name: Create dist branch
41-
env:
42-
SOURCE_REF: ${{ inputs.source_ref || github.ref_name }}
43-
SOURCE_SHA: ${{ steps.info.outputs.source_sha }}
44-
SHORT_SHA: ${{ steps.info.outputs.short_sha }}
45-
SOURCE_VERSION: ${{ steps.info.outputs.version }}
46-
run: |
47-
# `main` pushes to `dist` (matching pds convention); other branches get namespaced
48-
if [ "$SOURCE_REF" = "main" ]; then
49-
DIST_BRANCH="dist"
50-
else
51-
DIST_BRANCH="${SOURCE_REF}-dist"
52-
fi
53-
DIST_VERSION="${SOURCE_VERSION}-dist.${SHORT_SHA}"
54-
55-
# Configure git
56-
git config user.name "github-actions[bot]"
57-
git config user.email "github-actions[bot]@users.noreply.github.com"
58-
59-
# Save files we need before switching branches
60-
mkdir -p /tmp/dist-build
61-
cp -r dist/ /tmp/dist-build/
62-
cp package.json /tmp/dist-build/
63-
cp package-lock.json /tmp/dist-build/
64-
65-
# Fetch and checkout dist branch (or create orphan)
66-
if git fetch origin "$DIST_BRANCH" 2>/dev/null; then
67-
git checkout -f "$DIST_BRANCH" --
68-
else
69-
git checkout --orphan "$DIST_BRANCH"
70-
git rm -rf .
71-
fi
72-
73-
# Clean working tree and restore only dist files
74-
git clean -fdx
75-
rm -rf dist/
76-
cp -r /tmp/dist-build/dist/ ./
77-
cp /tmp/dist-build/package.json ./
78-
cp /tmp/dist-build/package-lock.json ./
79-
80-
# Update version in package.json
81-
jq --arg v "$DIST_VERSION" '.version = $v' package.json > package.json.tmp
82-
mv package.json.tmp package.json
83-
84-
# Commit only the intended files
85-
git add dist/ package.json package-lock.json
86-
git commit -m "plotly.js@${DIST_VERSION}
87-
88-
Built from ${SOURCE_SHA}"
89-
90-
# Push
91-
git push origin "$DIST_BRANCH" --force
92-
93-
echo "✅ Pushed $DIST_BRANCH with version $DIST_VERSION"
94-
echo ""
95-
echo "Install with:"
96-
echo " pnpm add github:${{ github.repository }}#$DIST_BRANCH"
19+
source_ref: ${{ inputs.source_ref || github.ref_name }}
20+
node_version: '20'
21+
build_command: pnpm run build
22+
preserve_dirs: dist
23+
extra_files: package-lock.json
24+
exports_map: >-
25+
{
26+
"./lib/index.js": "./dist/plotly.min.js",
27+
"./lib/index-basic.js": "./dist/basic.min.js",
28+
"./lib/index-minimal.js": "./dist/minimal.min.js",
29+
"./lib/index-lite.js": "./dist/lite.min.js",
30+
"./lib/index-cartesian.js": "./dist/cartesian.min.js",
31+
"./lib/index-finance.js": "./dist/finance.min.js",
32+
"./lib/index-geo.js": "./dist/geo.min.js",
33+
"./lib/index-gl2d.js": "./dist/gl2d.min.js",
34+
"./lib/index-gl3d.js": "./dist/gl3d.min.js",
35+
"./lib/index-mapbox.js": "./dist/mapbox.min.js",
36+
"./lib/index-strict.js": "./dist/plotly-strict.min.js",
37+
"./lib/core.js": "./dist/plotly.min.js"
38+
}
39+
dist_branch: ${{ (inputs.source_ref || github.ref_name) == 'main' && 'dist' || format('{0}-dist', inputs.source_ref || github.ref_name) }}

.github/workflows/perf.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,27 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18+
- uses: pnpm/action-setup@v4
19+
1820
- uses: actions/setup-node@v4
1921
with:
2022
node-version: '20'
21-
cache: 'npm'
23+
cache: 'pnpm'
2224

2325
- name: Install dependencies
24-
run: npm ci
26+
run: pnpm install --frozen-lockfile
2527

2628
- name: Install Playwright Chromium
27-
run: npx playwright install chromium
29+
run: pnpm exec playwright install chromium
2830

2931
- name: Run perf benchmark (${{ matrix.bundle }})
3032
run: |
3133
if [ "${{ matrix.bundle }}" = "minimal" ]; then
32-
npm run perf
34+
pnpm run perf
3335
elif [ "${{ matrix.bundle }}" = "basic" ]; then
34-
npm run perf:basic
36+
pnpm run perf:basic
3537
else
36-
npm run perf:lite
38+
pnpm run perf:lite
3739
fi
3840
3941
- name: Upload perf report

.github/workflows/test.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)