Skip to content

[CLOV-1868] Part 3: add public Backpack Adoption NX plugin - #4916

Merged
Vincent Liu (xiaogliu) merged 10 commits into
mainfrom
xiaogliu/adoption-nx-plugin
Jul 24, 2026
Merged

[CLOV-1868] Part 3: add public Backpack Adoption NX plugin#4916
Vincent Liu (xiaogliu) merged 10 commits into
mainfrom
xiaogliu/adoption-nx-plugin

Conversation

@xiaogliu

@xiaogliu Vincent Liu (xiaogliu) commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds the public @skyscanner/backpack-adoption-nx-plugin npm package with per-project analyze and aggregate report Nx executors.
  • Bundles the private analyzer from libs/backpack-adoption-analyzer into compiled executor artifacts; consumers install no analyzer package.
  • Adds validation and manual release automation for the public npm package.

Release model

  • The plugin is published with --access public from a manual, non-dry-run dispatch on main.
  • The release job uses npm trusted publishing (GitHub Actions OIDC), not a long-lived npm publish token. npm must be configured for Skyscanner/backpack and backpack-adoption-nx-plugin-release.yml before the first automated release.
  • The minor label represents the initial 0.1.0 release.

Review scope

This PR is rebased on main after 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

  • The workflow validates lint, typecheck, tests, build, and npm pack --dry-run on PRs.
  • The prior release-workflow validation passed; the rebased workflow run is the final CI verification.

Comment thread .github/workflows/backpack-adoption-nx-plugin-release.yml Fixed
Comment thread .github/workflows/backpack-adoption-nx-plugin-release.yml Fixed
Comment thread .github/workflows/backpack-adoption-nx-plugin-release.yml Fixed
@xiaogliu
Vincent Liu (xiaogliu) force-pushed the xiaogliu/adoption-analyzer branch from 9e5de33 to f3b31b6 Compare July 21, 2026 08:38
Base automatically changed from xiaogliu/adoption-analyzer to main July 22, 2026 06:18
@xiaogliu
Vincent Liu (xiaogliu) force-pushed the xiaogliu/adoption-nx-plugin branch from 22c4846 to 8763582 Compare July 22, 2026 10:05
@xiaogliu Vincent Liu (xiaogliu) added the minor Non breaking change label Jul 22, 2026
@xiaogliu
Vincent Liu (xiaogliu) marked this pull request as ready for review July 22, 2026 10:06
Copilot AI review requested due to automatic review settings July 22, 2026 10:06
Comment thread .github/workflows/backpack-adoption-nx-plugin-release.yml Fixed
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 analyze and report Nx 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.

Comment thread packages/backpack-adoption-nx-plugin/src/executors/analyze/executor.ts Outdated
Comment thread packages/backpack-adoption-nx-plugin/src/executors/report/executor.ts Outdated
Comment thread packages/backpack-adoption-nx-plugin/src/index.ts Outdated
Comment thread packages/backpack-adoption-nx-plugin/src/executors/results-store.ts
@xiaogliu Vincent Liu (xiaogliu) changed the title Add public Backpack Adoption NX plugin [CLOV-1868] Part 3: add public Backpack Adoption NX plugin Jul 22, 2026
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser.

@wpe1arhy Iris Li (wpe1arhy) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM — tests and docs are solid; the main one is that the first release will fail outright.

@@ -0,0 +1,41 @@
{
"name": "@skyscanner/backpack-adoption-nx-plugin",
"version": "0.1.0",

@wpe1arhy Iris Li (wpe1arhy) Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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-version to the npm version call in the workflow; or
  • set this to 0.0.0 so the computed 0.1.0 is always a real bump (cleaner — it decouples the committed version from the tag-derived release version).

@xiaogliu Vincent Liu (xiaogliu) Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@wpe1arhy Iris Li (wpe1arhy) Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

@xiaogliu Vincent Liu (xiaogliu) Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

@wpe1arhy Iris Li (wpe1arhy) Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 @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?

@xiaogliu Vincent Liu (xiaogliu) Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Visit https://backpack.github.io/storybook-prs/4916 to see this build running in a browser.

@wpe1arhy Iris Li (wpe1arhy) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiaogliu
Vincent Liu (xiaogliu) merged commit 9b6767a into main Jul 24, 2026
17 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the xiaogliu/adoption-nx-plugin branch July 24, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Non breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants