@dcloudio/uni-cli-shared 2.0.0-alpha-32920211101001 → 2.0.0-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/lib/manifest.js +2 -3
- package/lib/util.js +20 -0
- package/package.json +2 -2
package/lib/manifest.js
CHANGED
|
@@ -85,8 +85,7 @@ function getH5Options (manifestJson) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/* eslint-disable no-mixed-operators */
|
|
88
|
-
h5.template = h5.template && path.resolve(process.env.UNI_INPUT_DIR, h5.template) || path.resolve(
|
|
89
|
-
'../../../../public/index.html')
|
|
88
|
+
h5.template = h5.template && path.resolve(process.env.UNI_INPUT_DIR, h5.template) || path.resolve(require('./util').getCLIContext(), 'public/index.html')
|
|
90
89
|
|
|
91
90
|
h5.devServer = h5.devServer || {}
|
|
92
91
|
|
|
@@ -103,4 +102,4 @@ module.exports = {
|
|
|
103
102
|
parseManifestJson,
|
|
104
103
|
getNetworkTimeout,
|
|
105
104
|
getH5Options
|
|
106
|
-
}
|
|
105
|
+
}
|
package/lib/util.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
|
+
const fs = require('fs')
|
|
2
3
|
const hash = require('hash-sum')
|
|
3
4
|
const crypto = require('crypto')
|
|
4
5
|
|
|
@@ -14,6 +15,24 @@ try {
|
|
|
14
15
|
const isInHBuilderX = !!aboutPkg
|
|
15
16
|
const isInHBuilderXAlpha = !!(isInHBuilderX && aboutPkg.alpha)
|
|
16
17
|
|
|
18
|
+
function getCLIContext () {
|
|
19
|
+
var context = path.resolve(__dirname, '../../../../')
|
|
20
|
+
// const isInHBuilderX = fs.existsSync(path.resolve(context, 'bin/uniapp-cli.js'))
|
|
21
|
+
if (isInHBuilderX) {
|
|
22
|
+
return context
|
|
23
|
+
}
|
|
24
|
+
const pnpmFind = __dirname.match(/.+?[/\\].pnpm[/\\]/)
|
|
25
|
+
if (pnpmFind) {
|
|
26
|
+
const pnpm = pnpmFind[0]
|
|
27
|
+
context = path.resolve(pnpm, '../../')
|
|
28
|
+
}
|
|
29
|
+
const isInCLI = fs.existsSync(path.resolve(context, './src'))
|
|
30
|
+
if (isInCLI) {
|
|
31
|
+
return context
|
|
32
|
+
}
|
|
33
|
+
return process.cwd()
|
|
34
|
+
}
|
|
35
|
+
|
|
17
36
|
function removeExt (str, ext) {
|
|
18
37
|
if (ext) {
|
|
19
38
|
const reg = new RegExp(ext.replace(/\./, '\\.') + '$')
|
|
@@ -105,6 +124,7 @@ const _hasOwnProperty = Object.prototype.hasOwnProperty
|
|
|
105
124
|
module.exports = {
|
|
106
125
|
isInHBuilderX,
|
|
107
126
|
isInHBuilderXAlpha,
|
|
127
|
+
getCLIContext,
|
|
108
128
|
normalizeNodeModules,
|
|
109
129
|
md5,
|
|
110
130
|
hasOwn (obj, key) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "2.0.0-alpha-
|
|
3
|
+
"version": "2.0.0-alpha-32920211110001",
|
|
4
4
|
"description": "uni-cli-shared",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"postcss-urlrewrite": "^0.2.2",
|
|
24
24
|
"strip-json-comments": "^2.0.1"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "15d9991409fe19a87c764c3132c1395dc3b891a2"
|
|
27
27
|
}
|