@socketsecurity/cli 0.2.0 → 0.2.1

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/cli.js CHANGED
@@ -8,9 +8,12 @@ import * as cliCommands from './lib/commands/index.js'
8
8
  import { logSymbols } from './lib/utils/chalk-markdown.js'
9
9
  import { AuthError, InputError } from './lib/utils/errors.js'
10
10
  import { meowWithSubcommands } from './lib/utils/meow-with-subcommands.js'
11
+ import { initUpdateNotifier } from './lib/utils/update-notifier.js'
11
12
 
12
13
  // TODO: Add autocompletion using https://www.npmjs.com/package/omelette
13
14
 
15
+ initUpdateNotifier()
16
+
14
17
  try {
15
18
  await meowWithSubcommands(
16
19
  cliCommands,
@@ -0,0 +1,15 @@
1
+ import { readFile } from 'node:fs/promises'
2
+
3
+ import updateNotifier from 'update-notifier'
4
+
5
+ /** @returns {void} */
6
+ export function initUpdateNotifier () {
7
+ readFile(new URL('../../package.json', import.meta.url), 'utf8')
8
+ .then(rawPkg => {
9
+ const pkg = JSON.parse(rawPkg)
10
+ updateNotifier({ pkg }).notify()
11
+ })
12
+ .catch(() => {
13
+ // Fail silently if package.json could not be read or parsed
14
+ })
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@socketsecurity/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "CLI tool for Socket.dev",
5
5
  "homepage": "http://github.com/SocketDev/socket-cli-js",
6
6
  "repository": {
@@ -45,6 +45,7 @@
45
45
  "@types/mocha": "^10.0.0",
46
46
  "@types/node": "^14.18.31",
47
47
  "@types/prompts": "^2.4.1",
48
+ "@types/update-notifier": "^6.0.1",
48
49
  "@typescript-eslint/eslint-plugin": "^5.44.0",
49
50
  "@typescript-eslint/parser": "^5.44.0",
50
51
  "c8": "^7.12.0",
@@ -77,6 +78,7 @@
77
78
  "ora": "^6.1.2",
78
79
  "pony-cause": "^2.1.8",
79
80
  "prompts": "^2.4.2",
80
- "terminal-link": "^3.0.0"
81
+ "terminal-link": "^3.0.0",
82
+ "update-notifier": "^6.0.2"
81
83
  }
82
84
  }