json-sort-cli 2.0.7 → 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.
Files changed (3) hide show
  1. package/README.md +5 -2
  2. package/cli.js +5 -5
  3. package/package.json +18 -42
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 and examples.
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
- const sortOrder = sortPackageJson.sortOrder
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
- const idxOfResolutions = sortOrder.indexOf("resolutions");
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
- const stringified = JSON.stringify(
205
+ let stringified = JSON.stringify(
206
206
  traverse(obj, (key, val) => {
207
- const current = val !== undefined ? val : key;
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
- const current = val !== undefined ? val : key;
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.7",
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,45 +32,33 @@
32
32
  "sortjson": "cli.js"
33
33
  },
34
34
  "scripts": {
35
- "build": "echo 'skip build step for a CLI'",
36
- "ci_test": "npm run format && tap --no-only --reporter=silent",
37
- "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
38
- "dev": "echo\"\"",
39
- "devunittest": "npm run dev && tap --only -R 'base'",
40
- "format": "npm run lect && npm run prettier && npm run lint",
41
- "lect": "lect",
42
- "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --fix --config \"../../.eslintrc.json\" --quiet",
43
- "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
44
- "republish": "npm publish || :",
45
- "tap": "tap",
46
- "test": "npm run test:ci",
47
- "test:ci": "npm run lint && npm run unittest && npm run format",
48
- "unittest": "tap --no-only --reporter=terse"
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"
49
43
  },
50
- "tap": {
44
+ "engines": {
45
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
46
+ },
47
+ "c8": {
51
48
  "check-coverage": false,
52
- "node-arg": [
53
- "--no-warnings",
54
- "--experimental-loader",
55
- "@istanbuljs/esm-loader-hook"
56
- ],
57
- "timeout": 0
49
+ "exclude": [
50
+ "**/test/**/*.*"
51
+ ]
58
52
  },
59
53
  "lect": {
60
54
  "licence": {
61
55
  "extras": [
62
56
  ""
63
57
  ]
64
- },
65
- "various": {
66
- "devDependencies": [
67
- "@types/lodash.isplainobject",
68
- "p-map"
69
- ]
70
58
  }
71
59
  },
72
60
  "dependencies": {
73
- "ast-monkey-traverse": "^3.0.7",
61
+ "ast-monkey-traverse": "^3.0.10",
74
62
  "chalk": "^4.1.2",
75
63
  "fs-extra": "^10.0.0",
76
64
  "globby": "^12.0.2",
@@ -84,19 +72,7 @@
84
72
  "update-notifier": "^5.1.0"
85
73
  },
86
74
  "devDependencies": {
87
- "@istanbuljs/esm-loader-hook": "^0.1.2",
88
75
  "@types/lodash.isplainobject": "^4.0.6",
89
- "core-js": "^3.19.2",
90
- "cross-env": "^7.0.3",
91
- "eslint": "^8.3.0",
92
- "execa": "^6.0.0",
93
- "lect": "^0.18.7",
94
- "p-map": "^5.3.0",
95
- "tap": "^15.1.5",
96
- "tempy": "^2.0.0",
97
- "tslib": "^2.3.1"
98
- },
99
- "engines": {
100
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
76
+ "p-map": "^5.3.0"
101
77
  }
102
78
  }