Skip to content

Commit 2778dde

Browse files
committed
feat: adds compatibility yargs ^18.0.0, drop compatibility for node <20
1 parent 42ec32e commit 2778dde

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

.github/workflows/node.js.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
node-version: [12, 14, 16, 18, 20, 22]
13+
node-version: [20, 22, 24]
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
- name: Use Node.js ${{ matrix.node-version }}
17-
uses: actions/setup-node@v4
17+
uses: actions/setup-node@v6
1818
with:
1919
node-version: ${{ matrix.node-version }}
2020
- run: npm install

.github/workflows/npm-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515
- uses: actions/setup-node@v4
1616
with:
1717
node-version: latest
@@ -23,8 +23,8 @@ jobs:
2323
needs: build
2424
runs-on: ubuntu-latest
2525
steps:
26-
- uses: actions/checkout@v4
27-
- uses: actions/setup-node@v4
26+
- uses: actions/checkout@v5
27+
- uses: actions/setup-node@v6
2828
with:
2929
node-version: latest
3030
registry-url: https://registry.npmjs.org/

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Options:
2626
--indent, --id Indentation width (in spaces) [number] [default: 2]
2727
-e, --encoding Input encoding [choices: "ascii", "utf8", "utf16le"] [default: "utf8"]
2828
-q, --quotingStyle Strings will be quoted using this quoting style [choices: "single", "double"] [default: "single"]
29-
-f, --forceQuotes Force quotes for all scalar values [boolean] [default: false]
29+
-f, --forceQuotes Force quotes around all strings [boolean]
3030
-w, --lineWidth Wrap line width (-1 for unlimited width) [number] [default: 80]
3131
-h, --help Show help [boolean]
3232
--version Show version number [boolean]
@@ -35,6 +35,5 @@ Examples:
3535
yaml-sort --input config.yml Sorts alphabetically and overwrites the file config.yml
3636
yaml-sort --input config.yml --lineWidth 100 --stdout Sorts the file config.yml and output result to STDOUT wrapped to 100 columns
3737
yaml-sort --input config.yml --indent 4 --output sorted.yml Indents with 4 spaces and outputs result to file sorted.yml
38-
yaml-sort --input config.yml --forceQuotes --quotingStyle double Forces double quotes for all scalar values
3938
cat config.yml | yaml-sort Sorts alphabetically from STDIN
4039
```

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
"homepage": "https://github.com/ddebin/yaml-sort#readme",
3232
"dependencies": {
3333
"js-yaml": "^4.0.0",
34-
"yargs": "^17.0.0"
34+
"yargs": "^18.0.0"
3535
},
3636
"devDependencies": {
3737
"standard": "^17.0.0",
3838
"tape": "^5.6.6",
3939
"tape-spawn": "^1.4.2"
4040
},
4141
"engines": {
42-
"node": ">=12"
42+
"node": ">=20"
4343
}
4444
}

yaml-sort.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
const fs = require('fs')
66
const yaml = require('js-yaml')
77
const yargs = require('yargs')
8+
const { hideBin } = require('yargs/helpers')
89

9-
const argv = yargs
10+
const argv = yargs(hideBin(process.argv))
1011
.usage('Usage: $0 [options]')
1112
.example([
1213
['$0 --input config.yml',
@@ -79,7 +80,7 @@ const argv = yargs
7980
.alias('h', 'help')
8081
.version()
8182
.wrap(null)
82-
.argv
83+
.parse()
8384

8485
let success = true
8586

0 commit comments

Comments
 (0)