Skip to content

refactor!: bump @pkgr/core and tinyexec, drop tslib #218

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

Merged
merged 2 commits into from
Jun 3, 2025
Merged

Conversation

JounQin
Copy link
Member

@JounQin JounQin commented Jun 3, 2025

Important

Refactor to update dependencies, remove tslib, and adjust CI and build configurations.

  • Dependencies:
    • Bump @pkgr/core to ^0.3.3 and tinyexec to ^1.0.1 in package.json.
    • Remove tslib from dependencies in package.json.
    • Update yarnPath to yarn-4.9.1.cjs in .yarnrc.yml.
  • CI:
    • Remove Node.js versions 14 and 16 from ci.yml.
    • Simplify build and lint steps by removing conditional checks for Node.js versions.
  • Build and Lint:
    • Update build script to use tsdown directly in package.json.
    • Modify lint:tsc script to use tsconfig.base.json.
  • Source Code:
    • Refactor detect function in git.ts and hg.ts to use new findUp API.
    • Mock tinyexec in pretty-quick.spec.ts for testing.
  • Configuration:
    • Add tsdown.config.mts for build configuration.
    • Update tsconfig.base.json to reflect changes in build process.

This description was created by Ellipsis for e6bb668. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Chores
    • Updated dependencies, including major version upgrades and removal of unused packages.
    • Upgraded Yarn to version 4.9.1 and updated Node.js version requirements.
    • Simplified build scripts and TypeScript configuration files.
    • Modified CI workflow to test only on supported Node.js versions.
    • Removed obsolete configuration and patch files.
  • Refactor
    • Improved internal logic for version control detection.
  • Tests
    • Updated tests to mock the correct dependencies.
  • New Features
    • Added a new build configuration file to support multiple build targets.

@JounQin JounQin requested a review from Copilot June 3, 2025 15:32
@JounQin JounQin self-assigned this Jun 3, 2025
@JounQin JounQin added dependencies Pull requests that update a dependency file BREAKING labels Jun 3, 2025
Copy link

changeset-bot bot commented Jun 3, 2025

🦋 Changeset detected

Latest commit: e6bb668

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
pretty-quick Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

coderabbitai bot commented Jun 3, 2025

Walkthrough

This update modernizes the project by upgrading dependencies, removing obsolete files, and refactoring configuration. Node.js and Yarn versions are bumped, TypeScript and build scripts are streamlined, and SCM detection logic is updated to use a new findUp API. Several configuration and patch files are removed or adjusted.

Changes

Files/Group Change Summary
.changeset/heavy-rabbits-repeat.md Added changeset documenting major dependency and configuration updates.
.github/workflows/ci.yml Updated CI matrix: removed Node.js 14/16, simplified build/lint step conditions.
.yarnrc.yml, package.json Upgraded Yarn (3.6.4 → 4.9.1), updated dependencies, removed tslib, updated Node.js engine range.
patches/ts-jest+29.3.4.patch Removed patch file and related transpile logic.
src/scms/git.ts, src/scms/hg.ts Refactored SCM detection to use new findUp API with options object.
src/tsconfig.json Deleted TypeScript config for src.
test/pretty-quick.spec.ts Changed mocked module from execa to tinyexec.
tsconfig.base.json Edited comment to remove reference to @pkgr/rollup.
tsconfig.json Simplified config: removed ts-node and project references, kept minimal options.
tsdown.config.mts Added new build config using tsdown, defining three build targets (ESM/CJS, CLI).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant SCM Detector (git/hg)
    participant findUp

    User->>CLI: Run pretty-quick
    CLI->>SCM Detector (git/hg): detect(directory)
    SCM Detector (git/hg)->>findUp: findUp({ entry, search, type })
    findUp-->>SCM Detector (git/hg): Return path or null
    SCM Detector (git/hg)-->>CLI: Return detected SCM root or null
    CLI-->>User: Output result
