Skip to content

Commit

Permalink
Upgrade js-yaml to 4.x. Quoting changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
ddebin committed Apr 1, 2021
1 parent a6c58e1 commit d8e1b6b
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 19 deletions.
64 changes: 51 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yaml-sort",
"version": "1.0.6",
"version": "1.1.0",
"description": "CLI tool to sort YAML files alphabetically",
"main": "yaml-sort.js",
"scripts": {
Expand Down Expand Up @@ -28,7 +28,7 @@
},
"homepage": "https://github.com/ddebin/yaml-sort#readme",
"dependencies": {
"js-yaml": "^3.14.1",
"js-yaml": "^4.0.0",
"yargs": "^15.0.0"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('CLI w/o arg', (t) => {
test('CLI w/ arg', (t) => {
const proc = spawn(t, '../yaml-sort.js --input test.yml --stdout', opts);
proc.exitCode(0);
proc.stdout.match('a: \'Lorem ipsum dolor sit amet, consectetur adipiscing elit...\'\n' +
proc.stdout.match('a: Lorem ipsum dolor sit amet, consectetur adipiscing elit...\n' +
'b:\n' +
' b: 35\n' +
' c:\n' +
Expand All @@ -31,7 +31,7 @@ test('CLI --output', (t) => {
' && cat output.yml' +
' && rm -f output.yml', opts);
proc.exitCode(0);
proc.stdout.match('a: \'Lorem ipsum dolor sit amet, consectetur adipiscing elit...\'\n' +
proc.stdout.match('a: Lorem ipsum dolor sit amet, consectetur adipiscing elit...\n' +
'b:\n' +
' b: 35\n' +
' c:\n' +
Expand All @@ -42,7 +42,7 @@ test('CLI --output', (t) => {
test('CLI --indent', (t) => {
const proc = spawn(t, '../yaml-sort.js --input test.yml --stdout --indent 4', opts);
proc.exitCode(0);
proc.stdout.match('a: \'Lorem ipsum dolor sit amet, consectetur adipiscing elit...\'\n' +
proc.stdout.match('a: Lorem ipsum dolor sit amet, consectetur adipiscing elit...\n' +
'b:\n' +
' b: 35\n' +
' c:\n' +
Expand Down
2 changes: 1 addition & 1 deletion yaml-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ argv.input.forEach((file) => {
try {
const content = fs.readFileSync(file, 'utf8');

const sorted = yaml.safeDump(yaml.safeLoad(content), {
const sorted = yaml.dump(yaml.load(content), {
sortKeys: true,
indent: argv.indent,
lineWidth: argv.lineWidth,
Expand Down

0 comments on commit d8e1b6b

Please sign in to comment.