Skip to content

Commit

Permalink
fix: base rpk resource info not be modified by subpackage
Browse files Browse the repository at this point in the history
Signed-off-by: lileirjyb <[email protected]>
  • Loading branch information
lilei946 committed Jan 14, 2025
1 parent 0fa60f0 commit 3618d03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/hap-packager/src/subpackages/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ function allocateResourceToPackages(
// 遍历除主包整包外的分包,判断此文件是否属于某个分包的
for (let i = 1; i < subPackages.length; i++) {
const pkg = subPackages[i]
let subResourceInfo = resourceInfo
// 精简卡片的 manifest.json 文件,只保留本卡片的配置
if (pkg._widget && fileBuildPath === 'manifest.json') {
resourceInfo = trimSubPkgManifest(pkg, fileBuildPath, fileAbsPath)
subResourceInfo = trimSubPkgManifest(pkg, fileBuildPath, fileAbsPath)
}

// 如果此分包是个独立包,则需要加入manifest || sitemap.json || i18n || icon || banner || lottie 文件,每个包都需要
Expand All @@ -172,12 +173,12 @@ function allocateResourceToPackages(
(pkg.icon && pkg.icon.indexOf(fileBuildPath) > 0) ||
(pkg.banner && pkg.banner.indexOf(fileBuildPath) > 0))
) {
pkg.addResource(...resourceInfo)
pkg.addResource(...subResourceInfo)
}

if (pkg.subMatch.test(fileBuildPath)) {
belongToBasePkg = false
pkg.addResource(...resourceInfo)
pkg.addResource(...subResourceInfo)
// 此资源已属于这个分包,无需循环下一轮
break
}
Expand Down
2 changes: 1 addition & 1 deletion packages/hap-toolkit/__tests__/init.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('initialize a project', () => {
expect(stderr).toMatch('Please pick a new name')
await del([TEST_NAME, TEST_NAME2], { force: true })
},
5 * 60 * 1000
50 * 60 * 1000
)

it(
Expand Down

0 comments on commit 3618d03

Please sign in to comment.