json-sort-cli 2.0.6 → 2.0.12

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 (4) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2 -4
  3. package/cli.js +5 -5
  4. package/package.json +21 -44
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 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
@@ -26,8 +26,6 @@
26
26
 
27
27
  ## Install
28
28
 
29
- This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
30
-
31
29
  ```bash
32
30
  npm i -g json-sort-cli
33
31
  ```
@@ -41,7 +39,7 @@ sortjson
41
39
 
42
40
  ## Documentation
43
41
 
44
- Please [visit codsen.com](https://codsen.com/os/json-sort-cli/) for a full description of the API and examples.
42
+ Please [visit codsen.com](https://codsen.com/os/json-sort-cli/) for a full description of the API.
45
43
 
46
44
  ## Contributing
47
45
 
@@ -51,6 +49,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
51
49
 
52
50
  MIT License
53
51
 
54
- Copyright (c) 2010-2021 Roy Revelt and other contributors
52
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
55
53
 
56
54
  <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">
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.6",
3
+ "version": "2.0.12",
4
4
  "description": "Command line app to deep sort JSON files, retains package.json special key order",
5
5
  "keywords": [
6
6
  "app",
@@ -32,48 +32,37 @@
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
+ "prettier:format": "prettier --write '**/*.{js,md}' --no-error-on-unmatched-pattern",
42
+ "test": "c8 yarn run unit && yarn run lint",
43
+ "unit": "uvu test"
49
44
  },
50
- "tap": {
45
+ "engines": {
46
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
47
+ },
48
+ "c8": {
51
49
  "check-coverage": false,
52
- "node-arg": [
53
- "--no-warnings",
54
- "--experimental-loader",
55
- "@istanbuljs/esm-loader-hook"
56
- ],
57
- "timeout": 0
50
+ "exclude": [
51
+ "**/test/**/*.*"
52
+ ]
58
53
  },
59
54
  "lect": {
60
55
  "licence": {
61
56
  "extras": [
62
57
  ""
63
58
  ]
64
- },
65
- "various": {
66
- "devDependencies": [
67
- "@types/lodash.isplainobject",
68
- "p-map"
69
- ]
70
59
  }
71
60
  },
72
61
  "dependencies": {
73
- "ast-monkey-traverse": "^3.0.6",
74
- "chalk": "^4.1.2",
62
+ "ast-monkey-traverse": "^3.0.12",
63
+ "chalk": "^5.0.0",
75
64
  "fs-extra": "^10.0.0",
76
- "globby": "^12.0.2",
65
+ "globby": "^12.2.0",
77
66
  "is-d": "^1.0.0",
78
67
  "lodash.isplainobject": "^4.0.6",
79
68
  "meow": "^10.1.2",
@@ -84,19 +73,7 @@
84
73
  "update-notifier": "^5.1.0"
85
74
  },
86
75
  "devDependencies": {
87
- "@istanbuljs/esm-loader-hook": "^0.1.2",
88
76
  "@types/lodash.isplainobject": "^4.0.6",
89
- "core-js": "^3.19.1",
90
- "cross-env": "^7.0.3",
91
- "eslint": "^8.3.0",
92
- "execa": "^6.0.0",
93
- "lect": "^0.18.6",
94
- "p-map": "^5.3.0",
95
- "tap": "^15.1.2",
96
- "tempy": "^2.0.0",
97
- "tslib": "^2.3.1"
98
- },
99
- "engines": {
100
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
77
+ "p-map": "^5.3.0"
101
78
  }
102
79
  }