chore: bump js-yaml version

This commit is contained in:
Haoqun Jiang
2021-02-23 15:44:02 +08:00
parent df00b3e0bc
commit 8670997258
5 changed files with 10 additions and 10 deletions

View File

@@ -77,7 +77,7 @@ function readFile (config, fileDescriptor, context) {
if (file.type === 'json') {
fileData = JSON.parse(rawContent)
} else if (file.type === 'yaml') {
fileData = yaml.safeLoad(rawContent)
fileData = yaml.load(rawContent)
}
}
}
@@ -121,7 +121,7 @@ function writeFile (config, fileId, data, changedFields, context) {
if (file.type === 'json') {
rawContent = JSON.stringify(data, null, 2)
} else if (file.type === 'yaml') {
rawContent = yaml.safeDump(data)
rawContent = yaml.dump(data)
} else if (file.type === 'js') {
const source = fs.readFileSync(file.path, { encoding: 'utf8' })
if (!source.trim()) {

View File

@@ -49,7 +49,7 @@
"graphql-tag": "^2.10.3",
"graphql-type-json": "^0.3.1",
"javascript-stringify": "^2.0.1",
"js-yaml": "^3.14.1",
"js-yaml": "^4.0.0",
"lodash.merge": "^4.6.1",
"lowdb": "^1.0.0",
"lru-cache": "^6.0.0",

View File

@@ -134,8 +134,8 @@ test('invoke with existing files (yaml)', async () => {
await project.write(`.eslintrc.yml`, `
root: true
extends:
- 'plugin:vue/essential'
- 'eslint:recommended'
- plugin:vue/essential
- eslint:recommended
`.trim())
await project.run(`${require.resolve('../bin/vue')} invoke eslint --config airbnb`)
@@ -143,8 +143,8 @@ extends:
const updated = await project.read('.eslintrc.yml')
expect(updated).toMatch(`
extends:
- 'plugin:vue/essential'
- 'eslint:recommended'
- plugin:vue/essential
- eslint:recommended
- '@vue/airbnb'
`.trim())
})

View File

@@ -48,9 +48,9 @@ const transformJSON = {
}
const transformYAML = {
read: ({ source }) => require('js-yaml').safeLoad(source),
read: ({ source }) => require('js-yaml').load(source),
write: ({ value, existing }) => {
return require('js-yaml').safeDump(merge(existing, value, mergeOptions), {
return require('js-yaml').dump(merge(existing, value, mergeOptions), {
skipInvalid: true
})
}

View File

@@ -45,7 +45,7 @@
"inquirer": "^7.1.0",
"isbinaryfile": "^4.0.6",
"javascript-stringify": "^2.0.1",
"js-yaml": "^3.14.1",
"js-yaml": "^4.0.0",
"leven": "^3.1.0",
"lodash.clonedeep": "^4.5.0",
"lru-cache": "^6.0.0",