Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Lerna for versioning and publishing #9125

Merged
merged 22 commits into from Feb 9, 2023
Merged

Conversation

bigtimebuddy
Copy link
Member

@bigtimebuddy bigtimebuddy commented Feb 1, 2023

This PR builds on existing work (removing the use of Lerna within the project and replaced it with workspaces and workspaces-run). The holdouts for remove Lerna completely were version bumping and publishing.

This PR manually recreates the the version bumping mechanism from Lerna. Publish was an easy replacement with workspaces-run. Luckily our version bump strategy is very simple (e.g., lerna version --exact --force-publish). Replicating this was straightforward.

Features

  • Checks that the workspace is clean before release
  • Supports interactive version bumping (major, minor, patch, custom)
  • Validate custom version bumps are Semver
  • Automatically commit version bump and git tag
  • Automatically push commit and tag

Other Changes

  • Delete scripts/fixPeerVersions.ts, as it is no longer used
  • Remove npx --yes npm@7.20.2 i --package-lock-only workaround
  • Remove versions from packages and use relative path references for cleaner version commits

Verifying

  1. Run npx ts-node scripts/release.ts --no-push
  2. Notice versions are bumped, version commit made and tag are created

  1. Run npm ts-node scripts/prepublish.ts
  2. Notice exact versions are added to all packages and dependencies

Copy link
Member

@SuperSodaSea SuperSodaSea left a comment

Choose a reason for hiding this comment

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

It works fine under npm@8.19.3 but doesn't seem to work under npm@9.4.1.


I tried npm run release and it seems that npm install --package-lock-only in release.ts is not working properly.

With network disabled:

? Release version (currently v7.1.2): Patch (v7.1.3)
npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/@pixi%2fparticle-container failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.

With network enabled:

? Release version (currently v7.1.2): Patch (v7.1.3)
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @pixi/particle-container@7.1.3.
npm ERR! notarget In most cases you or one of your dependencies are requesting 
npm ERR! notarget a package version that doesn't exist.

@bigtimebuddy
Copy link
Member Author

I think you found a npm regression in npm/cli#3964

scripts/utils/spawn.ts Outdated Show resolved Hide resolved
@bigtimebuddy
Copy link
Member Author

Okay, I'm not sure what's going on in npm@9 and --package-lock-only, I couldn't consistently get a repro on that using my old example. For now, I pinned it to the latest v8, which works.

@bigtimebuddy
Copy link
Member Author

bigtimebuddy commented Feb 2, 2023

One idea I have to circumvent this whole version bumping issue is to use file:.. references in the package.json's of all the packages and then replace with an exact version before publish. This would completely eliminate the need to sync versions when bumping, and it would also make the version commit much simpler, since it would only be changing the package.json and lock file.

Edit: Okay, I made this change. I think it's much better.

@bigtimebuddy
Copy link
Member Author

Need to figure out why Rollup hates the file:../ pathing for dependencies

@SuperSodaSea
Copy link
Member

Should we also update tools/integration-tests/package.json?

scripts/release.ts Outdated Show resolved Hide resolved
scripts/prepublish.ts Outdated Show resolved Hide resolved
Co-authored-by: Tianlan Zhou <bobby825@126.com>
scripts/release.ts Outdated Show resolved Hide resolved
scripts/release.ts Outdated Show resolved Hide resolved
scripts/release.ts Outdated Show resolved Hide resolved
bigtimebuddy and others added 3 commits February 3, 2023 07:02
Co-authored-by: Tianlan Zhou <bobby825@126.com>
Co-authored-by: Tianlan Zhou <bobby825@126.com>
@bigtimebuddy bigtimebuddy requested a review from a team February 7, 2023 12:42
@bigtimebuddy bigtimebuddy added the ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t label Feb 8, 2023
@bigtimebuddy bigtimebuddy merged commit 0824e55 into dev Feb 9, 2023
@bigtimebuddy bigtimebuddy deleted the chore/remove-lerna branch February 9, 2023 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants