Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wychl
uni-app
提交
38e6d421
U
uni-app
项目概览
wychl
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
38e6d421
编写于
11月 05, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: support --manifest
上级
3d8e2c20
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
8 deletion
+50
-8
packages/vue-cli-plugin-uni/commands/build.js
packages/vue-cli-plugin-uni/commands/build.js
+50
-8
未找到文件。
packages/vue-cli-plugin-uni/commands/build.js
浏览文件 @
38e6d421
...
...
@@ -3,7 +3,9 @@ const path = require('path')
const
{
runByHBuilderX
,
isInHBuilderX
,
parseJson
parseJson
,
parsePagesJson
,
parseManifestJson
}
=
require
(
'
@dcloudio/uni-cli-shared
'
)
const
uniI18n
=
require
(
'
@dcloudio/uni-cli-i18n
'
)
...
...
@@ -32,7 +34,8 @@ module.exports = (api, options) => {
'
--auto-host
'
:
'
specify automator host
'
,
'
--auto-port
'
:
'
specify automator port
'
,
'
--subpackage
'
:
'
specify subpackage
'
,
'
--plugin
'
:
'
specify plugin
'
'
--plugin
'
:
'
specify plugin
'
,
'
--manifest
'
:
'
build manifest.json
'
}
},
async
(
args
)
=>
{
for
(
const
key
in
defaults
)
{
...
...
@@ -41,6 +44,10 @@ module.exports = (api, options) => {
}
}
if
(
args
.
manifest
&&
process
.
env
.
UNI_PLATFORM
===
'
app-plus
'
)
{
return
buildManifestJson
()
}
const
platforms
=
[
'
mp-weixin
'
,
'
mp-qq
'
,
'
mp-baidu
'
,
'
mp-alipay
'
,
'
mp-toutiao
'
,
'
mp-lark
'
]
if
(
args
.
subpackage
&&
platforms
.
includes
(
process
.
env
.
UNI_PLATFORM
))
{
process
.
env
.
UNI_SUBPACKGE
=
args
.
subpackage
...
...
@@ -135,7 +142,10 @@ async function build (args, api, options) {
log
()
if
(
!
runByHBuilderX
&&
!
runByAliIde
)
{
logWithSpinner
(
uniI18n
.
__
(
'
pluginUni.startCompileProjectToPlatform
'
,
{
0
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
1
:
process
.
env
.
UNI_MP_PLUGIN
?
uniI18n
.
__
(
'
plugin
'
)
:
uniI18n
.
__
(
'
platform
'
)
}))
logWithSpinner
(
uniI18n
.
__
(
'
pluginUni.startCompileProjectToPlatform
'
,
{
0
:
process
.
env
.
UNI_SUB_PLATFORM
||
process
.
env
.
UNI_PLATFORM
,
1
:
process
.
env
.
UNI_MP_PLUGIN
?
uniI18n
.
__
(
'
plugin
'
)
:
uniI18n
.
__
(
'
platform
'
)
}))
}
const
targetDir
=
api
.
resolve
(
options
.
outputDir
)
...
...
@@ -161,7 +171,8 @@ async function build (args, api, options) {
process
.
env
.
UNI_USING_V3_NATIVE
||
(
process
.
UNI_NVUE_ENTRY
&&
Object
.
keys
(
process
.
UNI_NVUE_ENTRY
).
length
)
)
{
webpackConfigs
.
push
(
require
(
'
@dcloudio/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
'
)(
process
.
UNI_NVUE_ENTRY
))
webpackConfigs
.
push
(
require
(
'
@dcloudio/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js
'
)(
process
.
UNI_NVUE_ENTRY
))
}
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -178,7 +189,8 @@ async function build (args, api, options) {
return
reject
(
'
Build failed with errors.
'
)
}
if
(
!
args
.
silent
&&
(
process
.
env
.
UNI_PLATFORM
!==
'
app-plus
'
||
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
))
{
if
(
!
args
.
silent
&&
(
process
.
env
.
UNI_PLATFORM
!==
'
app-plus
'
||
process
.
env
.
UNI_AUTOMATOR_WS_ENDPOINT
))
{
const
targetDirShort
=
path
.
relative
(
api
.
service
.
context
,
process
.
env
.
UNI_OUTPUT_DIR
...
...
@@ -195,7 +207,8 @@ async function build (args, api, options) {
console
.
log
(
'
https://uniapp.dcloud.io/uniCloud/hosting
'
)
}
}
else
{
const
dirMsg
=
runByHBuilderX
?
''
:
`The
${
chalk
.
cyan
(
targetDirShort
)}
directory is ready. `
const
dirMsg
=
runByHBuilderX
?
''
:
`The
${
chalk
.
cyan
(
targetDirShort
)}
directory is ready. `
done
(
`Build complete.
${
dirMsg
}
Watching for changes...`
)
}
}
...
...
@@ -221,7 +234,9 @@ function analysisPluginDir () {
if
(
!
fs
.
pathExistsSync
(
pluginJsonPath
))
{
console
.
log
()
console
.
error
(
uniI18n
.
__
(
'
pluginUni.fileNoExistsCheckAfterRetry
'
,
{
0
:
pluginJsonName
}))
console
.
error
(
uniI18n
.
__
(
'
pluginUni.fileNoExistsCheckAfterRetry
'
,
{
0
:
pluginJsonName
}))
console
.
log
()
process
.
exit
(
0
)
}
...
...
@@ -235,8 +250,35 @@ function analysisPluginDir () {
if
(
UNI_MP_PLUGIN_MAIN
&&
!
fs
.
pathExistsSync
(
mainFilePath
))
{
console
.
log
()
console
.
error
(
uniI18n
.
__
(
'
pluginUni.entryDileNoExistsCheckAfterRetry
'
,
{
0
:
UNI_MP_PLUGIN_MAIN
}))
console
.
error
(
uniI18n
.
__
(
'
pluginUni.entryDileNoExistsCheckAfterRetry
'
,
{
0
:
UNI_MP_PLUGIN_MAIN
}))
console
.
log
()
process
.
exit
(
0
)
}
}
function
buildManifestJson
()
{
const
fs
=
require
(
'
fs-extra
'
)
const
inputDir
=
process
.
env
.
UNI_INPUT_DIR
const
outputDir
=
process
.
env
.
UNI_OUTPUT_DIR
const
pagesJsonPath
=
path
.
resolve
(
inputDir
,
'
pages.json
'
)
const
manifestJsonPath
=
path
.
resolve
(
inputDir
,
'
manifest.json
'
)
const
pagesJson
=
parsePagesJson
(
fs
.
readFileSync
(
pagesJsonPath
,
'
utf8
'
))
const
manifestJson
=
parseManifestJson
(
fs
.
readFileSync
(
manifestJsonPath
,
'
utf8
'
))
const
res
=
require
(
'
@dcloudio/webpack-uni-pages-loader/lib/platforms/app-plus/index.js
'
)(
pagesJson
,
manifestJson
,
false
)
if
(
res
&&
res
[
0
])
{
fs
.
outputFileSync
(
path
.
resolve
(
outputDir
,
'
manifest.json
'
),
res
[
0
].
content
)
}
const
{
done
}
=
require
(
'
@vue/cli-shared-utils
'
)
done
(
'
Build complete.
'
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录