diff --git a/packages/uni-cli-shared/lib/util.js b/packages/uni-cli-shared/lib/util.js index 26e836fd3e0b6d07ff438abb7682c5856d912688..e0190815fba4fc0174d8775b28884b78e7880357 100644 --- a/packages/uni-cli-shared/lib/util.js +++ b/packages/uni-cli-shared/lib/util.js @@ -1,4 +1,5 @@ const path = require('path') +const fs = require('fs') const hash = require('hash-sum') const crypto = require('crypto') @@ -20,7 +21,7 @@ function getCLIContext () { if (isInHBuilderX) { return context } - const pnpmFind = __dirname.match(/.+?[\/\\].pnpm[\/\\]/) + const pnpmFind = __dirname.match(/.+?[/\\].pnpm[/\\]/) if (pnpmFind) { const pnpm = pnpmFind[0] context = path.resolve(pnpm, '../../') diff --git a/packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js b/packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js index 7b95a1b98873d4c60df154502f2fe603aa32e223..7f6795a909747e5b32e36347be809ec98f7df86a 100644 --- a/packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js +++ b/packages/uni-template-compiler/__tests__/compiler-app-plus.service.spec.js @@ -193,7 +193,7 @@ describe('codegen', () => { `with(this){return _c('p',{slot:"one"})}` ) }) - + it('generate slot with v-for', () => { assertCodegen( '
', diff --git a/packages/vue-cli-plugin-uni/lib/check-update.js b/packages/vue-cli-plugin-uni/lib/check-update.js index 5e0779dfd30d97dbf6628b8440f5cdd7bf6f0e8e..848cd59ba3a1e8f4e0a8cececc91036d5ebc1f48 100644 --- a/packages/vue-cli-plugin-uni/lib/check-update.js +++ b/packages/vue-cli-plugin-uni/lib/check-update.js @@ -21,6 +21,7 @@ class Upate { get uniId () { return this._uniId } + set uniId (value) { this._uniId = value } @@ -28,6 +29,7 @@ class Upate { get appId () { return this._appId } + set appId (value) { this._appId = value } @@ -35,6 +37,7 @@ class Upate { get compilerVersion () { return this._compilerVersion } + set compilerVersion (value) { this._compilerVersion = value } @@ -42,6 +45,7 @@ class Upate { get isAlpha () { return this._isAlpha } + set isAlpha (value) { this._isAlpha = value } @@ -49,6 +53,7 @@ class Upate { get wt () { return this._wt } + set wt (value) { this._wt = value } @@ -56,6 +61,7 @@ class Upate { get lc () { return this._lc } + set lc (value) { this._lc = value } @@ -63,6 +69,7 @@ class Upate { get lcin () { return this._lcin } + set lcin (value) { this._lcin = value } @@ -257,17 +264,17 @@ Object.assign(Upate.prototype, { DEFAULT_INTERVAL: 1000 * 60 * 60 * 24 }) -function getLc() { - let result = [] - const locale_dir = path.join(process.env.UNI_CLI_CONTEXT, 'src/locale') - if (!fs.existsSync(locale_dir)) { +function getLc () { + const result = [] + const localeDir = path.join(process.env.UNI_CLI_CONTEXT, 'src/locale') + if (!fs.existsSync(localeDir)) { return result } - let files = fs.readdirSync(locale_dir) + const files = fs.readdirSync(localeDir) for (let i = files.length - 1; i >= 0; i--) { - let filePath = files[i] - let extName = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase() + const filePath = files[i] + const extName = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase() if (extName !== 'json') { continue } @@ -300,9 +307,9 @@ module.exports = async function checkUpdate () { update.uniId = manifest.appid const appIdKey = process.env.UNI_PLATFORM.includes('quickapp') ? 'package' : 'appid' update.appId = manifest[process.env.UNI_PLATFORM] ? (manifest[process.env.UNI_PLATFORM][appIdKey] || '') : '' - const cf = manifest['mp-weixin'] ? manifest['mp-weixin']['cloudfunctionRoot'] : '' + const cf = manifest['mp-weixin'] ? manifest['mp-weixin'].cloudfunctionRoot : '' update.wt = (cf && cf.length) ? 1 : 0 - update.lc = manifest['locale'] ? manifest['locale'] : '' + update.lc = manifest.locale ? manifest.locale : '' update.lcin = getLc().join(',') update.check() } catch (e) {