Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dcloudio/uni-cli-shared

Package Overview
Dependencies
Maintainers
4
Versions
1739
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dcloudio/uni-cli-shared - npm Package Compare versions

Comparing version 0.2.91 to 0.2.92

.DS_Store

141

__tests__/cache.spec.js
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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc