@dcloudio/vue-cli-plugin-uni 2.0.0-alpha-32920211104001 → 2.0.0-alpha-32920211110002
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/commands/build.js +50 -8
- package/package.json +3 -3
package/commands/build.js
CHANGED
|
@@ -3,7 +3,9 @@ const path = require('path')
|
|
|
3
3
|
const {
|
|
4
4
|
runByHBuilderX,
|
|
5
5
|
isInHBuilderX,
|
|
6
|
-
parseJson
|
|
6
|
+
parseJson,
|
|
7
|
+
parsePagesJson,
|
|
8
|
+
parseManifestJson
|
|
7
9
|
} = require('@dcloudio/uni-cli-shared')
|
|
8
10
|
|
|
9
11
|
const uniI18n = require('@dcloudio/uni-cli-i18n')
|
|
@@ -32,7 +34,8 @@ module.exports = (api, options) => {
|
|
|
32
34
|
'--auto-host': 'specify automator host',
|
|
33
35
|
'--auto-port': 'specify automator port',
|
|
34
36
|
'--subpackage': 'specify subpackage',
|
|
35
|
-
'--plugin': 'specify plugin'
|
|
37
|
+
'--plugin': 'specify plugin',
|
|
38
|
+
'--manifest': 'build manifest.json'
|
|
36
39
|
}
|
|
37
40
|
}, async (args) => {
|
|
38
41
|
for (const key in defaults) {
|
|
@@ -41,6 +44,10 @@ module.exports = (api, options) => {
|
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
|
|
47
|
+
if (args.manifest && process.env.UNI_PLATFORM === 'app-plus') {
|
|
48
|
+
return buildManifestJson()
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
const platforms = ['mp-weixin', 'mp-qq', 'mp-baidu', 'mp-alipay', 'mp-toutiao', 'mp-lark']
|
|
45
52
|
if (args.subpackage && platforms.includes(process.env.UNI_PLATFORM)) {
|
|
46
53
|
process.env.UNI_SUBPACKGE = args.subpackage
|
|
@@ -135,7 +142,10 @@ async function build (args, api, options) {
|
|
|
135
142
|
log()
|
|
136
143
|
|
|
137
144
|
if (!runByHBuilderX && !runByAliIde) {
|
|
138
|
-
logWithSpinner(uniI18n.__('pluginUni.startCompileProjectToPlatform', {
|
|
145
|
+
logWithSpinner(uniI18n.__('pluginUni.startCompileProjectToPlatform', {
|
|
146
|
+
0: process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM,
|
|
147
|
+
1: process.env.UNI_MP_PLUGIN ? uniI18n.__('plugin') : uniI18n.__('platform')
|
|
148
|
+
}))
|
|
139
149
|
}
|
|
140
150
|
|
|
141
151
|
const targetDir = api.resolve(options.outputDir)
|
|
@@ -161,7 +171,8 @@ async function build (args, api, options) {
|
|
|
161
171
|
process.env.UNI_USING_V3_NATIVE ||
|
|
162
172
|
(process.UNI_NVUE_ENTRY && Object.keys(process.UNI_NVUE_ENTRY).length)
|
|
163
173
|
) {
|
|
164
|
-
webpackConfigs.push(require('@dcloudio/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js')(process
|
|
174
|
+
webpackConfigs.push(require('@dcloudio/vue-cli-plugin-hbuilderx/build/webpack.nvue.conf.js')(process
|
|
175
|
+
.UNI_NVUE_ENTRY))
|
|
165
176
|
}
|
|
166
177
|
|
|
167
178
|
return new Promise((resolve, reject) => {
|
|
@@ -178,7 +189,8 @@ async function build (args, api, options) {
|
|
|
178
189
|
return reject('Build failed with errors.')
|
|
179
190
|
}
|
|
180
191
|
|
|
181
|
-
if (!args.silent && (process.env.UNI_PLATFORM !== 'app-plus' || process.env
|
|
192
|
+
if (!args.silent && (process.env.UNI_PLATFORM !== 'app-plus' || process.env
|
|
193
|
+
.UNI_AUTOMATOR_WS_ENDPOINT)) {
|
|
182
194
|
const targetDirShort = path.relative(
|
|
183
195
|
api.service.context,
|
|
184
196
|
process.env.UNI_OUTPUT_DIR
|
|
@@ -195,7 +207,8 @@ async function build (args, api, options) {
|
|
|
195
207
|
console.log('https://uniapp.dcloud.io/uniCloud/hosting')
|
|
196
208
|
}
|
|
197
209
|
} else {
|
|
198
|
-
const dirMsg = runByHBuilderX ? ''
|
|
210
|
+
const dirMsg = runByHBuilderX ? ''
|
|
211
|
+
: `The ${chalk.cyan(targetDirShort)} directory is ready. `
|
|
199
212
|
done(`Build complete. ${dirMsg}Watching for changes...`)
|
|
200
213
|
}
|
|
201
214
|
}
|
|
@@ -221,7 +234,9 @@ function analysisPluginDir () {
|
|
|
221
234
|
|
|
222
235
|
if (!fs.pathExistsSync(pluginJsonPath)) {
|
|
223
236
|
console.log()
|
|
224
|
-
console.error(uniI18n.__('pluginUni.fileNoExistsCheckAfterRetry', {
|
|
237
|
+
console.error(uniI18n.__('pluginUni.fileNoExistsCheckAfterRetry', {
|
|
238
|
+
0: pluginJsonName
|
|
239
|
+
}))
|
|
225
240
|
console.log()
|
|
226
241
|
process.exit(0)
|
|
227
242
|
}
|
|
@@ -235,8 +250,35 @@ function analysisPluginDir () {
|
|
|
235
250
|
|
|
236
251
|
if (UNI_MP_PLUGIN_MAIN && !fs.pathExistsSync(mainFilePath)) {
|
|
237
252
|
console.log()
|
|
238
|
-
console.error(uniI18n.__('pluginUni.entryDileNoExistsCheckAfterRetry', {
|
|
253
|
+
console.error(uniI18n.__('pluginUni.entryDileNoExistsCheckAfterRetry', {
|
|
254
|
+
0: UNI_MP_PLUGIN_MAIN
|
|
255
|
+
}))
|
|
239
256
|
console.log()
|
|
240
257
|
process.exit(0)
|
|
241
258
|
}
|
|
242
259
|
}
|
|
260
|
+
|
|
261
|
+
function buildManifestJson () {
|
|
262
|
+
const fs = require('fs-extra')
|
|
263
|
+
const inputDir = process.env.UNI_INPUT_DIR
|
|
264
|
+
const outputDir = process.env.UNI_OUTPUT_DIR
|
|
265
|
+
const pagesJsonPath = path.resolve(inputDir, 'pages.json')
|
|
266
|
+
const manifestJsonPath = path.resolve(inputDir, 'manifest.json')
|
|
267
|
+
|
|
268
|
+
const pagesJson = parsePagesJson(fs.readFileSync(pagesJsonPath, 'utf8'))
|
|
269
|
+
const manifestJson = parseManifestJson(fs.readFileSync(manifestJsonPath, 'utf8'))
|
|
270
|
+
|
|
271
|
+
const res = require('@dcloudio/webpack-uni-pages-loader/lib/platforms/app-plus/index.js')(pagesJson,
|
|
272
|
+
manifestJson,
|
|
273
|
+
false)
|
|
274
|
+
if (res && res[0]) {
|
|
275
|
+
fs.outputFileSync(
|
|
276
|
+
path.resolve(outputDir, 'manifest.json'),
|
|
277
|
+
res[0].content
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
const {
|
|
281
|
+
done
|
|
282
|
+
} = require('@vue/cli-shared-utils')
|
|
283
|
+
done('Build complete.')
|
|
284
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/vue-cli-plugin-uni",
|
|
3
|
-
"version": "2.0.0-alpha-
|
|
3
|
+
"version": "2.0.0-alpha-32920211110002",
|
|
4
4
|
"description": "uni-app plugin for vue-cli 3",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "fxy060608",
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@dcloudio/uni-stat": "^2.0.0-alpha-
|
|
20
|
+
"@dcloudio/uni-stat": "^2.0.0-alpha-32920211110002",
|
|
21
21
|
"buffer-json": "^2.0.0",
|
|
22
22
|
"copy-webpack-plugin": "^5.1.1",
|
|
23
23
|
"cross-env": "^5.2.0",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"wrap-loader": "^0.2.0",
|
|
38
38
|
"xregexp": "4.0.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "661c9ebad1aebdfce020e413ec36c8e0ff1fcc9f"
|
|
41
41
|
}
|