Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
一把秋刀鱼
uni-app
提交
ac836f89
U
uni-app
项目概览
一把秋刀鱼
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
4
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,发现更多精彩内容 >>
提交
ac836f89
编写于
12月 11, 2019
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(v3): uni-migration
上级
75dffb51
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
77 addition
and
27 deletion
+77
-27
packages/uni-migration/bin/uni-migration.js
packages/uni-migration/bin/uni-migration.js
+43
-0
packages/uni-migration/lib/index.js
packages/uni-migration/lib/index.js
+3
-2
packages/uni-migration/lib/validate.js
packages/uni-migration/lib/validate.js
+0
-1
packages/uni-migration/package.json
packages/uni-migration/package.json
+29
-23
packages/vue-cli-plugin-uni/generator.js
packages/vue-cli-plugin-uni/generator.js
+2
-1
未找到文件。
packages/uni-migration/bin/uni-migration.js
0 → 100644
浏览文件 @
ac836f89
#!/usr/bin/env node
const
path
=
require
(
'
path
'
)
const
Program
=
require
(
'
commander
'
)
const
migrate
=
require
(
'
../lib
'
)
const
pkg
=
require
(
'
../package.json
'
)
Program
.
description
(
'
uni-app 转换工具
'
)
.
usage
(
'
[options] [input_dir] [output_dir]
'
)
.
option
(
'
-v, --version
'
,
'
版本号
'
)
.
option
(
'
-p, --platform [platform]
'
,
'
可选`mp-weixin`,目前仅支持微信小程序向 uni-app 转换
'
)
.
parse
(
process
.
argv
)
if
(
Program
.
help
===
undefined
)
{
Program
.
outputHelp
()
process
.
exit
(
0
)
}
if
(
Program
.
version
===
undefined
)
{
console
.
log
(
pkg
.
version
)
process
.
exit
(
0
)
}
const
argsLen
=
Program
.
args
.
length
if
(
!
argsLen
)
{
Program
.
outputHelp
()
process
.
exit
(
0
)
}
const
options
=
{
platform
:
Program
.
platform
||
'
mp-weixin
'
}
if
(
argsLen
===
1
)
{
const
inputDir
=
path
.
resolve
(
Program
.
args
[
0
])
migrate
(
inputDir
,
inputDir
,
options
)
}
else
if
(
argsLen
>
1
)
{
const
inputDir
=
path
.
resolve
(
Program
.
args
[
0
])
const
outDir
=
path
.
resolve
(
Program
.
args
[
1
])
migrate
(
inputDir
,
outDir
,
options
)
}
packages/uni-migration/lib/index.js
浏览文件 @
ac836f89
...
...
@@ -15,10 +15,11 @@ module.exports = function migrate(input, out, options = {}) {
if
(
!
migrater
)
{
return
console
.
error
(
`错误: 目前支持 Object.keys(migraters).join(',') 转换`
)
}
out
=
out
||
input
input
=
path
.
resolve
(
input
)
out
=
path
.
resolve
(
out
||
input
)
if
(
!
validate
(
input
,
out
,
options
))
{
return
}
}
const
[
files
,
assets
]
=
migrater
.
transform
(
input
,
out
,
options
)
files
.
forEach
(
file
=>
{
options
.
silent
!==
true
&&
console
.
log
(
`write:
${
file
.
path
}
`
)
...
...
packages/uni-migration/lib/validate.js
浏览文件 @
ac836f89
...
...
@@ -6,7 +6,6 @@ const migraters = {
}
module
.
exports
=
function
validate
(
input
,
out
,
options
)
{
input
=
path
.
resolve
(
input
)
if
(
!
fs
.
existsSync
(
input
))
{
return
console
.
error
(
`错误: '
${
input
}
' 不存在`
)
}
...
...
packages/uni-migration/package.json
浏览文件 @
ac836f89
{
"name"
:
"@dcloudio/uni-migration"
,
"version"
:
"2.0.0-alpha-24420191128002"
,
"description"
:
"uni-app migration"
,
"main"
:
"lib/index.js"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"git+https://github.com/dcloudio/uni-app.git"
,
"directory"
:
"packages/uni-migration"
},
"files"
:
[
"lib"
],
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"110501ffb0313e417858dec92acf07522d4ded00"
,
"dependencies"
:
{
"mustache"
:
"^3.1.0"
,
"stricter-htmlparser2"
:
"^3.9.6"
}
{
"name"
:
"@dcloudio/uni-migration"
,
"version"
:
"2.0.0-alpha-24420191128005"
,
"description"
:
"uni-app migration"
,
"main"
:
"lib/index.js"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"git+https://github.com/dcloudio/uni-app.git"
,
"directory"
:
"packages/uni-migration"
},
"files"
:
[
"bin"
,
"lib"
],
"scripts"
:
{
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
},
"bin"
:
{
"uni-migration"
:
"./bin/uni-migration.js"
},
"author"
:
"fxy060608"
,
"license"
:
"Apache-2.0"
,
"gitHead"
:
"110501ffb0313e417858dec92acf07522d4ded00"
,
"dependencies"
:
{
"commander"
:
"^4.0.1"
,
"fs-extra"
:
"^8.1.0"
,
"mustache"
:
"^3.1.0"
,
"stricter-htmlparser2"
:
"^3.9.6"
}
}
packages/vue-cli-plugin-uni/generator.js
浏览文件 @
ac836f89
...
...
@@ -40,7 +40,8 @@ module.exports = (api, options, rootOptions) => {
'
vuex
'
:
'
^3.0.1
'
},
devDependencies
:
{
'
@dcloudio/uni-cli-shared
'
:
version
,
'
@dcloudio/uni-cli-shared
'
:
version
,
'
@dcloudio/uni-migration
'
:
version
,
'
@dcloudio/uni-template-compiler
'
:
version
,
'
@dcloudio/vue-cli-plugin-hbuilderx
'
:
version
,
'
@dcloudio/vue-cli-plugin-uni
'
:
version
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录