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

fix(repo): fix generate package script #17300

Merged
merged 1 commit into from
Feb 28, 2025
Merged

Conversation

Nodonisko
Copy link
Contributor

Description

My best shot to fix package generator

Related Issue

Resolve

Screenshots:

Copy link
Contributor

@mroz22 mroz22 left a comment

Choose a reason for hiding this comment

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

works for me

@Nodonisko Nodonisko enabled auto-merge (squash) February 28, 2025 09:57
Copy link

coderabbitai bot commented Feb 28, 2025

Walkthrough

This pull request makes changes to update the tsx package version across multiple package.json files, standardizing it from either ^4.16.3 (or in one instance ^4.19.2) to ^4.19.3 within both devDependencies and dependencies in various project packages. Additionally, the command for the generate-package script in the root package.json has been modified from directly executing a JavaScript file using tsx to invoking a workspace command. In the scripts directory, the generatePackage.ts file has been updated to enhance type definitions and scope validation, and to construct file paths using Node’s path.join method rather than simple string concatenation. A new script and a related dependency for tsx have also been added in the scripts/package.json file.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 38b231a and 86b1473.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (24)
  • package.json (2 hunks)
  • packages/blockchain-link-types/package.json (1 hunks)
  • packages/blockchain-link-utils/package.json (1 hunks)
  • packages/blockchain-link/package.json (1 hunks)
  • packages/connect-common/package.json (1 hunks)
  • packages/connect-examples/node/package.json (1 hunks)
  • packages/connect-explorer/package.json (1 hunks)
  • packages/connect-mobile/package.json (1 hunks)
  • packages/connect-web/package.json (1 hunks)
  • packages/connect/package.json (1 hunks)
  • packages/crypto-utils/package.json (1 hunks)
  • packages/env-utils/package.json (1 hunks)
  • packages/protobuf/package.json (1 hunks)
  • packages/protocol/package.json (1 hunks)
  • packages/schema-utils/package.json (1 hunks)
  • packages/suite-data/package.json (1 hunks)
  • packages/suite-web/package.json (1 hunks)
  • packages/transport/package.json (1 hunks)
  • packages/utils/package.json (1 hunks)
  • packages/utxo-lib/package.json (1 hunks)
  • packages/websocket-client/package.json (1 hunks)
  • scripts/generatePackage.ts (4 hunks)
  • scripts/package.json (2 hunks)
  • suite-common/message-system/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (12)
  • packages/blockchain-link/package.json
  • packages/schema-utils/package.json
  • packages/suite-web/package.json
  • packages/transport/package.json
  • packages/suite-data/package.json
  • packages/connect-common/package.json
  • packages/connect-examples/node/package.json
  • packages/crypto-utils/package.json
  • packages/utils/package.json
  • packages/blockchain-link-utils/package.json
  • suite-common/message-system/package.json
  • packages/utxo-lib/package.json
