js-package-testing
Skill525 starsChanged 2 months agoApache-2.0View on GitHub
Vite demo and Playwright + Applitools tests for packed @opentrons JS packages in js-package-testing/. Covers components, shared-data, step-generation, and protocol-visualization. Use for integration testing, package linking, external consumer bootstrap, or visual testing.
- Reads credentials
- Installs packages
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
Import CSS in app entry:
- Very specific: line 42
Import test from @applitools/eyes-playwright/fixture.
- Very specific: line 70
Always publishes dist-tag latest (no --tag flag).
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
JS package testing
Purpose
Reference external consumer for four npm packages:
@opentrons/shared-data@opentrons/step-generation@opentrons/components@opentrons/protocol-visualization
Builds packed artifacts (not live monorepo source), applies the same debt
patches as publish.mts (after pnpm pack rewrote catalog/workspace), links
via link:pack/..., and runs a Vite demo plus Playwright + Applitools Eyes.
Full external consumer docs: js-package-testing/README.md section "External consumer guide".
External consumer checklist
- Install all four
@opentrons/*at the same version. - Install peers:
react@18.2.0,react-dom@18.2.0,react-i18next@14.0.0,i18next@^19.8.3. - Import CSS in app entry:
@opentrons/protocol-visualization/styles@opentrons/components/styles/global@opentrons/components/styles
- Wrap app in
I18nextProvider. Loadprotocol_visualization(local JSON) plus shared component namespaces from@opentrons/components/localization(Node-safe; do not import resources from the package root in Node). - Vite: dedupe React, use
cssModulesSideEffectplugin,define: { 'process.env': {} }if needed.
Library runtime deps (styled-components, redux, etc.) are bundled; host app does not install them.
Applitools
- Set
APPLITOOLS_API_KEYvia.envinjs-package-testing/or shell export. - App name:
js-package-testing(playwright.config.ts). - Import
testfrom@applitools/eyes-playwright/fixture; useeyes.check().
Package linking strategy
Order matters: build packs first, patch manifests, then install.
make packin each library (pnpm packrewrites catalog/workspace) → extract topack/opentrons-*/scripts/patch-packed-packages.mtsapplies debt patches (same module aspublish.mts)pnpm installwithlink:pack/...depspnpm-workspace.yamloverrides pin transitive@opentrons/*topack/
Shared debt patches: scripts/package-json-patches.mts (not catalog/workspace;
those are pnpm's job).
Publish
From repo root:
node --experimental-strip-types scripts/next-npm-version.mts
node --experimental-strip-types scripts/publish.mts \
--version X.Y.Z-alpha.0 --dry-runFlow: debt-patch manifests → pnpm pack (protocol rewrite) → inject README/LICENSE
→ npm publish (OIDC on pnpm 10). When the monorepo is on pnpm 11+, switch
the last step to pnpm publish.
Always publishes dist-tag latest (no --tag flag). Dry-run needs no auth; real
local publish needs interactive npm 2FA (tokens disallowed). Prefer CI for releases.
Project structure
scripts/
├── next-npm-version.mts # patch bump from npm latest
├── npm-latest-versions.mts # print npm dist-tags
├── package-json-patches.mts # debt patches (files/exports/@types/peers)
├── patch-packed-packages.mts # applies debt patches to js-package-testing/pack/
└── publish.mts # pnpm pack + npm publish (pnpm publish on pnpm 11+)
js-package-testing/
├── Makefile
├── package.json
├── pnpm-workspace.yaml
├── playwright.config.ts
├── cssModulesSideEffect.ts
├── tests/
├── src/
│ ├── main.tsx # CSS imports + I18nextProvider
│ ├── i18n.ts
│ └── locale/en/protocol_visualization.json
└── pack/ # gitignoredMakefile targets
| Target | Description |
make setup | Build/extract/patch packs, pnpm install --frozen-lockfile |
make dev | Run Vite dev server (runs setup first) |
make test-setup | Install Playwright Chromium (make setup first) |
make test | Playwright + Eyes (needs APPLITOOLS_API_KEY) |
make build-local-packages | Rebuild and patch pack/ only |
make teardown | Remove pack/ and node_modules |
Quick start
# monorepo root
make setup-js
cd js-package-testing
make teardown setup devLint (monorepo root)
make lint-js, make lint-css, make format-js
Troubleshooting
- Module not found / broken links:
make clean-local-packages && make setup - Unstyled UI: missing CSS imports in app entry (see
src/main.tsx) - Translation keys visible: missing i18n namespace setup
- After library source edits:
make build-local-packagesthenpnpm install
In this repository18 other files it gives its agents.
- .cursor/rules/ai-server-api-docs-curation.mdcCursor rule
- .cursor/rules/monorepo-setup.mdcCursor rule
- ai-clientSkill
- ai-serverSkill
- analyses-snapshot-testingSkill
- css-modulesSkill
- docsSkill
- documented-mutationsSkill
- e2e-testingSkill
- grill-frontend-codeSkill
- locize-syncSkill
- opentrons-typescriptSkill
- protocol-authoringSkill
- protocol-designerSkill
- protocol-verificationSkill
- react-component-creationSkill
- robot-python-projectsSkill
- static-deploySkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

