@dcloudio/uni-cli-shared
Advanced tools
Comparing version 0.2.91 to 0.2.92
const { | ||
updateAppJson, | ||
updatePageJson, | ||
updateProjectJson, | ||
updateComponentJson, | ||
updateUsingComponents, | ||
getChangedJsonFileMap | ||
updateAppJson, | ||
updatePageJson, | ||
updateUsingComponents, | ||
getChangedJsonFileMap | ||
} = require('../lib/cache') | ||
describe('shared:cache', () => { | ||
it('generate app.json', () => { | ||
const name = 'app' | ||
const appJson = { | ||
debug: true | ||
} | ||
updateAppJson(name, appJson) | ||
let appJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(appJsonStr).toBe(JSON.stringify(appJson, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
it('generate app.json', () => { | ||
const name = 'app' | ||
const appJson = { | ||
debug: true | ||
} | ||
updateAppJson(name, appJson) | ||
let appJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(appJsonStr).toBe(JSON.stringify(appJson, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
appJson.resizable = true | ||
updateAppJson(name, appJson) | ||
appJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(appJsonStr).toBe(JSON.stringify(appJson, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
appJson.resizable = true | ||
updateAppJson(name, appJson) | ||
appJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(appJsonStr).toBe(JSON.stringify(appJson, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
const usingComponents = { | ||
'my-component': '/components/component-tag-name' | ||
} | ||
updateUsingComponents('app', usingComponents) | ||
appJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
appJson.usingComponents = usingComponents | ||
expect(appJsonStr).toBe(JSON.stringify(appJson, null, 2)) | ||
}) | ||
const usingComponents = { | ||
'my-component': '/components/component-tag-name' | ||
} | ||
updateUsingComponents('app', usingComponents) | ||
appJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
appJson.usingComponents = usingComponents | ||
expect(appJsonStr).toBe(JSON.stringify(appJson, null, 2)) | ||
}) | ||
it('generate page.json', () => { | ||
const name = 'page/index/index' | ||
const pageJson = { | ||
navigationBarBackgroundColor: '#ffffff' | ||
} | ||
updatePageJson(name, pageJson) | ||
let pageJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(pageJsonStr).toBe(JSON.stringify(pageJson, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
it('generate page.json', () => { | ||
const name = 'page/index/index' | ||
const pageJson = { | ||
navigationBarBackgroundColor: '#ffffff' | ||
} | ||
updatePageJson(name, pageJson) | ||
let pageJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(pageJsonStr).toBe(JSON.stringify(pageJson, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
pageJson.navigationBarTextStyle = 'black' | ||
updatePageJson(name, pageJson) | ||
pageJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(pageJsonStr).toBe(JSON.stringify(pageJson, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
pageJson.navigationBarTextStyle = 'black' | ||
updatePageJson(name, pageJson) | ||
pageJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(pageJsonStr).toBe(JSON.stringify(pageJson, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
const usingComponents = { | ||
'my-component': '/components/component-tag-name' | ||
} | ||
updateUsingComponents(name, usingComponents) | ||
pageJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
pageJson.usingComponents = usingComponents | ||
expect(pageJsonStr).toBe(JSON.stringify(pageJson, null, 2)) | ||
}) | ||
const usingComponents = { | ||
'my-component': '/components/component-tag-name' | ||
} | ||
updateUsingComponents(name, usingComponents) | ||
pageJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
pageJson.usingComponents = usingComponents | ||
expect(pageJsonStr).toBe(JSON.stringify(pageJson, null, 2)) | ||
}) | ||
it('generate component.json', () => { | ||
const name = 'components/component-tag-name' | ||
let usingComponents = { | ||
'my-component': '/components/component-tag-name' | ||
} | ||
updateUsingComponents(name, usingComponents, 'Component') | ||
let componentJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(componentJsonStr).toBe(JSON.stringify({ | ||
usingComponents, | ||
component: true | ||
}, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
it('generate component.json', () => { | ||
const name = 'components/component-tag-name' | ||
let usingComponents = { | ||
'my-component': '/components/component-tag-name' | ||
} | ||
updateUsingComponents(name, usingComponents, 'Component') | ||
let componentJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(componentJsonStr).toBe(JSON.stringify({ | ||
usingComponents, | ||
component: true | ||
}, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
usingComponents = {} | ||
updateUsingComponents(name, usingComponents, 'Component') | ||
componentJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(componentJsonStr).toBe(JSON.stringify({ | ||
usingComponents, | ||
component: true | ||
}, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
}) | ||
usingComponents = {} | ||
updateUsingComponents(name, usingComponents, 'Component') | ||
componentJsonStr = getChangedJsonFileMap().get(name + '.json') | ||
expect(componentJsonStr).toBe(JSON.stringify({ | ||
usingComponents, | ||
component: true | ||
}, null, 2)) | ||
expect(0).toBe(getChangedJsonFileMap().size) | ||
}) | ||
}) |
@@ -171,4 +171,3 @@ const fs = require('fs') | ||
getPlatformVue () { | ||
if (process.env.UNI_USING_COMPONENTS && | ||
(process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'app-plus')) { | ||
if (process.env.UNI_USING_COMPONENTS && process.env.UNI_PLATFORM !== 'h5') { | ||
return uniRuntime | ||
@@ -179,4 +178,3 @@ } | ||
getPlatformCompiler () { | ||
if (process.env.UNI_USING_COMPONENTS && | ||
(process.env.UNI_PLATFORM === 'mp-weixin' || process.env.UNI_PLATFORM === 'app-plus')) { | ||
if (process.env.UNI_USING_COMPONENTS && process.env.UNI_PLATFORM !== 'h5') { | ||
return require(uniCompiler) | ||
@@ -183,0 +181,0 @@ } |
{ | ||
"name": "@dcloudio/uni-cli-shared", | ||
"version": "0.2.91", | ||
"version": "0.2.92", | ||
"description": "uni-cli-shared", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42726
12
29
849
1