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

Chore update picomatch #2993

Merged
merged 4 commits into from
Feb 18, 2025
Merged

Chore update picomatch #2993

merged 4 commits into from
Feb 18, 2025

Conversation

Romakita
Copy link
Collaborator

@Romakita Romakita commented Feb 18, 2025

Summary by CodeRabbit

  • New Features

    • Introduced browser-specific builds for enhanced client-side support.
  • Refactor

    • Streamlined the build process with improved configurations and automated cleaning routines.
  • Chores

    • Upgraded several dependencies and removed obsolete modules for improved stability and consistency.

Copy link

coderabbitai bot commented Feb 18, 2025

Walkthrough

This pull request updates multiple package configurations and Webpack settings to support a browser-specific build. The changes add new browser entry points in package.json files, update build scripts to include a clean step and browser build via Webpack, and introduce a new dependency on Webpack. Additionally, new Webpack configuration files are introduced for certain packages using a factory method, and redundant aliasing for the “picomatch” module is removed across several packages. An external dependency is also added to the root Webpack configuration.

Changes

File(s) Change Summary
packages/specs/ajv/package.json
packages/specs/exceptions/package.json
Added a new "browser" property (both top-level and in "exports"), introduced a "clean" script to remove the lib directory, updated the "build" script to run "clean" and "build:browser", added a "build:browser" script running webpack, and added a new devDependency on "webpack": "^5.75.0".
packages/specs/ajv/webpack.config.cjs
packages/specs/exceptions/webpack.config.cjs
Introduced new Webpack configuration files using the create method from @tsed/webpack-config with the respective package names and root set to __dirname.
packages/specs/json-mapper/webpack.config.cjs
packages/specs/schema/webpack.config.cjs
packages/third-parties/schema-formio/webpack.config.cjs
Removed the resolve configuration block including the alias that mapped picomatch to picomatch-browser.
packages/specs/schema/package.json Updated dependency versions: "picomatch" updated to "4.0.2", "@types/picomatch" updated to "3.0.2", and removed the "picomatch-browser" dependency.
tools/webpack/webpack.config.js Added @tsed/exceptions as an external dependency and removed the configuration block for the webpack-remove-code-blocks loader.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant BuildScript as Build Script (package.json)
    participant Clean as Clean Command ("rm -rf lib")
    participant Webpack as Webpack (build:browser)

    Dev->>BuildScript: Execute "build" script
    BuildScript->>Clean: Run "clean" script
    Clean-->>BuildScript: Lib directory removed
    BuildScript->>BuildScript: Run "barrels" & "build:ts"
    BuildScript->>Webpack: Run "build:browser" script
    Webpack-->>BuildScript: Generate browser-specific bundle
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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

@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: 5

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 80456f2 and 120044a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (9)
  • packages/specs/ajv/package.json (2 hunks)
  • packages/specs/ajv/webpack.config.cjs (1 hunks)
  • packages/specs/exceptions/package.json (2 hunks)
  • packages/specs/exceptions/webpack.config.cjs (1 hunks)
  • packages/specs/json-mapper/webpack.config.cjs (0 hunks)
  • packages/specs/schema/package.json (2 hunks)
  • packages/specs/schema/webpack.config.cjs (0 hunks)
  • packages/third-parties/schema-formio/webpack.config.cjs (0 hunks)
  • tools/webpack/webpack.config.js (1 hunks)
💤 Files with no reviewable changes (3)
  • packages/specs/schema/webpack.config.cjs
  • packages/third-parties/schema-formio/webpack.config.cjs
  • packages/specs/json-mapper/webpack.config.cjs
🧰 Additional context used
🪛 ESLint
packages/specs/ajv/webpack.config.cjs

[error] 3-3: Delete ,

(prettier/prettier)

packages/specs/exceptions/webpack.config.cjs

[error] 3-3: Delete ,

(prettier/prettier)

🔇 Additional comments (11)
packages/specs/ajv/package.json (5)

10-10: Added Browser Field (Top-level)
Adding the "browser": "./lib/browser/ajv.umd.min.js" field at the top-level explicitly directs bundlers to use the UMD build for browser environments. Ensure that the referenced file exists in the build output.


15-15: Exports Update for Browser Support
The addition of the "browser": "./lib/browser/ajv.umd.min.js" entry inside the "exports" block reinforces module resolution for browsers. This aligns well with modern bundler expectations.


22-22: Enhanced Build Script with Integrated Clean and Browser Build Steps
Modifying the "build" script to execute "yarn clean && yarn barrels && yarn build:ts && yarn run build:browser" promotes a more reliable build process by ensuring a clean slate and incorporating browser-specific builds. Confirm that all these sub-commands are correctly set up in your CI/CD pipeline.


23-23: Dedicated Browser Build Command
Introducing the "build:browser": "webpack" script cleanly separates the browser build process. Please verify that the necessary Webpack configuration is in place and referenced correctly so that the output file (ajv.umd.min.js) is generated as expected.


44-45: Webpack Dependency Addition and Vitest Update
Adding "webpack": "^5.75.0" to devDependencies is essential for running the new browser build script, and updating "vitest": "2.1.2" ensures consistency across development tooling. It is advisable to double-check compatibility with other parts of the build process and any related configuration across the repository.

packages/specs/ajv/webpack.config.cjs (1)

