sfdx-plugin-update-notifier 1.1.0 → 1.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/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ ## [1.2.1](https://github.com/jayree/sfdx-plugin-update-notifier/compare/v1.2.0...v1.2.1) (2022-09-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add missing changelog hook ([11e9fe6](https://github.com/jayree/sfdx-plugin-update-notifier/commit/11e9fe6955ff44f3607df475e6bd367d6eef90c7))
7
+
8
+ # [1.2.0](https://github.com/jayree/sfdx-plugin-update-notifier/compare/v1.1.0...v1.2.0) (2022-09-20)
9
+
10
+
11
+ ### Features
12
+
13
+ * move to ESM ([5a225bd](https://github.com/jayree/sfdx-plugin-update-notifier/commit/5a225bd0fafe13799830b85ddbfefb335192edee))
14
+
15
+ # [1.1.0](https://github.com/jayree/sfdx-plugin-update-notifier/compare/v1.0.2...v1.1.0) (2021-09-03)
16
+
17
+
18
+ ### Features
19
+
20
+ * override platform wsl with linux during update command ([c8f24e7](https://github.com/jayree/sfdx-plugin-update-notifier/commit/c8f24e74fe8e3630eef8a62c0428f21b3226b894))
21
+
22
+ ## [1.0.2](https://github.com/jayree/sfdx-plugin-update-notifier/compare/v1.0.1...v1.0.2) (2021-06-24)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * update dependencies ([9d97421](https://github.com/jayree/sfdx-plugin-update-notifier/commit/9d97421fb612e24441a719ff5fc355739f812811))
28
+
29
+ ## [1.0.1](https://github.com/jayree/sfdx-plugin-update-notifier/compare/v1.0.0...v1.0.1) (2021-04-23)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * plugin uninstall ([1451727](https://github.com/jayree/sfdx-plugin-update-notifier/commit/1451727ba9a5dffc9d7caeee0fd1ad844f3876c4))
35
+
36
+ # 1.0.0 (2021-04-23)
37
+
38
+
39
+ ### Features
40
+
41
+ * Initial commit ([4829fe9](https://github.com/jayree/sfdx-plugin-update-notifier/commit/4829fe93ae3ed67a35b4edc714031b1da254228f))
package/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2021, jayree
1
+ Copyright (c) 2022, jayree
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -9,4 +9,4 @@ Redistribution and use in source and binary forms, with or without modification,
9
9
 
10
10
  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
11
 
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -7,9 +7,10 @@
7
7
  [![Downloads/week](https://img.shields.io/npm/dw/sfdx-plugin-update-notifier.svg)](https://npmjs.org/package/sfdx-plugin-update-notifier)
8
8
  [![License](https://img.shields.io/npm/l/sfdx-plugin-update-notifier.svg)](https://github.com/jayree/sfdx-plugin-update-notifier/blob/main/package.json)
9
9
 
10
+ Update notifications for sfdx plugins based on [jayree/oclif-plugin-update-notifier](https://github.com/jayree/oclif-plugin-update-notifier) and [yeoman/update-notifier](https://github.com/yeoman/update-notifier)
11
+
10
12
  <!-- toc -->
11
13
  * [Usage](#usage)
12
- * [Commands](#commands)
13
14
  <!-- tocstop -->
14
15
 
15
16
  ## Usage
@@ -17,48 +18,27 @@
17
18
  <!-- usage -->
18
19
  ```sh-session
19
20
  $ sfdx plugins:install sfdx-plugin-update-notifier
20
- $ sfdx plugins:COMMAND
21
+ $ sfdx plugins:[COMMAND]
21
22
  running command...
22
23
  $ sfdx plugins
23
- sfdx-plugin-update-notifier 1.1.0
24
- $ sfdx help plugins:COMMAND
24
+ sfdx-plugin-update-notifier 1.2.1
25
+ $ sfdx help plugins:[COMMAND]
25
26
  USAGE
26
27
  $ sfdx plugins:COMMAND
27
28
  ...
28
29
  ```
29
30
  <!-- usagestop -->
30
- ## Commands
31
-
32
- <!-- commands -->
33
- * [`sfdx plugins:update:check`](#sfdx-pluginsupdatecheck)
34
-
35
- ### `sfdx plugins:update:check`
36
-
37
- check installed plugins for updates
38
-
39
- ```
40
- USAGE
41
- $ sfdx plugins:update:check [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
42
31
 
43
- OPTIONS
44
- --json format output as json
45
-
46
- --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
47
- this command invocation
48
-
49
- EXAMPLE
50
- $ sfdx plugins:update:check
51
- check for updates... done
52
-
53
- ╭────────────────────────────────────────────────────────────────────────────────────────────╮
54
- │ │
55
- │ sfdx-plugin updates available! │
56
- │ │
57
- │ salesforce-alm (core) 51.6.11 → 51.6.12 (latest) │
58
- │ Changelog: https://github.com/forcedotcom/cli/blob/main/releasenotes/README.md │
59
- │ │
60
- ╰────────────────────────────────────────────────────────────────────────────────────────────╯
32
+ ```sh-session
33
+ $ sfdx plugins
34
+ auth 2.2.5 (core)
35
+
36
+ ╭────────────────────────────────────────────────────────────────────────────╮
37
+ │ │
38
+ │ sfdx-plugin updates available! │
39
+ │ │
40
+ │ @salesforce/plugin-auth (core) 2.2.5 → 2.2.8 (latest) │
41
+ │ https://github.com/salesforcecli/plugin-auth/blob/main/CHANGELOG.md │
42
+ │ │
43
+ ╰────────────────────────────────────────────────────────────────────────────╯
61
44
  ```
62
-
63
- _See code: [commands/plugins/update/check.ts](https://github.com/jayree/sfdx-plugin-update-notifier/blob/v1.1.0/commands/plugins/update/check.ts)_
64
- <!-- commandsstop -->
@@ -0,0 +1,2 @@
1
+ import { Hook } from '@oclif/core';
2
+ export declare const changelog: Hook<'changelog'>;
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Copyright (c) 2022, jayree
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ /* istanbul ignore file */
8
+ import { join } from 'node:path';
9
+ import fs from 'fs-extra';
10
+ import Debug from 'debug';
11
+ import TerminalRenderer from 'marked-terminal';
12
+ import { marked } from 'marked';
13
+ import semver from 'semver';
14
+ // original from https://github.com/salesforcecli/plugin-info/blob/main/src/shared/parseReleaseNotes.ts
15
+ const parseReleaseNotes = (notes, version) => {
16
+ let found = false;
17
+ let closestVersion;
18
+ let versions;
19
+ const parsed = marked.lexer(notes);
20
+ let tokens;
21
+ const findVersion = (desiredVersion) => {
22
+ versions = [];
23
+ tokens = parsed.filter((token) => {
24
+ // TODO: Could make header depth (2) a setting in oclif.info.releasenotes
25
+ if (token.type === 'heading' && token.depth <= 2) {
26
+ const coercedVersion = semver.coerce(token.text).version;
27
+ // We will use this to find the closest patch if passed version is not found
28
+ versions.push(coercedVersion);
29
+ if (coercedVersion === desiredVersion) {
30
+ found = true;
31
+ return token;
32
+ }
33
+ found = false;
34
+ }
35
+ else if (found === true) {
36
+ return token;
37
+ }
38
+ });
39
+ };
40
+ findVersion(version);
41
+ if (!tokens.length) {
42
+ // If version was not found, try again with the closest patch version
43
+ const semverRange = `${semver.major(version)}.${semver.minor(version)}.x`;
44
+ closestVersion = semver.maxSatisfying(versions, semverRange);
45
+ findVersion(closestVersion);
46
+ }
47
+ if (closestVersion !== undefined) {
48
+ const warning = marked.lexer(`# ATTENTION: Version ${version} was not found. Showing notes for closest patch version ${closestVersion}.`)[0];
49
+ tokens.unshift(warning);
50
+ }
51
+ return tokens;
52
+ };
53
+ // eslint-disable-next-line @typescript-eslint/require-await
54
+ export const changelog = async function () {
55
+ const debug = Debug(`${this.config.bin}:sfdx-plugin-update-notifier:hooks:changelog`);
56
+ process.once('exit', () => {
57
+ try {
58
+ const pluginRootPath = join(new URL('./', import.meta.url).pathname, '..', '..');
59
+ const { name, version } = fs.readJsonSync(join(pluginRootPath, 'package.json'));
60
+ const changelogFile = fs.readFileSync(join(pluginRootPath, 'CHANGELOG.md'), 'utf8');
61
+ const cacheDir = join(this.config.cacheDir, name);
62
+ const versionFile = join(cacheDir, 'version');
63
+ fs.ensureFileSync(versionFile);
64
+ let latestVersion;
65
+ try {
66
+ latestVersion = fs.readJSONSync(versionFile);
67
+ }
68
+ catch (error) {
69
+ latestVersion = { version: '0.0.0' };
70
+ }
71
+ debug({ latestVersion: latestVersion.version, version });
72
+ if (latestVersion.version !== version) {
73
+ const tokens = parseReleaseNotes(changelogFile, version);
74
+ if (!tokens.length) {
75
+ debug(`${name} - didn't find version '${version}'.`);
76
+ }
77
+ else {
78
+ marked.setOptions({
79
+ renderer: new TerminalRenderer({ emoji: false }),
80
+ });
81
+ tokens.unshift(marked.lexer(`# Changelog for '${name}':`)[0]);
82
+ this.log(marked.parser(tokens));
83
+ fs.writeJsonSync(versionFile, { version });
84
+ }
85
+ }
86
+ else {
87
+ debug(`${name} - no update`);
88
+ }
89
+ }
90
+ catch (error) {
91
+ debug(error);
92
+ }
93
+ });
94
+ };
95
+ //# sourceMappingURL=changelog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../src/hooks/changelog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,0BAA0B;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,uGAAuG;AACvG,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,OAAe,EAAkB,EAAE;IAC3E,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,cAAsB,CAAC;IAC3B,IAAI,QAAkB,CAAC;IAEvB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEnC,IAAI,MAAsB,CAA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M,EAAE;oBAClB,KAAK,CAAC,GAAG,IAAI,2BAA2B,OAAO,IAAI,CAAC,CAAC;iBACtD;qBAAM;oBACL,MAAM,CAAC,UAAU,CAAC;wBAChB,QAAQ,EAAE,IAAI,gBAAgB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;qBACjD,CAAC,CAAC;oBACH,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC9D,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;oBAChC,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;iBAC5C;aACF;iBAAM;gBACL,KAAK,CAAC,GAAG,IAAI,cAAc,CAAC,CAAC;aAC9B;SACF;QAAC,OAAO,KAAK,EAAE;YACd,KAAK,CAAC,KAAK,CAAC,CAAC;SACd;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Hook } from '@oclif/core';
2
+ export declare const init: Hook<'init'>;
@@ -0,0 +1,12 @@
1
+ import { env } from '@salesforce/kit';
2
+ import Debug from 'debug';
3
+ // eslint-disable-next-line @typescript-eslint/require-await
4
+ export const init = async function (options) {
5
+ const debug = Debug(`${this.config.bin}:sfdx-plugin-update-notifier:hooks:init`);
6
+ debug({ CommandID: options.id });
7
+ if (!['plugins:install', 'plugins:uninstall'].includes(options.id)) {
8
+ env.setBoolean('OCLIF_DISABLE_UPDATENOTIFIER', true);
9
+ debug('set: OCLIF_DISABLE_UPDATENOTIFIER=true');
10
+ }
11
+ };
12
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/hooks/init.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,4DAA4D;AAC5D,MAAM,CAAC,MAAM,IAAI,GAAiB,KAAK,WAAW,OAAO;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,yCAAyC,CAAC,CAAC;IACjF,KAAK,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAClE,GAAG,CAAC,UAAU,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;QACrD,KAAK,CAAC,wCAAwC,CAAC,CAAC;KACjD;AACH,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- import { Hook } from '@oclif/config';
1
+ import { Hook } from '@oclif/core';
2
2
  export declare const prerun: Hook<'prerun'>;
@@ -1,41 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prerun = void 0;
4
- const kit_1 = require("@salesforce/kit");
5
- const Debug = require("debug");
6
- const debug = Debug('pluginUpdateNotifier:preRun');
7
- const isContentTypeJSON = kit_1.env.getString('SFDX_CONTENT_TYPE', '').toUpperCase() === 'JSON';
1
+ import { env } from '@salesforce/kit';
2
+ import Debug from 'debug';
3
+ const isContentTypeJSON = env.getString('SFDX_CONTENT_TYPE', '').toUpperCase() === 'JSON';
8
4
  const isOutputEnabled = !(process.argv.find((arg) => ['--json', '--help', '-h'].includes(arg)) || isContentTypeJSON);
9
- const prerun = async function (options) {
10
- if (!['plugins:install', 'plugins:uninstall'].includes(options.Command.id)) {
11
- kit_1.env.setBoolean('OCLIF_DISABLE_UPDATENOTIFIER', true);
12
- debug('set: OCLIF_DISABLE_UPDATENOTIFIER=true');
13
- if (isOutputEnabled) {
14
- if (['plugins:update', 'plugins:update:check', 'update'].includes(options.Command.id)) {
15
- await this.config.runHook('updateNotifier', {
16
- updateCheckInterval: 0,
17
- spawnOptions: { detached: false, stdio: 'ignore' },
18
- defer: false,
19
- changeLogUrl: {
20
- 'sfdx-cli': 'https://github.com/forcedotcom/cli/blob/main/releasenotes/README.md',
21
- 'salesforce-alm': 'https://github.com/forcedotcom/cli/blob/main/releasenotes/README.md',
22
- '@salesforce/plugin-generator': 'https://github.com/forcedotcom/sfdx-plugin-generate/blob/main/CHANGELOG.md',
23
- },
24
- });
25
- return;
26
- }
27
- await this.config.runHook('updateNotifier', {
28
- updateCheckInterval: 1000 * 60 * 60 * 24,
29
- spawnOptions: { detached: true, stdio: 'ignore' },
30
- defer: true,
31
- changeLogUrl: {
32
- 'sfdx-cli': 'https://github.com/forcedotcom/cli/blob/main/releasenotes/README.md',
33
- 'salesforce-alm': 'https://github.com/forcedotcom/cli/blob/main/releasenotes/README.md',
34
- '@salesforce/plugin-generator': 'https://github.com/forcedotcom/sfdx-plugin-generate/blob/main/CHANGELOG.md',
35
- },
36
- });
37
- }
5
+ export const prerun = async function (options) {
6
+ const debug = Debug(`${this.config.bin}:sfdx-plugin-update-notifier:hooks:prerun`);
7
+ debug({ CommandID: options.Command.id });
8
+ if (env.getBoolean('SFDX_DISABLE_UPDATENOTIFIER')) {
9
+ debug('found: SFDX_DISABLE_UPDATENOTIFIER=true');
10
+ return;
11
+ }
12
+ if (!isOutputEnabled)
13
+ return;
14
+ if (['plugins:install', 'plugins:uninstall'].includes(options.Command.id)) {
15
+ return;
16
+ }
17
+ if (['plugins:update', 'plugins:update:check', 'update'].includes(options.Command.id)) {
18
+ await this.config.runHook('updatenotifier', {
19
+ updateCheckInterval: 0,
20
+ spawnOptions: { detached: false, stdio: 'ignore' },
21
+ defer: false,
22
+ changeLogUrl: {
23
+ 'salesforce-alm': 'https://github.com/forcedotcom/cli/blob/main/releasenotes/README.md',
24
+ },
25
+ ignoreDistTags: ['sf'],
26
+ });
27
+ }
28
+ else {
29
+ await this.config.runHook('updatenotifier', {
30
+ spawnOptions: { detached: true, stdio: 'ignore' },
31
+ defer: true,
32
+ changeLogUrl: {
33
+ 'salesforce-alm': 'https://github.com/forcedotcom/cli/blob/main/releasenotes/README.md',
34
+ },
35
+ ignoreDistTags: ['sf'],
36
+ });
38
37
  }
39
38
  };
40
- exports.prerun = prerun;
41
39
  //# sourceMappingURL=prerun.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prerun.js","sourceRoot":"","sources":["../../src/hooks/prerun.ts"],"names":[],"mappings":";;;AAOA,yCAAsC;AACtC,+BAA+B;AAE/B,MAAM,KAAK,GAAG,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAEnD,MAAM,iBAAiB,GAAG,SAAG,CAAC,SAAS,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC;AAC1F,MAAM,eAAe,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,iBAAiB,CAAC,CAAC;AAE9G,MAAM,MAAM,GAAmB,KAAK,WAAW,OAAO;IAC3D,IAAI,CAAC,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QAC1E,SAAG,CAAC,UAAU,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;QACrD,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAChD,IAAI,eAAe,EAAE;YACnB,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;gBACrF,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE;oBAC1C,mBAAmB,EAAE,CAAC;oBACtB,YAA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
  * Copyright (c) 2021, jayree
5
3
  * All rights reserved.
6
4
  * Licensed under the BSD 3-Clause license.
7
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8
6
  */
9
- exports.default = {};
7
+ export default {};
10
8
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,kBAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAe,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":"1.1.0","commands":{"plugins:update:check":{"id":"plugins:update:check","description":"check installed plugins for updates","usage":"<%= command.id %> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]","pluginName":"sfdx-plugin-update-notifier","pluginType":"core","aliases":[],"examples":["$ sfdx plugins:update:check\ncheck for updates... done\n\n ╭────────────────────────────────────────────────────────────────────────────────────────────╮\n │ │\n │ sfdx-plugin updates available! │\n │ │\n │ salesforce-alm (core) 51.6.11 → 51.6.12 (latest) │\n │ Changelog: https://github.com/forcedotcom/cli/blob/main/releasenotes/README.md │\n │ │\n ╰────────────────────────────────────────────────────────────────────────────────────────────╯"],"flags":{"json":{"name":"json","type":"boolean","description":"format output as json","allowNo":false},"loglevel":{"name":"loglevel","type":"option","description":"logging level for this command invocation","required":false,"helpValue":"(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)","options":["trace","debug","info","warn","error","fatal","TRACE","DEBUG","INFO","WARN","ERROR","FATAL"],"default":"warn"}},"args":[]}}}
1
+ {"version":"1.2.1","commands":{}}
package/package.json CHANGED
@@ -1,71 +1,75 @@
1
1
  {
2
2
  "name": "sfdx-plugin-update-notifier",
3
3
  "description": "update-notifier for sfdx plugins",
4
- "version": "1.1.0",
4
+ "version": "1.2.1",
5
5
  "author": "jayree",
6
+ "type": "module",
6
7
  "bugs": "https://github.com/jayree/sfdx-plugin-update-notifier/issues",
7
8
  "dependencies": {
8
- "@oclif/config": "^1.17.0",
9
- "@oclif/errors": "^1.3.5",
10
- "@salesforce/command": "^4.0.5",
11
- "@salesforce/kit": "^1.5.17",
12
- "boxen": "^5.0.1",
13
- "chalk": "^4.1.2",
14
- "cli-ux": "^5.6.3",
15
- "debug": "^4.3.2",
16
- "is-npm": "^5.0.0",
17
- "oclif-plugin-update-notifier": "^1.4.0",
18
- "semver": "^7.3.5",
19
- "tslib": "^2.3.1",
20
- "update-notifier": "5.1.0"
9
+ "@oclif/core": "^1.16.3",
10
+ "@salesforce/kit": "^1.6.1",
11
+ "debug": "^4.3.4",
12
+ "fs-extra": "^10.1.0",
13
+ "marked": "^4.1.0",
14
+ "marked-terminal": "^5.1.1",
15
+ "oclif-plugin-update-notifier": "^1.5.0",
16
+ "semver": "^7.3.7",
17
+ "tslib": "^2.4.0"
21
18
  },
22
19
  "devDependencies": {
23
- "@commitlint/cli": "^13.1.0",
24
- "@commitlint/config-conventional": "^13.1.0",
25
- "@oclif/dev-cli": "^1.26.0",
26
- "@oclif/plugin-help": "^3.2.3",
27
- "@oclif/test": "^1.2.8",
28
- "@salesforce/dev-config": "^2.1.2",
29
- "@salesforce/dev-scripts": "^0.9.18",
20
+ "@commitlint/cli": "^17.1.2",
21
+ "@commitlint/config-conventional": "^17.1.0",
22
+ "@oclif/plugin-command-snapshot": "^3.1.3",
23
+ "@oclif/plugin-help": "^5.1.12",
24
+ "@oclif/test": "^2.1.1",
25
+ "@salesforce/dev-config": "^3.1.0",
26
+ "@salesforce/dev-scripts": "^3.1.0",
30
27
  "@salesforce/prettier-config": "^0.0.2",
31
- "@types/chai": "^4.2.21",
32
- "@types/jsforce": "^1.9.35",
33
- "@types/mocha": "^9.0.0",
34
- "@types/node": "^16.7.10",
35
- "@types/sinon": "^10.0.2",
36
- "@typescript-eslint/eslint-plugin": "^4.30.0",
37
- "@typescript-eslint/parser": "^4.30.0",
38
- "chai": "^4.3.4",
39
- "eslint": "^7.32.0",
40
- "eslint-config-prettier": "^8.3.0",
41
- "eslint-config-salesforce": "^0.1.6",
42
- "eslint-config-salesforce-typescript": "^0.2.7",
28
+ "@types/chai": "^4.3.3",
29
+ "@types/debug": "^4.1.7",
30
+ "@types/fs-extra": "^9.0.13",
31
+ "@types/jsforce": "^1.9.43",
32
+ "@types/marked": "^4.0.7",
33
+ "@types/marked-terminal": "^3.1.3",
34
+ "@types/mocha": "^9.1.1",
35
+ "@types/node": "^18.7.18",
36
+ "@types/semver": "^7.3.12",
37
+ "@types/sinon": "^10.0.13",
38
+ "@typescript-eslint/eslint-plugin": "^5.38.0",
39
+ "@typescript-eslint/parser": "^5.38.0",
40
+ "chai": "^4.3.6",
41
+ "eslint": "^8.23.1",
42
+ "eslint-config-prettier": "^8.5.0",
43
+ "eslint-config-salesforce": "^1.1.0",
44
+ "eslint-config-salesforce-typescript": "^1.1.1",
43
45
  "eslint-plugin-header": "^3.1.1",
44
- "eslint-plugin-import": "^2.24.2",
45
- "eslint-plugin-jsdoc": "^36.0.8",
46
- "eslint-plugin-prettier": "^4.0.0",
47
- "husky": "^7.0.2",
48
- "is-ci": "^3.0.0",
49
- "mocha": "^9.1.1",
46
+ "eslint-plugin-import": "^2.26.0",
47
+ "eslint-plugin-jsdoc": "^39.3.6",
48
+ "eslint-plugin-prettier": "^4.2.1",
49
+ "eslint-plugin-sf-plugin": "^1.1.0",
50
+ "husky": "^8.0.1",
51
+ "is-ci": "^3.0.1",
52
+ "mocha": "^10.0.0",
50
53
  "nyc": "^15.1.0",
54
+ "oclif": "^3.2.2",
51
55
  "patch-package": "^6.4.7",
52
- "pinst": "^2.1.6",
53
- "prettier": "^2.3.2",
54
- "pretty-quick": "^3.1.1",
55
- "sinon": "^11.1.2",
56
- "source-map-support": "^0.5.19",
57
- "ts-node": "^10.2.1",
58
- "typescript": "^4.4.2",
59
- "xunit-file": "^1.0.0"
56
+ "pinst": "^3.0.0",
57
+ "prettier": "^2.7.1",
58
+ "pretty-quick": "^3.1.3",
59
+ "sinon": "^14.0.0",
60
+ "source-map-support": "^0.5.21",
61
+ "ts-node": "^10.9.1",
62
+ "typescript": "^4.8.3",
63
+ "xunit-file": "^2.0.0"
60
64
  },
61
65
  "engines": {
62
- "node": ">=12.0.0"
66
+ "node": ">=14.0.0"
63
67
  },
64
68
  "files": [
65
69
  "/lib",
66
70
  "/messages",
67
- "/npm-shrinkwrap.json",
68
- "/oclif.manifest.json"
71
+ "/oclif.manifest.json",
72
+ "/CHANGELOG.md"
69
73
  ],
70
74
  "homepage": "https://github.com/jayree/sfdx-plugin-update-notifier",
71
75
  "keywords": [
@@ -73,42 +77,49 @@
73
77
  ],
74
78
  "license": "BSD-3-Clause",
75
79
  "oclif": {
76
- "commands": "./lib/commands",
77
80
  "bin": "sfdx",
78
81
  "hooks": {
79
- "prerun": "./lib/hooks/prerun"
80
- },
81
- "topics": {
82
- "plugins": {
83
- "update": {}
84
- }
82
+ "init": "./lib/hooks/init",
83
+ "prerun": "./lib/hooks/prerun",
84
+ "update": "./lib/hooks/changelog"
85
85
  },
86
86
  "plugins": [
87
87
  "oclif-plugin-update-notifier"
88
88
  ],
89
89
  "devPlugins": [
90
- "@oclif/plugin-help"
91
- ]
90
+ "@oclif/plugin-help",
91
+ "@oclif/plugin-command-snapshot"
92
+ ],
93
+ "info": {
94
+ "releasenotes": {
95
+ "distTagUrl": "https://registry.npmjs.org/-/package/sfdx-plugin-update-notifier/dist-tags",
96
+ "releaseNotesPath": "https://github.com/jayree/sfdx-plugin-update-notifier/tree/main",
97
+ "releaseNotesFilename": "CHANGELOG.md"
98
+ }
99
+ }
92
100
  },
93
101
  "repository": "jayree/sfdx-plugin-update-notifier",
94
102
  "scripts": {
95
103
  "build": "sf-build",
96
104
  "clean": "sf-clean",
97
105
  "clean-all": "sf-clean all",
106
+ "clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
98
107
  "compile": "sf-compile",
99
108
  "format": "sf-format",
100
109
  "lint": "sf-lint",
101
110
  "lint-fix": "sf-lint --fix",
102
- "postcompile": "oclif-dev manifest && oclif-dev readme",
111
+ "postcompile": "oclif readme",
103
112
  "_postinstall": "patch-package",
104
- "postpack": "rimraf oclif.manifest.json",
113
+ "postpack": "shx rm -f oclif.manifest.json",
105
114
  "postpublish": "pinst --enable",
115
+ "posttest": "yarn lint && yarn test:deprecation-policy",
106
116
  "prepack": "sf-prepack",
107
117
  "prepare": "is-ci || husky install",
108
118
  "prepublishOnly": "pinst --disable",
109
119
  "pretest": "sf-compile-test",
110
120
  "test": "sf-test",
111
- "version": "oclif-dev manifest && oclif-dev readme"
121
+ "test:deprecation-policy": "./bin/dev.js snapshot:compare",
122
+ "version": "oclif readme"
112
123
  },
113
124
  "release": {
114
125
  "branches": [
@@ -1,6 +0,0 @@
1
- import { SfdxCommand } from '@salesforce/command';
2
- export default class PluginsUpdateCheck extends SfdxCommand {
3
- static description: string;
4
- static examples: string[];
5
- run(): Promise<void>;
6
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*
4
- * Copyright (c) 2021, jayree
5
- * All rights reserved.
6
- * Licensed under the BSD 3-Clause license.
7
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
8
- */
9
- const command_1 = require("@salesforce/command");
10
- class PluginsUpdateCheck extends command_1.SfdxCommand {
11
- async run() {
12
- // i'm just calling the prerun hook
13
- }
14
- }
15
- exports.default = PluginsUpdateCheck;
16
- PluginsUpdateCheck.description = 'check installed plugins for updates';
17
- PluginsUpdateCheck.examples = [
18
- `$ sfdx plugins:update:check
19
- check for updates... done
20
-
21
- ╭────────────────────────────────────────────────────────────────────────────────────────────╮
22
- │ │
23
- │ sfdx-plugin updates available! │
24
- │ │
25
- │ salesforce-alm (core) 51.6.11 → 51.6.12 (latest) │
26
- │ Changelog: https://github.com/forcedotcom/cli/blob/main/releasenotes/README.md │
27
- │ │
28
- ╰────────────────────────────────────────────────────────────────────────────────────────────╯`,
29
- ];
30
- //# sourceMappingURL=check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../src/commands/plugins/update/check.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,iDAAkD;AAElD,MAAqB,kBAAmB,SAAQ,qBAAW;IAelD,KAAK,CAAC,GAAG;QACd,mCAAmC;IACrC,CAAC;;AAjBH,qCAkBC;AAjBe,8BAAW,GAAG,qCAAqC,CAAC;AACpD,2BAAQ,GAAG;IACvB;;;;;;;;;;iGAU6F;CAC9F,CAAC"}