json-sort-cli 2.0.13 → 2.0.14

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 (2) hide show
  1. package/cli.js +11 -7
  2. package/package.json +3 -3
package/cli.js CHANGED
@@ -3,20 +3,24 @@
3
3
  // VARS
4
4
  // -----------------------------------------------------------------------------
5
5
 
6
- import fs from "fs-extra";
7
- import chalk from "chalk";
8
- import { globby } from "globby";
9
6
  import meow from "meow";
10
7
  import path from "path";
11
- // import updateNotifier from "update-notifier";
8
+ import fs from "fs-extra";
9
+ import chalk from "chalk";
12
10
  import isDirectory from "is-d";
13
11
  import pReduce from "p-reduce";
14
12
  import pFilter from "p-filter";
13
+ import { globby } from "globby";
14
+ import { createRequire } from "module";
15
15
  import sortObject from "sorted-object";
16
- import { traverse } from "ast-monkey-traverse";
17
16
  import isObj from "lodash.isplainobject";
17
+ import updateNotifier from "update-notifier";
18
+ import { traverse } from "ast-monkey-traverse";
18
19
  import sortPackageJson from "sort-package-json";
19
20
 
21
+ const require1 = createRequire(import.meta.url);
22
+ const pkg = require1("./package.json");
23
+
20
24
  function isStr(something) {
21
25
  return typeof something === "string";
22
26
  }
@@ -125,7 +129,7 @@ const cli = meow(
125
129
  },
126
130
  }
127
131
  );
128
- // updateNotifier({ pkg: cli.pkg }).notify();
132
+ updateNotifier({ pkg }).notify();
129
133
 
130
134
  const nonJsonFormats = ["yml", "toml", "yaml"]; // to save time
131
135
  const badFiles = [
@@ -274,7 +278,7 @@ function readSortAndWriteOverFile(oneOfPaths) {
274
278
  // -----------------------------------------------------------------------------
275
279
 
276
280
  if (cli.flags.version) {
277
- log(cli.pkg.version);
281
+ log(pkg.version);
278
282
  process.exit(0);
279
283
  } else if (cli.flags.help) {
280
284
  log(cli.help);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-sort-cli",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "description": "Command line app to deep sort JSON files, retains package.json special key order",
5
5
  "keywords": [
6
6
  "app",
@@ -61,7 +61,7 @@
61
61
  "dependencies": {
62
62
  "ast-monkey-traverse": "^3.0.13",
63
63
  "chalk": "^5.0.1",
64
- "fs-extra": "^10.0.1",
64
+ "fs-extra": "^10.1.0",
65
65
  "globby": "^13.1.1",
66
66
  "is-d": "^1.0.0",
67
67
  "lodash.isplainobject": "^4.0.6",
@@ -73,7 +73,7 @@
73
73
  "update-notifier": "^5.1.0"
74
74
  },
75
75
  "devDependencies": {
76
- "@types/lodash.isplainobject": "^4.0.6",
76
+ "@types/lodash.isplainobject": "^4.0.7",
77
77
  "p-map": "^5.3.0"
78
78
  }
79
79
  }