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: fix type: "module" must need js file extensions #1921

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

gweesin
Copy link
Contributor

@gweesin gweesin commented Aug 15, 2024

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

missing js file extensions on import statement

Issue Number: #569

What is the new behavior?

generated renderless file import statement could contains js file extensions

cd packages/renderless

run pnpm build

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Better than #1880

Summary by CodeRabbit

  • New Features

    • Introduced a streamlined build configuration that enhances the build process.
    • Transitioned to a new build tool for improved performance and compatibility.
    • Added new scripts for more granular control over code building and type definition generation.
  • Bug Fixes

    • Clean-up process implemented to ensure that previous build artifacts do not interfere with new builds.

Copy link

coderabbitai bot commented Aug 15, 2024

Walkthrough

The recent updates to the renderless package involve establishing a new build configuration with the unbuild package, enhancing the build process. The transition from tsup to unbuild indicates a shift in the development workflow, aimed at improving build performance and maintaining a clean output. This streamlined approach simplifies project setup and ensures efficient management of build artifacts.

Changes

Files Change Summary
packages/renderless/build.config.ts Introduced a new build configuration file using unbuild, defining a clean build process with a single entry point that points to the ./src/ directory.
packages/renderless/package.json Updated the build script to execute pnpm build:code and pnpm build:dts, replacing the previous single command, and added unbuild as a new dependency.
packages/renderless/tsup.config.ts Removed the configuration for compiling TypeScript files from the src directory, focusing instead on generating types from types/*.type.ts.

Suggested labels

bug

Poem

In the meadow, changes bloom,
A build tool swap, we clear the gloom.
From tsup to unbuild, we leap with glee,
Crafting builds as smooth as can be!
Hops of joy with every line,
Clean outputs, oh how they shine! 🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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

[e2e-test-warn]
The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5f52440 and 5a534ee.

Files selected for processing (2)
  • packages/renderless/build.config.ts (1 hunks)
  • packages/renderless/package.json (2 hunks)
Files skipped from review due to trivial changes (1)
  • packages/renderless/build.config.ts
Additional comments not posted (2)
packages/renderless/package.json (2)

33-33: Verify the build process with unbuild.

The build script has been updated to use unbuild. Ensure that the build process works correctly with this new tool and that all configurations are properly set.

Verification successful

Unbuild configuration is correctly set up.

The build.config.ts file shows a straightforward configuration for unbuild, using mkdist with an entry point in ./src/ and enabling the clean option. This setup appears to be correct for transitioning from tsup to unbuild. Ensure that the build process works as expected with this configuration.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the build process using `unbuild`.

# Test: Run the build command and check for successful completion.
pnpm build

Length of output: 84


Script:

#!/bin/bash
# Search for any configuration files or scripts related to `unbuild`.
fd -e json -e js -e ts -e yaml -e yml | xargs grep -i "unbuild" || true

Length of output: 264


Script:

#!/bin/bash
# Display the contents of the `build.config.ts` file to review the `unbuild` configuration.
cat packages/renderless/build.config.ts

Length of output: 215


44-44: Ensure unbuild is correctly installed and configured.

The devDependencies now include unbuild. Verify that unbuild is correctly installed and configured in the project.

Verification successful

unbuild is correctly configured and used in the project.

The unbuild package is referenced in the build script within package.json and is imported in build.config.ts, indicating it is set up for building the project.

  • packages/renderless/package.json: "build": "unbuild"
  • packages/renderless/build.config.ts: import { defineBuildConfig } from 'unbuild'
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the installation and configuration of `unbuild`.

# Test: Check if `unbuild` is installed and accessible.
pnpm list unbuild

Length of output: 91


Script:

#!/bin/bash
# Description: Search for `unbuild` references in configuration files to verify its configuration.

# Search for `unbuild` in package.json and other configuration files.
rg 'unbuild' package.json

Length of output: 25


Script:

#!/bin/bash
# Description: Search for `unbuild` references across all files to verify its configuration.

# Search for `unbuild` in all files to find any references or configurations.
rg 'unbuild'

Length of output: 206

reuse tsup to generate dts
@github-actions github-actions bot added the bug Something isn't working label Sep 12, 2024
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5a534ee and 761f1fd.

Files selected for processing (3)
  • packages/renderless/build.config.ts (1 hunks)
  • packages/renderless/package.json (2 hunks)
  • packages/renderless/tsup.config.ts (0 hunks)
Files not reviewed due to no reviewable changes (1)
  • packages/renderless/tsup.config.ts
Additional comments not posted (5)
packages/renderless/build.config.ts (1)

1-17: The build configuration looks good, but consider generating type declaration files.

The build configuration using unbuild follows the package conventions and looks correct. The use of mkdist builder, esbuild options, and clean option are appropriate for building a distribution package.

However, based on the past review comments, there seems to be a concern about generating type declaration files using unbuild. It's important to ensure that the type declaration files are generated correctly for better type safety and developer experience.

packages/renderless/package.json (4)

33-33: LGTM!

The change to the build script is a good improvement. It separates the code building and type definition generation processes, allowing for more granular control and a cleaner build output.


34-34: LGTM!

The introduction of the build:code script using unbuild is a good change. It aligns with the restructuring of the build process and should improve the build performance.


35-35: LGTM!

The introduction of the build:dts script using tsup is a good change. It aligns with the restructuring of the build process and should ensure that the type definitions are generated correctly.


47-47: LGTM!

The addition of the unbuild package to the devDependencies section is consistent with the introduction of the build:code script. The version constraint ^2.0.0 is reasonable and should allow for minor and patch updates to the package.

packages/renderless/build.config.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants