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

feat(deps): refactor node-workspace plugin to drop lerna-lite/core #2117

Merged
merged 4 commits into from
Nov 10, 2023

Conversation

chingor13
Copy link
Contributor

@chingor13 chingor13 commented Nov 6, 2023

Refactors the node-workspace plugin to use the internal workspace-plugin graph/dependency logic and built-in
package.json updaters to update the content. We do not need to rely on lerna internals.

Fixes #2116

feat: PackageJson updater can update dependencies

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Nov 6, 2023
@product-auto-label product-auto-label bot added size: l Pull request size is large. size: xl Pull request size is extra large. and removed size: m Pull request size is medium. size: l Pull request size is large. labels Nov 6, 2023
@chingor13 chingor13 changed the title test: refactor tests to run updaters from fixtures feat(deps): refactor node-workspace plugin to drop lerna-lite/core Nov 6, 2023
@chingor13 chingor13 requested a review from bcoe November 6, 2023 19:43
@chingor13 chingor13 marked this pull request as ready for review November 6, 2023 19:44
@chingor13 chingor13 requested review from a team as code owners November 6, 2023 19:44
@chingor13 chingor13 closed this Nov 6, 2023
@chingor13 chingor13 reopened this Nov 6, 2023
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: xl Pull request size is extra large. labels Nov 10, 2023
Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

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

LGTM, left a few questions.

src/plugins/node-workspace.ts Show resolved Hide resolved
@@ -157,7 +189,7 @@ describe('NodeWorkspace plugin', () => {
),
],
}),
buildMockCandidatePullRequest('node1', 'node', '2.2.2', {
buildMockCandidatePullRequest('node1', 'node', '3.3.3', {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do the mock values need to change? It would be good to see the same tests running with the same assertions against the refactored code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The node1 package (@here/pkgA) fixture is already at 3.3.3. The lerna updater only updated the dependency versions, so the output still had 3.3.3 as the @here/pkgA version. But switching to the PackageJson updater, it actually did change the value from 3.3.3 to 2.2.2 (which was invalid). To keep the test output the same before and after the refactor, I switched this value to be 3.3.3.

snapshot(dateSafe(nodeCandidate!.pullRequest.body.toString()));
snapshotUpdate(updates, 'package.json');
Copy link
Contributor

Choose a reason for hiding this comment

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

curious why this order changed.

Copy link
Contributor Author

@chingor13 chingor13 Nov 10, 2023

Choose a reason for hiding this comment

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

The snapshot name is based on an incrementing count. To make the snapshots only additive (and easier to review), I put these ones after the existing snapshot.

],
"author": "Ben Coe <[email protected]>",
"license": "ISC",
"devDependencies": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like that you tested very type of dependency here (dev, optional, peer).

Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

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

Glad to eliminate a dependency, good work.

@chingor13 chingor13 merged commit 65fa72e into main Nov 10, 2023
17 checks passed
@chingor13 chingor13 deleted the drop-lerna branch November 10, 2023 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't build action with release-please v16
2 participants