[CLOV-1868] Part 3: add public Backpack Adoption NX plugin - #4916
Conversation
9e5de33 to
f3b31b6
Compare
22c4846 to
8763582
Compare
|
Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Adds a new public Nx plugin package (@skyscanner/backpack-adoption-nx-plugin) that provides per-project adoption analysis and a workspace-level aggregation report, plus CI/release automation for publishing to npm.
Changes:
- Introduces
analyzeandreportNx executors (with tests) and a small results file store to persist per-project outcomes. - Adds an esbuild-based packaging script and Nx project configuration for building/linting/typechecking/testing the plugin.
- Adds a GitHub Actions workflow for validation and manual OIDC-based npm publishing, plus minimal workspace config updates.
Reviewed changes
Copilot reviewed 18 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Enables TS imports with explicit .ts extensions at the workspace level. |
| packages/backpack-adoption-nx-plugin/tsconfig.json | Adds package-local TS config for strict typechecking. |
| packages/backpack-adoption-nx-plugin/src/index.ts | Adds package entrypoint (barrel) for exports. |
| packages/backpack-adoption-nx-plugin/src/executors/results-store.ts | Implements JSON read/write for per-project results. |
| packages/backpack-adoption-nx-plugin/src/executors/results-store-test.ts | Adds unit tests for results store behavior. |
| packages/backpack-adoption-nx-plugin/src/executors/report/schema.json | Defines schema for the report executor options. |
| packages/backpack-adoption-nx-plugin/src/executors/report/schema.d.ts | Adds TS types for report executor options. |
| packages/backpack-adoption-nx-plugin/src/executors/report/executor.ts | Implements aggregation of per-project guard results into one verdict. |
| packages/backpack-adoption-nx-plugin/src/executors/report/executor-test.ts | Adds unit tests for report aggregation logic. |
| packages/backpack-adoption-nx-plugin/src/executors/analyze/schema.json | Defines schema for the analyze executor options. |
| packages/backpack-adoption-nx-plugin/src/executors/analyze/schema.d.ts | Adds TS types for analyze executor options. |
| packages/backpack-adoption-nx-plugin/src/executors/analyze/executor.ts | Implements per-project analysis + result-file emission. |
| packages/backpack-adoption-nx-plugin/src/executors/analyze/executor-test.ts | Adds unit tests ensuring analysis is scoped and result file is written. |
| packages/backpack-adoption-nx-plugin/scripts/build.js | Bundles executors with esbuild and copies schemas into dist/. |
| packages/backpack-adoption-nx-plugin/project.json | Adds Nx targets (build/lint/test/typecheck) for the new package. |
| packages/backpack-adoption-nx-plugin/package.json | Defines publishable npm package metadata, deps, and scripts. |
| packages/backpack-adoption-nx-plugin/jest.config.js | Adds Jest configuration for package tests. |
| packages/backpack-adoption-nx-plugin/executors.json | Registers analyze/report executors for Nx consumption. |
| packages/backpack-adoption-nx-plugin/README.md | Documents installation, configuration, and publishing model. |
| packages/backpack-adoption-nx-plugin/.eslintrc | Adds package-specific ESLint configuration. |
| .gitignore | Ignores the new package’s build output. |
| .github/workflows/backpack-adoption-nx-plugin-release.yml | Adds validation + manual public npm publish workflow (OIDC trusted publishing). |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser. |
| @@ -0,0 +1,41 @@ | |||
| { | |||
| "name": "@skyscanner/backpack-adoption-nx-plugin", | |||
| "version": "0.1.0", | |||
There was a problem hiding this comment.
🔴 The first 0.1.0 release will fail at the "Stamp release version" step.
This is already 0.1.0, and on the first dispatch there are no backpack-adoption-nx-plugin/v* tags, so compute-next-semver with minor returns 0.1.0. The Publish job then runs npm version 0.1.0 --no-git-tag-version on a package already at 0.1.0, which exits non-zero:
npm error Version not changed, might want --allow-same-version
So the very first release breaks before it ever publishes. Two options:
- add
--allow-same-versionto thenpm versioncall in the workflow; or - set this to
0.0.0so the computed0.1.0is always a real bump (cleaner — it decouples the committed version from the tag-derived release version).
There was a problem hiding this comment.
Addressed in 9383140. The committed package version is now 0.0.0, so the first minor release computes and stamps 0.1.0 as a genuine version change.
| run: npm version "$RELEASE_VERSION" --no-git-tag-version --ignore-scripts | ||
| working-directory: packages/backpack-adoption-nx-plugin | ||
| - name: Publish public npm package | ||
| run: npm publish --ignore-scripts --access public --provenance |
There was a problem hiding this comment.
🟡 Publish-before-tag ordering with no tag pre-existence check.
The guard workflow guards tag races in both Validate and CreateTags. Here neither exists, and it runs npm publish (irreversible) before creating the tag. If the later tag push fails (a concurrent/retried dispatch where the tag already exists, or a transient push error), you end up published-but-untagged, and a re-run then fails because the npm version is immutable.
Consider mirroring the guard workflow and adding a "release tag does not already exist" check in Validate, so a duplicate is caught before the irreversible publish.
There was a problem hiding this comment.
Addressed in 9383140. Validate now rejects an existing computed release tag, and Publish fetches tags and repeats that check immediately before publishing. The workflow main-ref concurrency group also serializes manual release dispatches.
| "typecheck": "tsc --project tsconfig.json" | ||
| }, | ||
| "dependencies": { | ||
| "@nx/devkit": "22.7.1" |
There was a problem hiding this comment.
🟡 @nx/devkit is pinned hard to 22.7.1 while nx is a loose peer (>=20).
@nx/devkit is marked external in the esbuild bundle, so it's a real installed runtime dependency. A consumer on nx@20/21 gets @nx/devkit@22.7.1 alongside their older nx — but devkit is expected to track the nx major.
Was making @nx/devkit a peerDependency too (range aligned with nx) considered, so it resolves to the consumer's nx version rather than forcing 22.7.1?
There was a problem hiding this comment.
Addressed in 9383140. @nx/devkit is now a >=20 peer dependency aligned with the existing nx >=20 peer, so consumers resolve the devkit version compatible with their Nx installation instead of receiving a forced 22.7.1 copy.
|
Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser. |
Summary
@skyscanner/backpack-adoption-nx-pluginnpm package with per-projectanalyzeand aggregatereportNx executors.libs/backpack-adoption-analyzerinto compiled executor artifacts; consumers install no analyzer package.Release model
--access publicfrom a manual, non-dry-run dispatch onmain.Skyscanner/backpackandbackpack-adoption-nx-plugin-release.ymlbefore the first automated release.minorlabel represents the initial0.1.0release.Review scope
This PR is rebased on
mainafter Parts 1 and 2 merged. Its diff contains only the Nx plugin, its release workflow, and the minimal workspace configuration needed to bundle the existing analyzer.Validation
npm pack --dry-runon PRs.