@liujitcn/kratos-taro-app-cli 0.0.38 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  ```bash
8
8
  pnpm dlx @liujitcn/kratos-taro-app-cli create customer-app
9
- pnpm dlx @liujitcn/kratos-taro-app-cli create shop-app --module shop,order
9
+ pnpm dlx @liujitcn/kratos-taro-app-cli create business-app --module business,report
10
10
  pnpm dlx @liujitcn/kratos-taro-app-cli create customer-app --with @acme/customer-module
11
11
  ```
12
12
 
@@ -36,3 +36,5 @@ CLI 直接生成完整宿主、本地业务模块、四种语言源文件与注
36
36
  通过 `--kratos-project` 生成与 Go 后端配套的前端:H5 输出到 `backend/data/<terminal>`,
37
37
  管理端 CLI 同时在 workspace 父目录创建共享 `Makefile` 与 `scripts`。Go 调用方仅传参执行 CLI。
38
38
  新增语言或修改语言文件后运行 `pnpm i18n:sync`;`pnpm i18n:check` 校验注册文件是否同步。
39
+
40
+ H5 宿主通过 `esnextModules` 将已装配 npm 源码包加入 Taro 样式处理,确保 px 按 750 设计稿转换为 rem;仅设置脚本的 `compile.include` 无法覆盖样式转换。第三方组件仍遵循 Taro 默认处理规则。
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "type": "git",
8
8
  "url": "git@github.com:liujitcn/kratos-admin.git"
9
9
  },
10
- "version": "0.0.38",
10
+ "version": "0.0.40",
11
11
  "type": "module",
12
12
  "bin": {
13
13
  "kratos-taro-app": "./bin/kratos-taro-app.mjs"
package/src/index.mjs CHANGED
@@ -445,6 +445,7 @@ function moduleManifest(modules, packages) {
445
445
  return `${imports.join('\n')}\n\n/** 宿主唯一模块清单,顺序决定静态视图覆盖优先级。 */\nexport const moduleManifest = [${members.join(', ')}]\n`
446
446
  }
447
447
 
448
+ /** 生成宿主构建配置,让已装配 npm 源码包参与脚本和样式编译。 */
448
449
  function hostConfig(projectName, packageNames) {
449
450
  return `import { createRequire } from 'node:module'
450
451
  import { existsSync, readFileSync } from 'node:fs'
@@ -547,6 +548,8 @@ export default defineConfig<'webpack5'>(async (merge) => {
547
548
  webpackChain: configureWebpack,
548
549
  },
549
550
  h5: {
551
+ // Taro 默认跳过 node_modules 样式,已装配源码包需要进行 px 到 rem 转换。
552
+ esnextModules: sourceRoots,
550
553
  publicPath,
551
554
  staticDirectory: 'static',
552
555
  router: { mode: 'hash' },
@@ -649,7 +652,7 @@ function printHelp() {
649
652
  '',
650
653
  '示例:',
651
654
  ' kratos-taro-app create customer-app',
652
- ' kratos-taro-app create shop-app --module shop,order',
655
+ ' kratos-taro-app create business-app --module business,report',
653
656
  ' kratos-taro-app create customer-app --with @acme/customer-module',
654
657
  '',
655
658
  ].join('\n'),