File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
packages/hap-packager/src/router Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import moment from 'moment'
10
10
11
11
import {
12
12
colorconsole ,
13
+ readJson ,
13
14
relateCwd ,
14
15
globalConfig ,
15
16
recordClient ,
@@ -63,7 +64,26 @@ async function bundle(context, next) {
63
64
const projectName = projectInfo . projectName
64
65
const projectVersion = projectInfo . projectVersion
65
66
const platformVersion = context . request . query . platformVersion
66
- if ( platformVersion && platformVersion >= RPKS_SUPPORT_VERSION_FROM ) {
67
+ let useAppRpk = false
68
+ // 应用模式下
69
+ if ( parseInt ( context . request . query . mode || 0 ) === 0 ) {
70
+ // 读取 manifest
71
+ let manifest
72
+ try {
73
+ manifest = readJson ( path . join ( projectPath , './src/manifest.json' ) )
74
+ } catch ( err ) {
75
+ manifest = null
76
+ }
77
+ // 不存在分包
78
+ if ( manifest && manifest . router && ( ! manifest . subpackages || manifest . subpackages . length === 0 ) ) {
79
+ // 存在卡片
80
+ if ( manifest . router . widgets && Object . keys ( manifest . router . widgets ) . length > 0 ) {
81
+ useAppRpk = true
82
+ }
83
+ }
84
+ }
85
+
86
+ if ( platformVersion && platformVersion >= RPKS_SUPPORT_VERSION_FROM && ! useAppRpk ) {
67
87
distFile = getDistFilePath ( projectDist , projectName , projectVersion , 'rpks' )
68
88
}
69
89
if ( ! distFile ) {
You can’t perform that action at this time.
0 commit comments