uni-helper / uni-deploy

WIP 自动化部署 uni-app 应用
MIT License
6 stars 2 forks source link

迁移到 unconfig #2

Closed ModyQyW closed 1 year ago

ModyQyW commented 1 year ago

对问题的清晰和简明的描述

目前使用 joyconbundle-requirestrip-json-comments 来读取配置文件,逻辑相对较长。

unconfig 能显著减少代码,提高源码可读性。

推荐的解决方案

/

替代方案

No response

额外上下文

https://github.com/ModyQyW/uni-deploy-test

需要排查。

检查

KeJunMao commented 1 year ago

刚刚我尝试切换到unconfig,通过了config.test.ts 的测试

https://github.com/uni-helper/uni-deploy/blob/feat-unconfig/src/config.ts#L38-L59

Warning 没有删除旧依赖,仅仅是新增了unconfig,并通过了测试

ModyQyW commented 1 year ago

确实能通过现有的测试,但是用 CLI 跑的时候就卡住了

我感觉是 unconfig 的问题,之前调了一两天没有头绪。等我晚点加点测试然后再调试一下好了

KeJunMao commented 1 year ago

CLI 我也试过,没问题哎

image

ModyQyW commented 1 year ago

可以试试 https://github.com/ModyQyW/uni-deploy-test

KeJunMao commented 1 year ago

确实复现了,貌似是因为 jiti导致的。一个可行的办法将 config 单独导出

import { defineConfig } from '@uni-helper/uni-deploy/config';

export default defineConfig({
  im: {
    wecom: {
      webhook: 'https://fake.wecom.webhook',
    },
  },
});
❯ nr validate
> uni-deploy validate
INFO [2022-11-19 09:58:41.025 +0800]: 没有配置微信小程序,跳过微信小程序操作。
ModyQyW commented 1 year ago

单独导出确实可以,但又降低了便捷性。如果可以,我还是倾向于直接从 uni-deploy 中导出

我忙完公司业务后再花点时间调试看看,然后去提个 PR 啥的

ModyQyW commented 1 year ago

https://github.com/unjs/jiti/issues/98

ModyQyW commented 1 year ago

感觉 jiti 还是不够稳定。暂时先搁置这个计划。