Loading

Possibly related PRs

  • prettier/pretty-quick#206: Updates dependencies (@pkgr/core, tinyexec), removes tslib, and refactors SCM detection code to use findUp from @pkgr/core.
  • prettier/pretty-quick#216: Reverts tinyexec from 1.0.1 to 0.3.2 due to ESM-only compatibility issues, directly related to the tinyexec upgrade in this PR.
  • prettier/pretty-quick#212: Downgrades tinyexec from 1.0.1 to 0.3.2 due to ESM-only compatibility issues, directly opposing the tinyexec upgrade in this PR.

Suggested labels

internal

Poem

A rabbit hops with yarn anew,
Upgrading tools and configs too.
Old files are gone, the path is clear,
SCM detection brings us cheer!
With TypeScript trimmed and scripts all neat,
This code refactor feels complete.
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/scms/hg.ts

Oops! Something went wrong! :(

ESLint: 9.28.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

test/pretty-quick.spec.ts

Oops! Something went wrong! :(

ESLint: 9.28.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

src/scms/git.ts

Oops! Something went wrong! :(

ESLint: 9.28.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codesandbox-ci bot commented Jun 3, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@JounQin JounQin changed the title refactor: bump @pkgr/core and tinyexec, drop tslib refactor!: bump @pkgr/core and tinyexec, drop tslib Jun 3, 2025
Copy link

pkg-pr-new bot commented Jun 3, 2025

Open in StackBlitz

npm i https://pkg.pr.new/pretty-quick@218

commit: e6bb668

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Refactors build and dependency configurations by upgrading core packages, removing tslib, and aligning tooling to updated APIs.

  • Introduces a tsdown config for unified ESM/CJS builds
  • Updates findUp usage in SCM modules for the new API shape
  • Removes the custom ts-jest patch, drops tslib, and bumps package versions and CI/Yarn settings

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tsdown.config.ts Added defineConfig entries for ESM and CJS outputs
tsconfig.base.json Removed outdated comment
test/pretty-quick.spec.ts Switched mock from execa to tinyexec
src/tsconfig.json Removed redundant project tsconfig
src/scms/hg.ts Updated findUp call to use object-based API
src/scms/git.ts Updated findUp call to include both file and directory types
patches/ts-jest+29.3.4.patch Deleted patch contents
package.json Bumped package manager, engines, scripts, and dependencies
.yarnrc.yml Updated yarnPath and removed unused plugin
.github/workflows/ci.yml Simplified Node.js matrix to recent versions
Comments suppressed due to low confidence (3)

package.json:17

  • The bin field points to lib/cli.mjs but tsdown may emit lib/cli.mts; ensure the output filename and extension match the bin path or adjust your build config accordingly.
"bin": "lib/cli.mjs"

.github/workflows/ci.yml:17

  • The CI matrix no longer runs on Node 14.18.x or 16.x, but the engines field includes those versions; consider testing those ranges to ensure compatibility.
matrix:
          node:

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 7afe3b1 in 1 minute and 18 seconds. Click for details.
  • Reviewed 188 lines of code in 8 files
  • Skipped 7 files when reviewing.
  • Skipped posting 10 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/workflows/ci.yml:17
  • Draft comment:
    Removed Node 14/16 from CI matrix and removed conditional build/lint steps. Confirm this was intentional.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. .yarnrc.yml:9
  • Draft comment:
    Removed the interactive tools plugin. Verify it’s no longer needed for your workflow.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. package.json:57
  • Draft comment:
    Simplified build script to use 'tsdown'. Confirm that all build steps are now handled correctly by the tsdown configuration.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. package.json:61
  • Draft comment:
    Updated lint:tsc script to 'tsc -p tsconfig.base.json'. Ensure this covers all intended TypeScript checks.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
5. package.json:70
  • Draft comment:
    Dropped tslib dependency. Confirm that no runtime code now implicitly requires tslib.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
6. src/scms/git.ts:9
  • Draft comment:
    Refactored findUp usage with an options object. Verify it correctly detects both files and directories for '.git'.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
7. src/scms/hg.ts:8
  • Draft comment:
    Updated findUp usage and removed fs check for hg. Ensure that only directories are detected as intended.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
8. test/pretty-quick.spec.ts:5
  • Draft comment:
    Updated jest.mock to 'tinyexec' (instead of 'execa'). Confirm tests still behave as expected.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
9. tsconfig.base.json:1
  • Draft comment:
    Updated comment to reflect removal of @pkgr/rollup usage. Ensure ESLint configuration remains correct.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
10. tsdown.config.ts:21
  • Draft comment:
    Review the 'noExternal: "tinyexec"' setting and the comment 'ESM only' in the CJS config. Clarify if this is intended for the CJS build.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_jhJj2BZZo6evyHXO

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@codecov-commenter
Copy link

codecov-commenter commented Jun 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.97%. Comparing base (fecd416) to head (e6bb668).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #218      +/-   ##
==========================================
- Coverage   87.11%   86.97%   -0.14%     
==========================================
  Files           9        9              
  Lines         194      192       -2     
  Branches       44       44              
==========================================
- Hits          169      167       -2     
  Misses         25       25              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JounQin JounQin force-pushed the refactor/bundle branch from e04800b to ea078ba Compare June 3, 2025 15:35
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed ea078ba in 1 minute and 44 seconds. Click for details.
  • Reviewed 69 lines of code in 4 files
  • Skipped 1 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/heavy-rabbits-repeat.md:1
  • Draft comment:
    Changeset frontmatter looks valid. Confirm that quoting the key ('pretty-quick') is intentional per Changesets guidelines.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. .github/workflows/ci.yml:41
  • Draft comment:
    Removed the conditional check on the Build step. This is fine since the matrix now excludes Node versions 14/16.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is purely informative, explaining a change that was made without suggesting any action or asking for clarification. It doesn't provide any actionable feedback or raise any concerns about the code.
3. .github/workflows/ci.yml:47
  • Draft comment:
    Removed version condition from the Lint step. Verify that excluding Node 14/16 in the matrix makes this check unnecessary.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify that a change is unnecessary due to the exclusion of certain Node versions. This falls under asking the author to confirm their intention or to double-check things, which is against the rules.
4. .yarnrc.yml:9
  • Draft comment:
    Interactive tools plugin has been removed. Confirm that it isn’t required for your workflows or interactive sessions.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to confirm that the removal of the interactive tools plugin is intentional and won't affect workflows. This is a request for confirmation, which violates the rule against asking the author to confirm their intention.
5. package.json:13
  • Draft comment:
    Updated yarn version and Node engine spec. Ensure that requiring '^14.18.0 || >=16.0.0' (excluding older 14.x versions) is intentional.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_lI486LNUQIwWnyEs

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@JounQin JounQin force-pushed the refactor/bundle branch from ea078ba to e6bb668 Compare June 3, 2025 15:38
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed e6bb668 in 1 minute and 15 seconds. Click for details.
  • Reviewed 81 lines of code in 5 files
  • Skipped 1 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .changeset/heavy-rabbits-repeat.md:1
  • Draft comment:
    Changeset file format is correct; consider adding more descriptive details if needed.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the PR author to add more details to the changeset file, which is similar to asking for an update to the PR description. This violates the rule against asking the author to update the PR description or similar documentation.
2. .github/workflows/ci.yml:19
  • Draft comment:
    Removed Node 14/16 entries and related conditionals—ensure CI matrix aligns with supported Node engine versions.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to ensure that the CI matrix aligns with supported Node engine versions after removing Node 14/16 entries. This is a request for confirmation and does not provide a specific code suggestion or ask for a specific test to be written. It violates the rule against asking the author to ensure something is aligned or intended.
3. .yarnrc.yml:9
  • Draft comment:
    Yarn config updated to v4.9.1 and removed the interactive tools plugin; verify that this change meets your workflow requirements.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is about a dependency change and asks the author to verify if the change meets their workflow requirements. This violates the rule against asking the author to verify or ensure behavior is intended.
4. package.json:12
  • Draft comment:
    Updated packageManager and engines fields; ensure Node version support is consistent with your CI matrix and dependency updates for @pkgr/core and tinyexec are correct.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to ensure consistency between Node version support and CI matrix, as well as correctness of dependency updates. This falls under asking the author to double-check things, which is against the rules.
5. tsdown.config.mts:1
  • Draft comment:
    Refactored tsdown config: renaming to .mts and using explicit type import is a good practice. Ensure build tools recognize the new file extension.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to ensure that build tools recognize a new file extension after a configuration change. This is a general request to ensure something works, which violates the rule against asking the author to ensure behavior is intended or tested.

Workflow ID: wflow_p7PW3aANUuBlMx4C

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
tsdown.config.mts (2)

19-24: Clarify or update the “ESM only” comment on the CJS target
The inline comment reads // ESM only, but this block produces a CJS build. Consider rewording to explain that you’re bundling an ESM‐only dependency (tinyexec), not that the output itself is ESM.


23-23: Use an array for noExternal for future extensibility
If you ever need to bundle additional packages, an array shape will scale better. For example:

-noExternal: 'tinyexec',
+noExternal: ['tinyexec'],
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fecd416 and e6bb668.

⛔ Files ignored due to path filters (4)
  • .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs is excluded by !**/.yarn/**
  • .yarn/releases/yarn-3.6.4.cjs is excluded by !**/.yarn/**
  • .yarn/releases/yarn-4.9.1.cjs is excluded by !**/.yarn/**
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (12)
  • .changeset/heavy-rabbits-repeat.md (1 hunks)
  • .github/workflows/ci.yml (0 hunks)
  • .yarnrc.yml (1 hunks)
  • package.json (3 hunks)
  • patches/ts-jest+29.3.4.patch (0 hunks)
  • src/scms/git.ts (1 hunks)
  • src/scms/hg.ts (1 hunks)
  • src/tsconfig.json (0 hunks)
  • test/pretty-quick.spec.ts (1 hunks)
  • tsconfig.base.json (1 hunks)
  • tsconfig.json (1 hunks)
  • tsdown.config.mts (1 hunks)
💤 Files with no reviewable changes (3)
  • src/tsconfig.json
  • .github/workflows/ci.yml
  • patches/ts-jest+29.3.4.patch
🧰 Additional context used
🪛 Biome (1.9.4)
tsconfig.base.json

[error] 2-2: Expected a property but instead found '// used by ESLint'.

Expected a property here.

(parse)

🔇 Additional comments (15)
.yarnrc.yml (1)

13-13:

❓ Verification inconclusive

Verify Yarn 4.x compatibility and breaking changes.

The upgrade from Yarn 3.6.4 to 4.9.1 represents a major version bump. Please ensure that all workflows, CI/CD pipelines, and development environments are compatible with Yarn 4.x.


🌐 Web query:

What are the breaking changes between Yarn 3.x and Yarn 4.x?

💡 Result:

Yarn 4.0 was released on October 23, 2023, after more than a year of development and numerous release candidates[1]. This major version brings several breaking changes compared to Yarn 3.x. Here's a comprehensive overview of what's different:

System Requirements

  • Node.js 18+ is now required, compared to previous versions that supported Node 10+[1][7]

Default Behaviors

  • New projects created with yarn init no longer enable Zero-Install by default[1]
  • New projects will use Corepack rather than yarnPath for version management[1]
  • All official plugins (typescript, interactive-tools, etc.) are now included by default[1]

Command Changes

  • The yarn workspaces foreach command has an altered syntax[1]
  • The --production flag for yarn install has been removed; use yarn workspaces focus --all --production instead[10]
  • You should use yarn dlx instead of yarn global for running one-off commands[3]
  • Scripts are now handled differently - you need to explicitly call pre and post scripts[3]

Configuration Changes

  • PnP hooks are now called .pnp.cjs instead of .pnp.js[7]
  • Virtual folders have been renamed[7]
  • Configuration has been reworked, with only predefined key-value pairs being supported[10]

Architectural Changes

  • Prolog constraints are deprecated and have been replaced with a JavaScript-based engine with optional TypeScript support[1]
  • A new optional enableConstraintsChecks setting will make Yarn run constraints as part of yarn install[1]

Performance Improvements

Yarn 4.0 includes significant performance enhancements compared to 3.6.0, running about 4 times faster according to benchmarks[1]. These changes make Yarn comparable to pnpm in terms of speed in most scenarios.

Migrating to Yarn 4

To upgrade an existing project to Yarn 4, you need to run:

yarn set version stable
yarn install

This will update your project to use the most recent stable binary[8][9]. After upgrading, you'll need to update any scripts or CI configurations to account for the breaking changes.

In Dockerfiles, you'll need to ensure you copy the Yarn 4 installation files:

COPY .yarn ./.yarn
COPY .yarnrc.yml ./

And for multi-stage Dockerfiles, each stage that runs yarn commands will need these files[10].

Citations:


Verify Yarn 4.x compatibility and update workflows

The jump from Yarn 3.6.4 to 4.9.1 (Yarn 4.x) includes several breaking changes. Please ensure your project and CI/CD environments are updated accordingly:

  • Upgrade Node.js to v18 or higher.
  • Remove --production from yarn install; use
    yarn workspaces focus --all --production instead.
  • Switch any global invocations to yarn dlx rather than yarn global.
  • Update scripts handling: explicitly invoke pre/post hooks when needed.
  • Adjust yarn workspaces foreach calls to the new syntax.
  • Rename PnP hook files from .pnp.js to .pnp.cjs and update any references.
  • Verify that your .yarnrc.yml uses only the supported predefined configuration keys.
  • In Dockerfile (or other container stages) copy both the .yarn directory and .yarnrc.yml into each stage that runs Yarn.
  • Confirm any custom plugins or virtual folder setups still work under the new defaults (all official plugins are now included by default).

Please review and update all local, CI, and Docker workflows to account for these changes before merging.

src/scms/hg.ts (1)

9-14:

✅ Verification successful

LGTM! API modernization improves code clarity.

The refactor to use the options object with findUp is a good improvement that makes the search criteria more explicit and readable. The elimination of the explicit fs.statSync check suggests the new API handles directory existence internally.

Please verify that the new findUp API behavior is equivalent to the previous implementation:


🏁 Script executed:

#!/bin/bash
# Description: Verify findUp API usage and ensure it's consistent across SCM files
# Expected: Both git.ts and hg.ts should use similar findUp patterns

# Check findUp usage patterns in SCM files
rg -A 5 -B 2 "findUp\(" src/scms/

Length of output: 697


✅ findUp API usage is correct and consistent

Both hg.ts and git.ts now use the options‐object form of findUp and match the intended behavior:

  • src/scms/hg.ts searches for a .hg directory only (as before).
  • src/scms/git.ts searches for a .git file or directory (to support worktrees).

No further changes needed—this modernization preserves the original logic and improves clarity.

src/scms/git.ts (1)

9-13: LGTM! Correctly handles Git worktree scenarios.

The refactor to use the options object is consistent with the hg.ts change, and correctly specifies type: ['file', 'directory'] to handle both regular Git repositories (where .git is a directory) and Git worktrees (where .git is a file containing a reference to the actual Git directory).

test/pretty-quick.spec.ts (1)

5-5: LGTM! Mock update aligns with dependency refactor.

The change from mocking 'execa' to 'tinyexec' correctly reflects the dependency update in package.json.

.changeset/heavy-rabbits-repeat.md (1)

1-6: Well-documented major version bump.

The changeset correctly identifies this as a major version bump with breaking changes, which is appropriate given the significant dependency updates and tslib removal.

tsconfig.json (1)

1-6: Configuration simplification looks good.

The removal of ts-node configuration and project references aligns with the build tooling modernization using tsdown.

package.json (5)

13-13: Yarn version upgrade looks good.

Upgrading to Yarn 4.9.1 provides access to newer features and improvements.


15-15: Node version requirement update is reasonable.

The change from ">=14" to "^14.18.0 || >=16.0.0" ensures compatibility with the updated dependencies while maintaining support for recent LTS versions.


57-57: Build script simplification is appropriate.

Consolidating to a single tsdown command streamlines the build process and aligns with the build tooling modernization.


61-61: TypeScript lint script update is consistent.

Using tsconfig.base.json aligns with the TypeScript configuration simplification.


70-70:

❓ Verification inconclusive

Verify compatibility of major dependency version bumps.

The updates include major version changes that could introduce breaking changes:

  • @pkgr/core: ^0.2.7 → ^0.3.3
  • tinyexec: ^0.3.2 → ^1.0.1

Please ensure these updates are compatible and don't introduce breaking changes.

Also applies to: 75-75


🏁 Script executed:

#!/bin/bash
# Description: Check for breaking changes in the updated dependencies

echo "Checking for breaking changes in dependency updates..."

# Check tinyexec changelog for v1.0.0 breaking changes
echo "=== tinyexec v1.0.0 changelog ==="
curl -s https://api.github.com/repos/tinylibs/tinyexec/releases/tag/v1.0.0 | jq -r '.body // "No release notes found"'

# Check @pkgr/core changelog for v0.3.0 breaking changes
echo -e "\n=== @pkgr/core v0.3.0+ releases ==="
curl -s https://api.github.com/repos/pkgr/pkgr/releases | jq -r '.[] | select(.tag_name | startswith("@pkgr/[email protected]")) | "\(.tag_name): \(.body // "No release notes")"' | head -5

# Search for tinyexec usage patterns in the codebase
echo -e "\n=== Current tinyexec usage patterns ==="
rg "tinyexec|TinyExec" --type ts --type js -A 3 -B 1

Length of output: 9566


Double-check major version upgrades in package.json

Please verify that the following major bumps introduce no breaking changes:

  • @pkgr/core (0.2.7 → 0.3.3)
    • Used in src/scms/hg.ts and src/scms/git.ts via import { findUp } from '@pkgr/core'
    → Confirm findUp (and any other exported helpers) behave the same.

  • tinyexec (0.3.2 → 1.0.1)
    • Heavily used as import { exec } from 'tinyexec' in SCM modules and mocked in tests
    → Ensure the exec() signature, returned Output shape, and error-handling haven’t changed.

tsdown.config.mts (4)

1-2: Proper use of type-only import for cleanliness
Using the type UserConfig import via import { type UserConfig } ... is ideal to avoid including types in your runtime bundle.


3-5: Shared configuration pattern reduces duplication
Nice extraction of sharedConfig to apply common settings across multiple build targets and minimize repetition.


8-12: Verify the default entry point for the first ESM build
Since the first ESM target omits an explicit entry, please confirm that tsdown will correctly default to your intended source (e.g., src/index.*).


13-18: Explicit CLI entry for the secondary ESM build
Specifying entry: 'src/cli.mts' makes it clear that this target builds the CLI separately—good clarity.

@JounQin JounQin merged commit 62df46d into master Jun 3, 2025
20 of 23 checks passed
@JounQin JounQin deleted the refactor/bundle branch June 3, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BREAKING dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants