-
-
Notifications
You must be signed in to change notification settings - Fork 6
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 HBuilderX compatibility #33
Conversation
WalkthroughThe changes introduce enhanced configurability by enabling dynamic specification of the JSON pages path. Users can now define the path using the Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
Files selected for processing (3)
- src/context.ts (2 hunks)
- src/types.ts (1 hunks)
- src/utils.ts (2 hunks)
Files skipped from review due to trivial changes (1)
- src/types.ts
Additional comments not posted (4)
src/utils.ts (2)
14-14
: The addition ofpagesJsonPath
inresolveOptions
enhances configuration flexibility and is implemented correctly.
47-50
: Refactoring ingetTarget
to determineisSrcMode
based on the resolved path is clear and effective.src/context.ts (2)
36-36
: Usingthis.options.pagesJsonPath
insetupWatcher
correctly implements dynamic configuration for the JSON path.
47-47
: Dynamically loading pages JSON intransform
usingthis.options.pagesJsonPath
enhances the adaptability of the application.
@KeJunMao 方便看一下么? |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pagesJsonPath
这个属性的有无可能不会产生太大影响
我觉得可以通过判断是否拥有 src目录
来区分所创建项目类型就好了
这是我的看法,看看大佬们怎么说?🧐
同时要谢谢你的PR,解决 HBuilderX
上的问题 ❤
HBuilderX 和 Cli 两种模式下 pages.json 文件所在的路径不一样,之前的代码似乎是写死的,一起看一下 vite-plugin-uni-layouts/src/context.ts Line 36 in eb9eabc
vite-plugin-uni-layouts/src/context.ts Line 47 in eb9eabc
|
你的意思是定义一个全局 isSrc 模式的判断,对吧? |
vite-plugin-uni-layouts/src/utils.ts Lines 48 to 50 in a3c243b
是的,就像你处理这个类似 👆 因为在我看来,判断不同创建项目模式,无非就两种可能, |
看了一下 在 src/context.ts 全局 isSrc 判断貌似找不到合适的位置 你觉得在哪个位置合适? |
是不是直接检测是否存在就可以,优先 src/pages.json,回退 pages.json,都没有抛出 |
There was a problem hiding this 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
LGTM ❤ vite-plugin-uni-layouts/src/index.ts Line 32 in eb9eabc
这一行可能需要改成这样, |
There was a problem hiding this 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
Files selected for processing (2)
- src/index.ts (1 hunks)
- src/utils.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/utils.ts
const filter = createFilter(['src/main.(ts|js)', 'main.(ts|js)']) | ||
if (filter(id)) | ||
return ctx.importLayoutComponents(code, id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure the filter pattern is correct and consistent.
The filter pattern ['src/main.(ts|js)', 'main.(ts|js)']
should be verified to match the intended files. If the project structure varies, consider making this pattern configurable.
- const filter = createFilter(['src/main.(ts|js)', 'main.(ts|js)'])
+ const filter = createFilter(['src/main.{ts,js}', 'main.{ts,js}'])
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.
const filter = createFilter(['src/main.(ts|js)', 'main.(ts|js)']) | |
if (filter(id)) | |
return ctx.importLayoutComponents(code, id) | |
const filter = createFilter(['src/main.{ts,js}', 'main.{ts,js}']) | |
if (filter(id)) | |
return ctx.importLayoutComponents(code, id) |
@Skiyee 看一下 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤
如果没有进一步反馈,我会在2-3天内合并发布。 |
Thank you! |
Description 描述
最小修改兼容 HBuiderX 运行模式
Linked Issues 关联的 Issues
在 HBuiderX 使用不生效
Additional context 额外上下文
在 HBuilderX 下运行
Summary by CodeRabbit
New Features
Refactor