Fix JS scaffold build + add CLI template smoke test#58
Merged
Conversation
The JavaScript scaffolding templates' build script invoked `babel` with presets that were never declared as devDependencies, so `npm run build` failed with "babel not found" after a fresh install. The build also compiled a non-existent `index.js` at the package root instead of the actual source at `src/index.js`. - Add @babel/cli, @babel/core, @babel/preset-env, babel-preset-minify (Babel 7 line, compatible with the babel-preset-minify minifier). - Point `build` at src/index.js and publish `src` in `files`, matching the TypeScript templates. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
End-to-end CI that scaffolds a package with each generator (new-plugin/new-extension/new-timeline x ts/js) and verifies it installs and builds from a clean checkout, asserting dist/index.browser.min.js is produced. Catches broken template package.json scripts/dependencies before they reach the published CLIs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: b4fcb5b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A user hit
babel: command not foundrunningnpm run buildon a freshly scaffolded new-plugin JS package. Root cause was a broken JavaScript template, and validating the fix surfaced a second build bug — so this PR fixes both across all three generators and adds CI to keep it from regressing.Template fixes (all three JS templates)
buildscript invokesbabelwith@babel/preset-env+ theminifypreset, but none of@babel/cli,@babel/core,@babel/preset-env,babel-preset-minifywere indevDependencies. After a cleannpm installthebabelbinary didn't exist → "babel not found". Pinned to the Babel 7 line, which is compatible with the (2022-era)babel-preset-minify.buildcompiledindex.jsat the package root, but the source ships atsrc/index.js(like the TS templates) →babel: index.js does not exist. Fixed the path and updatedfilesto publishsrcinstead of the non-existentindex.js.Affects
@jspsych/new-plugin,@jspsych/new-extension,@jspsych/new-timeline(patch changeset included). TS templates were already fine.New CI:
CLI Template Smoke TestEnd-to-end workflow that, for a 3×2 matrix (each CLI × ts/js), scaffolds a package non-interactively, then runs
npm install+npm run buildin the generated package and assertsdist/index.browser.min.jsis produced. This is what caught the second bug. Runs on PRs touching the CLI packages, pushes tomain, and manual dispatch.Testing
Ran the full scaffold → install → build flow locally for all six combinations — all pass:
Note (out of scope)
package-lock.jsonis out of sync —npm cifails on missing@esbuild/*platform optional deps (pre-existing, also affectsrelease.yml). Happy to regenerate the lockfile in a follow-up.🤖 Generated with Claude Code