1-4: Overall Configuration Setup Looks Correct
The configuration correctly utilizes the create method from the @tsed/webpack-config package, specifying the current directory as the root and naming the configuration "ajv". This should effectively establish the intended build parameters.

🧰 Tools
🪛 ESLint

[error] 3-3: Delete ,

(prettier/prettier)

packages/specs/schema/package.json (1)

56-56: Minor Update for @types/picomatch
The type definitions for picomatch have been updated from 3.0.1 to 3.0.2. This update should ensure better alignment with the new functionality of the updated picomatch package. It is recommended to run a full type-check to catch any potential discrepancy if advanced type features are in use.

packages/specs/exceptions/webpack.config.cjs (1)

1-4: Overall configuration structure is correct.
The webpack configuration correctly uses the @tsed/webpack-config factory to create a configuration object with the proper root and name properties.

🧰 Tools
🪛 ESLint

[error] 3-3: Delete ,

(prettier/prettier)

packages/specs/exceptions/package.json (2)

10-15: Addition of browser-specific fields.
A new "browser" field is introduced at the top level and within the "exports" section to support browser-specific module resolution. Verify that the path ("./lib/browser/exceptions.umd.min.js") is correctly produced during the build process.


40-41: Updated devDependencies for build tools.
Adding "webpack": "^5.75.0" (together with the existing "vitest": "2.1.2") ensures that the build process can generate the browser bundle. Confirm that these versions are fully compatible with your overall project configuration.

tools/webpack/webpack.config.js (1)

31-31:

❓ Verification inconclusive

LGTM! Verify browser build compatibility.

The addition of @tsed/exceptions as an external dependency follows the established pattern and is consistent with other @tsed packages.

Let's verify that the package is properly configured for browser usage:


🏁 Script executed:

#!/bin/bash
# Description: Verify browser build configuration for @tsed/exceptions

# Check if @tsed/exceptions package.json has browser field
echo "Checking browser field in package.json..."
fd -t f "package.json" | xargs rg -l "@tsed/exceptions" | xargs rg "browser"

# Check if UMD build exists
echo "Checking for UMD build..."
fd -t f "@tsed/exceptions.*.umd.*.js$"

Length of output: 989


LGTM – External Dependency Configuration Verified
The addition of @tsed/exceptions to the externals in the webpack configuration is consistent with the existing pattern for other @tsed packages. Our verification shows that the package’s package.json (in packages/specs/exceptions) includes the expected browser field pointing to ./lib/browser/exceptions.umd.min.js. Note that the initial search for a UMD build file did not yield results; this is likely due to such files being generated during the build process rather than being present in the repository. Please ensure that the build pipeline generates and bundles the UMD file as expected for browser compatibility.

"import": "./lib/esm/index.js",
"default": "./lib/esm/index.js"
}
},
"scripts": {
"build": "yarn barrels && yarn build:ts",
"clean": "rm -rf lib",
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Clean Script Addition
The "clean": "rm -rf lib" script ensures that the output directory is purged before initiating new builds. If cross-platform compatibility (e.g., Windows systems) is a concern, consider using a tool like rimraf.

@@ -0,0 +1,4 @@
module.exports = require("@tsed/webpack-config").create({
root: __dirname,
name: "ajv",
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Remove Trailing Comma per ESLint/Prettier Guidelines
ESLint is flagging a trailing comma on line 3. Removing the trailing comma after the "ajv" value will align the code with prettier formatting rules.

Apply the following diff:

-  name: "ajv",
+  name: "ajv"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name: "ajv",
name: "ajv"
🧰 Tools
🪛 ESLint

[error] 3-3: Delete ,

(prettier/prettier)

@@ -40,7 +40,7 @@
"@tsed/openspec": "workspace:*",
"change-case": "^5.4.4",
"json-schema": "0.4.0",
"picomatch": "2.3.1",
"picomatch": "4.0.2",
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Major Version Update for picomatch Dependency
The version for picomatch has been updated from its previous version (assumed to be 2.3.1) to 4.0.2. This represents a major version bump and could potentially introduce breaking changes. Please review the picomatch changelog and verify that all usages in the codebase are compatible with any updated API behavior.

@@ -0,0 +1,4 @@
module.exports = require("@tsed/webpack-config").create({
root: __dirname,
name: "exceptions",
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Remove unnecessary trailing comma.
ESLint (prettier) flagged an extraneous comma after the "exceptions" value. If your linting rules require its removal, please update as follows:

-  name: "exceptions",
+  name: "exceptions"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name: "exceptions",
name: "exceptions"
🧰 Tools
🪛 ESLint

[error] 3-3: Delete ,

(prettier/prettier)

Comment on lines +21 to +23
"clean": "rm -rf lib",
"build": "yarn clean && yarn barrels && yarn build:ts && yarn run build:browser",
"build:browser": "webpack",
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Enhanced build scripts with browser build support.
The changes introduce a new "clean" script to remove the lib directory, update the "build" script to perform a clean step before building, and add a "build:browser" script that runs webpack. As these scripts now rely on Unix-like shell commands (e.g., rm -rf lib), consider using a cross-platform solution (such as the rimraf package) if Windows compatibility is a concern.

@Romakita Romakita merged commit 2121d55 into production Feb 18, 2025
12 checks passed
@Romakita Romakita deleted the chore-update-picomatch branch February 18, 2025 07:20
@Romakita
Copy link
Collaborator Author

🎉 This PR is included in version 8.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant