json-sort-cli 2.0.4 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -20
- package/LICENSE +1 -1
- package/README.md +5 -2
- package/cli.js +5 -5
- package/package.json +20 -46
package/CHANGELOG.md
CHANGED
|
@@ -3,26 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 2.0.3 (2021-11-02)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([b1ebce1](https://github.com/codsen/codsen/commit/b1ebce1637d8c41c2d848fc24b0ba4058865bd5d))
|
|
11
|
-
|
|
12
|
-
### Features
|
|
13
|
-
|
|
14
|
-
- migrate to ES Modules ([c579dff](https://github.com/codsen/codsen/commit/c579dff3b23205e383035ca10ddcec671e35d0fe))
|
|
15
|
-
|
|
16
|
-
### BREAKING CHANGES
|
|
17
|
-
|
|
18
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
19
|
-
|
|
20
|
-
## 2.0.1 (2021-09-13)
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
25
|
-
|
|
26
6
|
## 2.0.0 (2021-09-09)
|
|
27
7
|
|
|
28
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
package/README.md
CHANGED
|
@@ -32,16 +32,17 @@ This package is ESM only: Node 12+ is needed to use it and it must be imported i
|
|
|
32
32
|
npm i -g json-sort-cli
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
+
|
|
36
|
+
|
|
35
37
|
Then, call it from the command line using one of the following keywords:
|
|
36
38
|
|
|
37
39
|
```bash
|
|
38
40
|
jsonsort
|
|
39
41
|
sortjson
|
|
40
42
|
```
|
|
41
|
-
|
|
42
43
|
## Documentation
|
|
43
44
|
|
|
44
|
-
Please [visit codsen.com](https://codsen.com/os/json-sort-cli/) for a full description of the API
|
|
45
|
+
Please [visit codsen.com](https://codsen.com/os/json-sort-cli/) for a full description of the API.
|
|
45
46
|
|
|
46
47
|
## Contributing
|
|
47
48
|
|
|
@@ -53,4 +54,6 @@ MIT License
|
|
|
53
54
|
|
|
54
55
|
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
55
56
|
|
|
57
|
+
|
|
56
58
|
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
|
|
59
|
+
|
package/cli.js
CHANGED
|
@@ -25,14 +25,14 @@ function format(obj) {
|
|
|
25
25
|
if (typeof obj !== "object") {
|
|
26
26
|
return obj;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
let sortOrder = sortPackageJson.sortOrder
|
|
29
29
|
// 1. delete tap and lect fields
|
|
30
30
|
.filter((field) => !["lect", "tap"].includes(field));
|
|
31
31
|
|
|
32
32
|
// 2. then, insert both after resolutions, first tap then lect
|
|
33
33
|
// console.log(sortOrder);
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
let idxOfResolutions = sortOrder.indexOf("resolutions");
|
|
36
36
|
// console.log(idxOfResolutions);
|
|
37
37
|
// => 63
|
|
38
38
|
|
|
@@ -202,9 +202,9 @@ function readSortAndWriteOverFile(oneOfPaths) {
|
|
|
202
202
|
// In this function, readSortAndWriteOverFile(), path came in,
|
|
203
203
|
// we read it, now we return true if result differs after processing
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
let stringified = JSON.stringify(
|
|
206
206
|
traverse(obj, (key, val) => {
|
|
207
|
-
|
|
207
|
+
let current = val !== undefined ? val : key;
|
|
208
208
|
if (isObj(current)) {
|
|
209
209
|
return sortObject(current);
|
|
210
210
|
}
|
|
@@ -229,7 +229,7 @@ function readSortAndWriteOverFile(oneOfPaths) {
|
|
|
229
229
|
.writeJson(
|
|
230
230
|
oneOfPaths,
|
|
231
231
|
traverse(obj, (key, val) => {
|
|
232
|
-
|
|
232
|
+
let current = val !== undefined ? val : key;
|
|
233
233
|
if (isObj(current)) {
|
|
234
234
|
return sortObject(current);
|
|
235
235
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-sort-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "Command line app to deep sort JSON files, retains package.json special key order",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -32,73 +32,47 @@
|
|
|
32
32
|
"sortjson": "cli.js"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"republish": "npm publish || :",
|
|
44
|
-
"tap": "tap",
|
|
45
|
-
"test": "npm run lint && npm run unittest && npm run format",
|
|
46
|
-
"unittest": "tap --no-only --output-file=testStats.md --reporter=terse && npm run clean_cov"
|
|
35
|
+
"build": "echo 'no build needed'",
|
|
36
|
+
"dev": "echo 'no build needed'",
|
|
37
|
+
"lect": "node '../../ops/lect/lect.js'",
|
|
38
|
+
"letspublish": "yarn publish || :",
|
|
39
|
+
"lint": "eslint . --fix",
|
|
40
|
+
"prepare": "echo 'ready'",
|
|
41
|
+
"test": "c8 yarn run unit && yarn run lint",
|
|
42
|
+
"unit": "uvu test"
|
|
47
43
|
},
|
|
48
|
-
"
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
46
|
+
},
|
|
47
|
+
"c8": {
|
|
49
48
|
"check-coverage": false,
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
],
|
|
54
|
-
"node-arg": [
|
|
55
|
-
"--no-warnings",
|
|
56
|
-
"--experimental-loader",
|
|
57
|
-
"@istanbuljs/esm-loader-hook"
|
|
58
|
-
],
|
|
59
|
-
"timeout": 0
|
|
49
|
+
"exclude": [
|
|
50
|
+
"**/test/**/*.*"
|
|
51
|
+
]
|
|
60
52
|
},
|
|
61
53
|
"lect": {
|
|
62
54
|
"licence": {
|
|
63
55
|
"extras": [
|
|
64
56
|
""
|
|
65
57
|
]
|
|
66
|
-
},
|
|
67
|
-
"various": {
|
|
68
|
-
"devDependencies": [
|
|
69
|
-
"@types/lodash.isplainobject",
|
|
70
|
-
"p-map"
|
|
71
|
-
]
|
|
72
58
|
}
|
|
73
59
|
},
|
|
74
60
|
"dependencies": {
|
|
75
|
-
"ast-monkey-traverse": "^3.0.
|
|
61
|
+
"ast-monkey-traverse": "^3.0.10",
|
|
76
62
|
"chalk": "^4.1.2",
|
|
77
63
|
"fs-extra": "^10.0.0",
|
|
78
64
|
"globby": "^12.0.2",
|
|
79
65
|
"is-d": "^1.0.0",
|
|
80
66
|
"lodash.isplainobject": "^4.0.6",
|
|
81
|
-
"meow": "^10.1.
|
|
67
|
+
"meow": "^10.1.2",
|
|
82
68
|
"p-filter": "^3.0.0",
|
|
83
69
|
"p-reduce": "^3.0.0",
|
|
84
|
-
"sort-package-json": "^1.
|
|
70
|
+
"sort-package-json": "^1.53.1",
|
|
85
71
|
"sorted-object": "^2.0.1",
|
|
86
72
|
"update-notifier": "^5.1.0"
|
|
87
73
|
},
|
|
88
74
|
"devDependencies": {
|
|
89
|
-
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
90
75
|
"@types/lodash.isplainobject": "^4.0.6",
|
|
91
|
-
"
|
|
92
|
-
"cross-env": "^7.0.3",
|
|
93
|
-
"eslint": "^8.1.0",
|
|
94
|
-
"execa": "^5.1.1",
|
|
95
|
-
"lect": "^0.18.4",
|
|
96
|
-
"p-map": "^5.3.0",
|
|
97
|
-
"tap": "^15.0.10",
|
|
98
|
-
"tempy": "^2.0.0",
|
|
99
|
-
"tslib": "^2.3.1"
|
|
100
|
-
},
|
|
101
|
-
"engines": {
|
|
102
|
-
"node": ">=12"
|
|
76
|
+
"p-map": "^5.3.0"
|
|
103
77
|
}
|
|
104
78
|
}
|