@dcloudio/uni-migration 2.0.0 → 2.0.1-alpha-32920211110001
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/uni-migration.js +1 -1
- package/lib/index.js +2 -2
- package/lib/validate.js +5 -5
- package/package.json +2 -2
package/bin/uni-migration.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const fs = require('fs-extra')
|
|
3
|
-
|
|
3
|
+
const uniI18n = require('@dcloudio/uni-cli-i18n')
|
|
4
4
|
const validate = require('./validate')
|
|
5
5
|
|
|
6
6
|
const patchVant = require('./vant')
|
|
@@ -13,7 +13,7 @@ module.exports = function migrate (input, out, options = {}) {
|
|
|
13
13
|
options.platform = options.platform || 'mp-weixin'
|
|
14
14
|
const migrater = migraters[options.platform]
|
|
15
15
|
if (!migrater) {
|
|
16
|
-
return console.error(
|
|
16
|
+
return console.error(uniI18n.__('migration.errorOnlySupportConvert', { 0: Object.keys(migraters).join(',') }))
|
|
17
17
|
}
|
|
18
18
|
input = path.resolve(input)
|
|
19
19
|
out = path.resolve(out || input)
|
package/lib/validate.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const fs = require('fs')
|
|
2
2
|
const path = require('path')
|
|
3
|
-
|
|
3
|
+
const uniI18n = require('@dcloudio/uni-cli-i18n')
|
|
4
4
|
const migraters = {
|
|
5
5
|
'mp-weixin': require('./mp-weixin')
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
module.exports = function validate (input, out, options) {
|
|
9
9
|
if (!fs.existsSync(input)) {
|
|
10
|
-
return console.error(
|
|
10
|
+
return console.error(uniI18n.__('migration.errorInputNotExists', { 0: input }))
|
|
11
11
|
}
|
|
12
12
|
Object.assign(options, migraters[options.platform].options)
|
|
13
13
|
const templateExtname = options.extname.template
|
|
@@ -15,7 +15,7 @@ module.exports = function validate (input, out, options) {
|
|
|
15
15
|
const stat = fs.lstatSync(input)
|
|
16
16
|
if (stat.isFile()) {
|
|
17
17
|
if (path.extname(input) !== templateExtname) {
|
|
18
|
-
return console.error(
|
|
18
|
+
return console.error(uniI18n.__('migration.errorConvertRequireFileUrl', { 0: templateExtname.substr(1) }))
|
|
19
19
|
}
|
|
20
20
|
options.target = 'file'
|
|
21
21
|
} else if (stat.isDirectory()) {
|
|
@@ -26,7 +26,7 @@ module.exports = function validate (input, out, options) {
|
|
|
26
26
|
options.target = 'folder'
|
|
27
27
|
}
|
|
28
28
|
} else {
|
|
29
|
-
return console.error(
|
|
29
|
+
return console.error(uniI18n.__('migration.errorCannotConvert', { 0: input }))
|
|
30
30
|
}
|
|
31
31
|
return true
|
|
32
|
-
}
|
|
32
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-migration",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-alpha-32920211110001",
|
|
4
4
|
"description": "uni-app migration",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"author": "fxy060608",
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "7cba94e25eba256f3cab0f2b2b73383bd25abe49",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"commander": "^4.0.1",
|
|
26
26
|
"fs-extra": "^8.1.0",
|