⏰ Context from checks skipped due to timeout of 90000ms (19)
  • GitHub Check: PR-check / node-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: PR-check / node-override init-api-flaky
  • GitHub Check: PR-check / web-override init-api-flaky
  • GitHub Check: PR-check / web-authorizeCoinjoin cancelCoinjoinAuthorization passphrase unlockPath setBusy checkFirmwareAuthenticity keepSession cancel.test info.test resetDevice-api
  • GitHub Check: build-deploy
  • GitHub Check: build-deploy
  • GitHub Check: run-desktop-tests (@group=wallet, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: run-desktop-tests (@group=other, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=passphrase, trezor-user-env-unix)
  • GitHub Check: run-desktop-tests (@group=settings, trezor-user-env-unix bitcoin-regtest)
  • GitHub Check: transport-e2e-test
  • GitHub Check: run-desktop-tests (@group=device-management, trezor-user-env-unix)
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: build-web
  • GitHub Check: Setup and Cache Dependencies
  • GitHub Check: prepare_android_test_app
  • GitHub Check: test
  • GitHub Check: run-desktop-tests (@group=suite, trezor-user-env-unix)
  • GitHub Check: Analyze with CodeQL (javascript)
🔇 Additional comments (23)
packages/connect/package.json (1)

116-116: Upgrade the tsx Dependency Version

The version for tsx has been updated to ^4.19.3, aligning with the project-wide standardization and ensuring consistency across packages. Please verify that all build and type-check scripts work as expected with this upgrade.

packages/env-utils/package.json (1)

51-51: Update tsx in DevDependencies

The tsx package version has been updated to ^4.19.3 as part of the coordinated upgrade. This change should enhance consistency and compatibility within the development tooling.

packages/protocol/package.json (1)

34-34: Standardize tsx Version

The tsx dependency in devDependencies is now set to ^4.19.3, matching the updates across the repository. Ensure that any scripts relying on tsx continue to execute correctly post-upgrade.

packages/connect-mobile/package.json (1)

22-22: Consistent Upgrade of tsx Dependency

The update of tsx from the older version to ^4.19.3 in the devDependencies section helps maintain a uniform development environment. Double-check that the workspace commands and prepublish scripts function properly with the new version.

packages/connect-explorer/package.json (1)

58-58: Align tsx Dependency Version

The tsx version in devDependencies has been updated to ^4.19.3, in line with the changes implemented in other packages. This upgrade should provide improved functionality and bug fixes, so please ensure all related scripts build and run correctly.

packages/protobuf/package.json (1)

41-44: TSX Dependency Update
The TSX package version in the devDependencies has been updated to "^4.19.3", ensuring consistency with similar updates across the repository.

packages/connect-web/package.json (1)

63-63: TSX Dependency Update in Connect-Web
The TSX package version in devDependencies has been updated to "^4.19.3", which aligns with the project-wide upgrade and helps maintain compatibility across packages.

packages/websocket-client/package.json (1)

57-57: Consistent TSX Version in Websocket Client
The TSX dependency is updated to "^4.19.3" in devDependencies. This change is in line with similar updates and promotes uniform tooling-wide behavior.

packages/blockchain-link-types/package.json (1)

27-27: TSX Dependency Update in Blockchain-Link-Types
The devDependency for TSX has been updated to "^4.19.3", ensuring that this package uses the same tooling version as the rest of the project.

scripts/package.json (2)

8-9: New Generate-Package Script Added
A new script "generate-package": "tsx generatePackage.ts" has been added, which streamlines the package generation process by invoking the script via TSX. This change supports the updated TSX dependency version across the repository.


20-20: TSX Dependency Addition in Scripts
Adding "tsx": "^4.19.3" to the dependencies ensures that the scripts package uses the updated version, maintaining consistency with other packages.

package.json (2)

58-58: Improved script organization by using workspace command

The command now uses the workspace mechanism instead of directly executing the file with tsx. This is a better approach for modularization and maintainability.


142-142: Dependency version updated for tsx

The tsx package version has been updated from ^4.16.3 to ^4.19.3, which aligns with the standardized version across multiple package.json files in the project.

scripts/generatePackage.ts (10)

4-4: Added path module import for better path handling

Good addition of the path module for proper cross-platform path handling.


29-29: Added const assertion for better type safety

The as const assertion helps TypeScript understand that the object's values should be treated as immutable literal types, improving type inference.


31-31: Added type annotation for error message parameter

Explicitly typing the parameter improves code readability and type safety.


36-38: Added type guard function for scope validation

This is a great improvement that creates a proper type guard function for validating scopes. It improves both type safety and code readability.


39-42: Improved directory path handling

Using path.dirname and path.resolve ensures correct directory path resolution across different platforms.


55-55: Enhanced scope validation using the type guard

Using the new isValidScope function improves the code by leveraging TypeScript's type system for safer code.


58-60: Improved error message construction

The error message now directly uses Object.keys(scopes) instead of a hardcoded list, which ensures the error message stays up-to-date with any changes to the scopes object.


65-70: Enhanced type safety and path construction

The destructuring now properly uses the typed scope value, and the packagePath is constructed using path.join for cross-platform compatibility.


90-90: Added type annotation to serializeConfig function

Adding the Record<string, unknown> type improves type safety for the config parameter.


93-98: Improved file path handling for template copying and file writing

Using path.join for constructing file paths ensures cross-platform compatibility and follows Node.js best practices.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
  • @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.

@Nodonisko Nodonisko merged commit a13f269 into develop Feb 28, 2025
72 of 77 checks passed
@Nodonisko Nodonisko deleted the fix/fix-generate-package branch February 28, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
monorepo Task about monorepo management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants