Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
菜鸟程序猿_c
uni-app
提交
ede72266
U
uni-app
项目概览
菜鸟程序猿_c
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ede72266
编写于
3月 09, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(qa): add manifest.json
上级
3f207413
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
183 addition
and
44 deletion
+183
-44
packages/uni-quickapp/lib/configure-webpack.js
packages/uni-quickapp/lib/configure-webpack.js
+22
-15
packages/uni-quickapp/lib/env.js
packages/uni-quickapp/lib/env.js
+0
-3
packages/uni-quickapp/lib/manifest/base-parser.js
packages/uni-quickapp/lib/manifest/base-parser.js
+28
-0
packages/uni-quickapp/lib/manifest/display-parser.js
packages/uni-quickapp/lib/manifest/display-parser.js
+65
-0
packages/uni-quickapp/lib/manifest/index.js
packages/uni-quickapp/lib/manifest/index.js
+16
-0
packages/uni-quickapp/lib/manifest/pages-parser.js
packages/uni-quickapp/lib/manifest/pages-parser.js
+15
-0
packages/uni-quickapp/lib/parse-entry.js
packages/uni-quickapp/lib/parse-entry.js
+0
-3
packages/uni-quickapp/lib/vue.config.js
packages/uni-quickapp/lib/vue.config.js
+1
-1
packages/vue-cli-plugin-uni/index.js
packages/vue-cli-plugin-uni/index.js
+2
-1
packages/vue-cli-plugin-uni/lib/env.js
packages/vue-cli-plugin-uni/lib/env.js
+23
-20
packages/webpack-uni-pages-loader/lib/index-new.js
packages/webpack-uni-pages-loader/lib/index-new.js
+3
-0
packages/webpack-uni-pages-loader/lib/index.js
packages/webpack-uni-pages-loader/lib/index.js
+5
-1
packages/webpack-uni-pages-loader/lib/platforms/quickapp.js
packages/webpack-uni-pages-loader/lib/platforms/quickapp.js
+3
-0
未找到文件。
packages/uni-quickapp/lib/configure-webpack.js
浏览文件 @
ede72266
...
@@ -4,7 +4,7 @@ const webpack = require('webpack')
...
@@ -4,7 +4,7 @@ const webpack = require('webpack')
const
CopyPlugin
=
require
(
'
copy-webpack-plugin
'
)
const
CopyPlugin
=
require
(
'
copy-webpack-plugin
'
)
const
HandlerPlugin
=
require
(
'
@hap-toolkit/packager/lib/plugin/handler-plugin
'
)
const
HandlerPlugin
=
require
(
'
@hap-toolkit/packager/lib/plugin/handler-plugin
'
)
const
ZipPlugin
=
require
(
'
@hap-toolkit/packager/lib/plugin/zip-plugin
'
)
const
ZipPlugin
=
require
(
'
@hap-toolkit/packager/lib/plugin/zip-plugin
'
)
const
NotifyPlugin
=
require
(
'
@hap-toolkit/packager/lib/plugin/notify-plugin
'
)
const
NotifyPlugin
=
require
(
'
@hap-toolkit/packager/lib/plugin/notify-plugin
'
)
const
Css2jsonPlugin
=
require
(
'
@hap-toolkit/dsl-vue/lib/plugin/css2json-plugin
'
)
const
Css2jsonPlugin
=
require
(
'
@hap-toolkit/dsl-vue/lib/plugin/css2json-plugin
'
)
...
@@ -17,15 +17,23 @@ const env = {
...
@@ -17,15 +17,23 @@ const env = {
NODE_PHASE
:
process
.
env
.
NODE_PHASE
NODE_PHASE
:
process
.
env
.
NODE_PHASE
}
}
const
dslFilename
=
'
vue.
'
+
(
process
.
env
.
NODE_ENV
===
'
production
'
?
'
prod
'
:
'
dev
'
)
+
'
.js
'
const
dslFilename
=
(
'
vue.
'
+
(
process
.
env
.
NODE_ENV
===
'
production
'
?
'
prod
'
:
'
dev
'
)
+
'
.js
'
)
const
manifest
=
global
.
framework
.
manifest
function
genPriorities
(
e
)
{
const
manifest
=
process
.
UNI_MANIFEST
.
quickapp
||
{}
const
entryPagePath
=
process
.
UNI_PAGES
.
pages
[
0
].
path
const
versionCode
=
parseInt
(
manifest
.
versionCode
||
process
.
UNI_MANIFEST
.
versionCode
)
||
1
if
(
!
manifest
.
package
)
{
console
.
error
(
`maniest.json quickapp 节点缺少 package 配置`
)
process
.
exit
(
0
)
}
function
genPriorities
(
entryPagePath
)
{
const
o
=
[
/^i18n
\/
.+
\.
json$/i
,
'
manifest.json
'
,
'
app.js
'
,
/^common
\/
/i
];
const
o
=
[
/^i18n
\/
.+
\.
json$/i
,
'
manifest.json
'
,
'
app.js
'
,
/^common
\/
/i
];
if
(
e
&&
e
.
router
&&
e
.
router
.
entry
)
{
if
(
entryPagePath
)
{
const
n
=
e
.
router
.
entry
;
o
.
splice
(
3
,
0
,
new
RegExp
(
`^
${
entryPagePath
}
/$`
),
new
RegExp
(
`^
${
entryPagePath
}
/.+`
))
o
.
splice
(
3
,
0
,
new
RegExp
(
`^
${
n
}
/$`
),
new
RegExp
(
`^
${
n
}
/.+`
))
}
else
console
.
error
(
'
未配置入口页面
'
);
}
else
colorconsole
.
error
(
'
manifest.json 中未配置入口页面 router.entry
'
);
return
o
return
o
}
}
...
@@ -50,23 +58,22 @@ module.exports = {
...
@@ -50,23 +58,22 @@ module.exports = {
new
CopyPlugin
([{
new
CopyPlugin
([{
from
:
path
.
resolve
(
__dirname
,
'
../dist/
'
+
dslFilename
),
from
:
path
.
resolve
(
__dirname
,
'
../dist/
'
+
dslFilename
),
to
:
'
dsl.js
'
to
:
'
dsl.js
'
},
{
from
:
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
'
manifest.json
'
)
}]),
}]),
new
HandlerPlugin
({}),
new
HandlerPlugin
({}),
new
Css2jsonPlugin
(),
new
Css2jsonPlugin
(),
new
InstVuePlugin
(),
new
InstVuePlugin
(),
// TODO 目前 manifest,entryPagePath 是启动时读取一次
new
ZipPlugin
({
new
ZipPlugin
({
name
:
manifest
.
package
,
name
:
manifest
.
package
,
icon
:
manifest
.
icon
,
icon
:
manifest
.
icon
,
versionCode
:
manifest
.
versionCode
,
versionCode
,
output
:
path
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
),
output
:
path
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
..
'
),
pathBuild
:
p
ath
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
build
'
)
,
pathBuild
:
p
rocess
.
env
.
UNI_OUTPUT_DIR
,
pathSignFolder
:
'
./sign
'
,
pathSignFolder
:
'
./sign
'
,
sign
:
process
.
env
.
NODE_ENV
===
'
production
'
?
'
release
'
:
'
debug
'
,
sign
:
process
.
env
.
NODE_ENV
===
'
production
'
?
'
release
'
:
'
debug
'
,
priorities
:
genPriorities
(
manifest
),
priorities
:
genPriorities
(
entryPagePath
),
subpackages
:
undefined
,
subpackages
:
undefined
,
comment
:
'
{"toolkit":"0.6.13","timeStamp":"2020-03-08T13:22:31.014Z","node":"v12.15.0","platform":"darwin","arch":"x64","extends":null}
'
,
comment
:
''
,
cwd
:
process
.
env
.
UNI_INPUT_DIR
,
cwd
:
process
.
env
.
UNI_INPUT_DIR
,
disableStreamPack
:
undefined
,
disableStreamPack
:
undefined
,
disableSubpackages
:
undefined
disableSubpackages
:
undefined
...
...
packages/uni-quickapp/lib/env.js
已删除
100644 → 0
浏览文件 @
3f207413
global
.
framework
=
{}
global
.
framework
.
manifest
=
require
(
'
/Users/fxy/Documents/demo/my-qa-project/src/manifest.json
'
)
packages/uni-quickapp/lib/manifest/base-parser.js
0 → 100644
浏览文件 @
ede72266
const
ATTRS
=
{
'
name
'
:
'
name
'
,
'
versionName
'
:
'
versionName
'
,
'
versionCode
'
:
'
versionCode
'
}
function
merge
(
to
,
from
)
{
Object
.
keys
(
ATTRS
).
forEach
(
name
=>
{
if
(
!
to
[
name
])
{
to
[
name
]
=
from
[
name
]
}
})
}
module
.
exports
=
function
parseBase
(
manifest
,
manifestJson
)
{
merge
(
manifest
,
manifestJson
)
manifest
.
versionCode
=
parseInt
(
manifest
.
versionCode
)
||
1
if
(
!
manifest
.
config
)
{
manifest
.
config
=
{}
}
if
(
!
manifest
.
config
.
dsl
)
{
manifest
.
config
.
dsl
=
{}
}
manifest
.
config
.
dsl
.
name
=
'
vue
'
return
manifest
}
packages/uni-quickapp/lib/manifest/display-parser.js
0 → 100644
浏览文件 @
ede72266
const
PLATFORMS
=
[
'
h5
'
,
'
app-plus
'
,
'
mp-weixin
'
,
'
mp-qq
'
,
'
mp-baidu
'
,
'
mp-alipay
'
,
'
mp-toutiao
'
,
'
quickapp
'
]
const
DISPLAY
=
{
'
navigationBarBackgroundColor
'
:
'
titleBarBackgroundColor
'
,
'
navigationBarTextStyle
'
:
(
style
,
val
)
=>
{
if
(
val
===
'
black
'
)
{
style
.
titleBarTextColor
=
'
#000000
'
style
.
statusBarTextStyle
=
'
dark
'
}
else
{
style
.
titleBarTextColor
=
'
#ffffff
'
style
.
statusBarTextStyle
=
'
light
'
}
},
'
navigationBarTitleText
'
:
'
titleBarText
'
,
'
navigationStyle
'
:
(
style
,
val
)
=>
{
if
(
val
===
'
custom
'
)
{
style
.
titleBar
=
false
}
}
}
function
parseStyle
(
style
=
{})
{
const
ret
=
{}
Object
.
keys
(
style
).
forEach
(
name
=>
{
if
(
!
PLATFORMS
.
includes
(
name
))
{
const
transform
=
DISPLAY
[
name
]
if
(
transform
)
{
if
(
typeof
transform
===
'
string
'
)
{
ret
[
transform
]
=
style
[
name
]
}
else
if
(
typeof
transform
===
'
function
'
)
{
transform
(
ret
,
style
[
name
])
}
}
else
{
ret
[
name
]
=
style
[
name
]
}
}
})
if
(
style
.
quickapp
)
{
Object
.
assign
(
ret
,
style
.
quickapp
)
}
return
ret
}
module
.
exports
=
function
parseDisplay
(
manifest
,
pages
,
globalStyle
=
{})
{
const
display
=
{
pages
:
{}
}
// globalStyle
Object
.
assign
(
display
,
parseStyle
(
globalStyle
))
pages
.
forEach
(
page
=>
{
const
key
=
page
.
path
.
substr
(
0
,
page
.
path
.
lastIndexOf
(
'
/
'
))
display
.
pages
[
key
]
=
parseStyle
(
page
.
style
)
})
manifest
.
display
=
display
}
packages/uni-quickapp/lib/manifest/index.js
0 → 100644
浏览文件 @
ede72266
const
parseBase
=
require
(
'
./base-parser
'
)
const
parsePages
=
require
(
'
./pages-parser
'
)
const
parseDisplay
=
require
(
'
./display-parser
'
)
module
.
exports
=
function
(
pagesJson
,
manifestJson
,
loader
)
{
const
manifest
=
manifestJson
.
quickapp
||
{}
parseBase
(
manifest
,
manifestJson
)
parsePages
(
manifest
,
pagesJson
.
pages
)
parseDisplay
(
manifest
,
pagesJson
.
pages
,
pagesJson
.
globalStyle
)
global
.
framework
.
manifest
=
manifest
loader
.
emitFile
(
'
manifest.json
'
,
JSON
.
stringify
(
manifest
))
return
''
}
packages/uni-quickapp/lib/manifest/pages-parser.js
0 → 100644
浏览文件 @
ede72266
module
.
exports
=
function
parsePages
(
manifest
,
pages
)
{
const
entryPagePath
=
pages
[
0
].
path
const
router
=
{
entry
:
entryPagePath
.
substr
(
0
,
entryPagePath
.
lastIndexOf
(
'
/
'
)),
pages
:
{}
}
pages
.
forEach
(
page
=>
{
const
lastIndex
=
page
.
path
.
lastIndexOf
(
'
/
'
)
const
key
=
page
.
path
.
substr
(
0
,
lastIndex
)
router
.
pages
[
key
]
=
{
component
:
page
.
path
.
substr
(
lastIndex
+
1
)
}
})
manifest
.
router
=
router
}
packages/uni-quickapp/lib/parse-entry.js
已删除
100644 → 0
浏览文件 @
3f207413
module
.
exports
=
function
parseEntry
()
{
}
packages/uni-quickapp/lib/vue.config.js
浏览文件 @
ede72266
require
(
'
./env
'
)
global
.
framework
=
{}
const
chainWebpack
=
require
(
'
./chain-webpack
'
)
const
chainWebpack
=
require
(
'
./chain-webpack
'
)
const
configureWebpack
=
require
(
'
./configure-webpack
'
)
const
configureWebpack
=
require
(
'
./configure-webpack
'
)
...
...
packages/vue-cli-plugin-uni/index.js
浏览文件 @
ede72266
...
@@ -20,9 +20,10 @@ module.exports = (api, options) => {
...
@@ -20,9 +20,10 @@ module.exports = (api, options) => {
initBuildCommand
(
api
,
options
)
initBuildCommand
(
api
,
options
)
if
(
process
.
env
.
UNI_PLATFORM
===
'
quickapp
'
)
{
if
(
process
.
env
.
UNI_PLATFORM
===
'
quickapp
'
)
{
process
.
env
.
UNI_OUTPUT_DIR
=
path
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
build
'
)
Object
.
assign
(
options
,
{
Object
.
assign
(
options
,
{
assetsDir
,
assetsDir
,
outputDir
:
p
ath
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
build
'
)
outputDir
:
p
rocess
.
env
.
UNI_OUTPUT_DIR
})
})
require
(
'
./lib/options
'
)(
options
)
require
(
'
./lib/options
'
)(
options
)
const
platformOptions
=
{
const
platformOptions
=
{
...
...
packages/vue-cli-plugin-uni/lib/env.js
浏览文件 @
ede72266
...
@@ -18,27 +18,27 @@ if (process.env.UNI_CLOUD_SPACES) {
...
@@ -18,27 +18,27 @@ if (process.env.UNI_CLOUD_SPACES) {
if
(
spaces
.
length
===
1
)
{
if
(
spaces
.
length
===
1
)
{
const
space
=
spaces
[
0
]
const
space
=
spaces
[
0
]
console
.
log
(
`本项目的uniCloud使用的默认服务空间spaceId为:
${
space
.
id
}
`
)
console
.
log
(
`本项目的uniCloud使用的默认服务空间spaceId为:
${
space
.
id
}
`
)
}
}
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
(
spaces
.
map
(
space
=>
{
process
.
env
.
UNI_CLOUD_PROVIDER
=
JSON
.
stringify
(
spaces
.
map
(
space
=>
{
if
(
space
.
clientSecret
)
{
if
(
space
.
clientSecret
)
{
return
{
return
{
provider
:
'
aliyun
'
,
provider
:
'
aliyun
'
,
spaceName
:
space
.
name
,
spaceName
:
space
.
name
,
spaceId
:
space
.
id
,
spaceId
:
space
.
id
,
clientSecret
:
space
.
clientSecret
,
clientSecret
:
space
.
clientSecret
,
endpoint
:
space
.
apiEndpoint
endpoint
:
space
.
apiEndpoint
}
}
}
else
{
}
else
{
return
{
return
{
provider
:
'
tencent
'
,
provider
:
'
tencent
'
,
spaceName
:
space
.
name
,
spaceName
:
space
.
name
,
spaceId
:
space
.
id
spaceId
:
space
.
id
}
}
}
}
}))
}))
}
}
}
catch
(
e
)
{}
}
catch
(
e
)
{}
}
}
if
(
if
(
process
.
UNI_CLOUD
&&
process
.
UNI_CLOUD
&&
...
@@ -88,7 +88,7 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache
...
@@ -88,7 +88,7 @@ if (process.env.NODE_ENV === 'production') { // 发行模式,不启用 cache
delete
process
.
env
.
UNI_USING_CACHE
delete
process
.
env
.
UNI_USING_CACHE
}
}
const
{
const
{
normalizePath
,
normalizePath
,
isSupportSubPackages
,
isSupportSubPackages
,
runByHBuilderX
,
runByHBuilderX
,
...
@@ -120,6 +120,9 @@ if (Array.isArray(pagesJsonObj.subPackages)) {
...
@@ -120,6 +120,9 @@ if (Array.isArray(pagesJsonObj.subPackages)) {
const
manifestJsonObj
=
getManifestJson
()
const
manifestJsonObj
=
getManifestJson
()
const
platformOptions
=
manifestJsonObj
[
process
.
env
.
UNI_PLATFORM
]
||
{}
const
platformOptions
=
manifestJsonObj
[
process
.
env
.
UNI_PLATFORM
]
||
{}
process
.
UNI_PAGES
=
pagesJsonObj
process
.
UNI_MANIFEST
=
manifestJsonObj
if
(
manifestJsonObj
.
debug
)
{
if
(
manifestJsonObj
.
debug
)
{
process
.
env
.
VUE_APP_DEBUG
=
true
process
.
env
.
VUE_APP_DEBUG
=
true
}
}
...
@@ -212,7 +215,7 @@ if (process.env.UNI_PLATFORM === 'app-plus') {
...
@@ -212,7 +215,7 @@ if (process.env.UNI_PLATFORM === 'app-plus') {
normalizePath
(
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
filepath
))
normalizePath
(
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
filepath
))
)
)
}
}
}
}
}
else
{
// 其他平台,待确认配置方案
}
else
{
// 其他平台,待确认配置方案
if
(
if
(
manifestJsonObj
[
'
app-plus
'
]
&&
manifestJsonObj
[
'
app-plus
'
]
&&
...
...
packages/webpack-uni-pages-loader/lib/index-new.js
浏览文件 @
ede72266
...
@@ -69,6 +69,9 @@ module.exports = function (content) {
...
@@ -69,6 +69,9 @@ module.exports = function (content) {
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
)
{
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
)
{
return
require
(
'
./platforms/h5
'
)(
pagesJson
,
manifestJson
)
return
require
(
'
./platforms/h5
'
)(
pagesJson
,
manifestJson
)
}
}
if
(
process
.
env
.
UNI_PLATFORM
===
'
quickapp
'
)
{
return
require
(
'
./platforms/quickapp
'
)(
pagesJson
,
manifestJson
,
this
)
}
if
(
!
process
.
env
.
UNI_USING_V3
)
{
if
(
!
process
.
env
.
UNI_USING_V3
)
{
parsePages
(
pagesJson
,
function
(
page
)
{
parsePages
(
pagesJson
,
function
(
page
)
{
...
...
packages/webpack-uni-pages-loader/lib/index.js
浏览文件 @
ede72266
...
@@ -41,7 +41,11 @@ module.exports = function (content) {
...
@@ -41,7 +41,11 @@ module.exports = function (content) {
}
}
}
}
if
(
process
.
env
.
UNI_USING_COMPONENTS
||
process
.
env
.
UNI_PLATFORM
===
'
h5
'
)
{
if
(
process
.
env
.
UNI_USING_COMPONENTS
||
process
.
env
.
UNI_PLATFORM
===
'
h5
'
||
process
.
env
.
UNI_PLATFORM
===
'
quickapp
'
)
{
return
require
(
'
./index-new
'
).
call
(
this
,
content
)
return
require
(
'
./index-new
'
).
call
(
this
,
content
)
}
}
...
...
packages/webpack-uni-pages-loader/lib/platforms/quickapp.js
浏览文件 @
ede72266
module
.
exports
=
function
(
pagesJson
,
manifestJson
,
loader
)
{
return
require
(
'
@dcloudio/uni-quickapp/lib/manifest
'
)(
pagesJson
,
manifestJson
,
loader
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录