Skip to content

Commit

Permalink
add base package for card and add type in manifest when missing (#90)
Browse files Browse the repository at this point in the history
* feat: add type filed in manifest when missing for card

Signed-off-by: lileirjyb <[email protected]>

* fix: add base package for card needed by debugger

Signed-off-by: lileirjyb <[email protected]>

* fix: update snapshot

Signed-off-by: lileirjyb <[email protected]>

---------

Signed-off-by: lileirjyb <[email protected]>
  • Loading branch information
lilei946 authored Jan 8, 2025
1 parent b75db76 commit 0fa60f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 7 additions & 1 deletion packages/hap-packager/src/common/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function checkFeatureInCard(obj = {}) {
}

/**
* 填充 widget.path 缺失时的默认值
* 填充 widget path、type 缺失时的默认值
*/
function populateWidgetFields(widgetsObj) {
Object.keys(widgetsObj).forEach((key) => {
Expand All @@ -222,6 +222,12 @@ function populateWidgetFields(widgetsObj) {
`WARN: manifest.json 文件中 widgets 字段 ${key} 缺少 path 属性,默认设置为卡片名 /${key}`
)
}
if (!widgetsObj[key].type) {
widgetsObj[key].type = `js`
colorconsole.warn(
`WARN: manifest.json 文件中 widgets 字段 ${key} 缺少 type 属性,默认设置为 js`
)
}
})
}

Expand Down
8 changes: 4 additions & 4 deletions packages/hap-packager/src/process/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ async function buildProjectAndOutput(
}

// 如果不是快应用分包,则移除第一个 base 包
// 只有快应用分包才需要base包,卡片分包不需要
if (!isAppSubpackage && subPackages) {
subPackages.shift()
}
// 只有快应用分包才需要base包,卡片分包不需要 —— update: 卡片需要保留base包,调试器处理rpks时需要读取
// if (!isAppSubpackage && subPackages) {
// subPackages.shift()
// }

// Step1. 生成整包rpk
let fullPackageBuffer = await createZipBufferForPackage(fullPackage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ versionCode 字段必须为 Integer 类型
[INFO] 获取到app文件后缀: ux
[WARN] WARN: manifest.json 文件中 widgets 字段 CardDemo 缺少 type 属性,默认设置为 js
[INFO] Build Time Cost: : <time-cost>
[LOG] ### App Loader ### 项目构建启用了用户 debug 签名
Expand Down

0 comments on commit 0fa60f0

Please sign in to comment.