generated from salesforcecli/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add JIT plugin install hook (#343)
* feat: add JIT plugin install hook * feat: add JIT plugin install hook * fix: add missing deps * chore: bump deps
- Loading branch information
1 parent
268365f
commit 789c2c7
Showing
5 changed files
with
281 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,226 +1,148 @@ | ||
## [2.2.8](https://github.com/salesforcecli/plugin-trust/compare/2.2.7...2.2.8) (2023-01-15) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **deps:** bump @salesforce/sf-plugins-core from 1.20.0 to 1.22.1 ([6abbc10](https://github.com/salesforcecli/plugin-trust/commit/6abbc106cd56fd54c9a043a15ad1b6ab123c7ea2)) | ||
|
||
|
||
- **deps:** bump @salesforce/sf-plugins-core from 1.20.0 to 1.22.1 ([6abbc10](https://github.com/salesforcecli/plugin-trust/commit/6abbc106cd56fd54c9a043a15ad1b6ab123c7ea2)) | ||
|
||
## [2.2.7](https://github.com/salesforcecli/plugin-trust/compare/2.2.6...2.2.7) (2023-01-15) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **deps:** bump npm from 8.15.1 to 8.19.3 ([1236c6b](https://github.com/salesforcecli/plugin-trust/commit/1236c6bcf4ab73c24c85df4dbd8afeff50a20a19)) | ||
|
||
|
||
- **deps:** bump npm from 8.15.1 to 8.19.3 ([1236c6b](https://github.com/salesforcecli/plugin-trust/commit/1236c6bcf4ab73c24c85df4dbd8afeff50a20a19)) | ||
|
||
## [2.2.6](https://github.com/salesforcecli/plugin-trust/compare/2.2.5...2.2.6) (2023-01-08) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **deps:** bump json5 from 1.0.1 to 1.0.2 ([4480d4e](https://github.com/salesforcecli/plugin-trust/commit/4480d4ed77359b90596456220431ad7fdcc468f3)) | ||
|
||
|
||
- **deps:** bump json5 from 1.0.1 to 1.0.2 ([4480d4e](https://github.com/salesforcecli/plugin-trust/commit/4480d4ed77359b90596456220431ad7fdcc468f3)) | ||
|
||
## [2.2.5](https://github.com/salesforcecli/plugin-trust/compare/2.2.4...2.2.5) (2023-01-07) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **deps:** bump @salesforce/core from 3.32.9 to 3.32.12 ([89d9416](https://github.com/salesforcecli/plugin-trust/commit/89d9416e2e6e78bbc97531dbbbd562c648643ec0)) | ||
|
||
|
||
- **deps:** bump @salesforce/core from 3.32.9 to 3.32.12 ([89d9416](https://github.com/salesforcecli/plugin-trust/commit/89d9416e2e6e78bbc97531dbbbd562c648643ec0)) | ||
|
||
## [2.2.4](https://github.com/salesforcecli/plugin-trust/compare/2.2.3...2.2.4) (2023-01-01) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **deps:** bump got from 11.8.5 to 11.8.6 ([7efb3e6](https://github.com/salesforcecli/plugin-trust/commit/7efb3e653cd56af18d71f2c068ade871dbdba02f)) | ||
|
||
|
||
- **deps:** bump got from 11.8.5 to 11.8.6 ([7efb3e6](https://github.com/salesforcecli/plugin-trust/commit/7efb3e653cd56af18d71f2c068ade871dbdba02f)) | ||
|
||
## [2.2.3](https://github.com/salesforcecli/plugin-trust/compare/2.2.2...2.2.3) (2022-12-18) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **deps:** bump @oclif/core from 1.21.0 to 1.22.0 ([80b9f19](https://github.com/salesforcecli/plugin-trust/commit/80b9f194593001c7ef02a10063332d5e688ef04d)) | ||
|
||
|
||
- **deps:** bump @oclif/core from 1.21.0 to 1.22.0 ([80b9f19](https://github.com/salesforcecli/plugin-trust/commit/80b9f194593001c7ef02a10063332d5e688ef04d)) | ||
|
||
## [2.2.2](https://github.com/salesforcecli/plugin-trust/compare/2.2.1...2.2.2) (2022-12-10) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **deps:** bump @salesforce/core from 3.32.8 to 3.32.9 ([dab04d1](https://github.com/salesforcecli/plugin-trust/commit/dab04d1827ce5bde552899172ab8b39611c6f937)) | ||
|
||
|
||
- **deps:** bump @salesforce/core from 3.32.8 to 3.32.9 ([dab04d1](https://github.com/salesforcecli/plugin-trust/commit/dab04d1827ce5bde552899172ab8b39611c6f937)) | ||
|
||
## [2.2.1](https://github.com/salesforcecli/plugin-trust/compare/2.2.0...2.2.1) (2022-12-08) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **deps:** bump @oclif/core from 1.20.4 to 1.21.0 ([ac64902](https://github.com/salesforcecli/plugin-trust/commit/ac649026352ee3276dcc733dff1ec060251553ce)) | ||
|
||
|
||
- **deps:** bump @oclif/core from 1.20.4 to 1.21.0 ([ac64902](https://github.com/salesforcecli/plugin-trust/commit/ac649026352ee3276dcc733dff1ec060251553ce)) | ||
|
||
# [2.2.0](https://github.com/salesforcecli/plugin-trust/compare/2.1.0...2.2.0) (2022-12-07) | ||
|
||
|
||
### Features | ||
|
||
* use sfCommand and testing improvements ([d801eef](https://github.com/salesforcecli/plugin-trust/commit/d801eef40cc5fa8e49820b52e8ed5d6cca02dadc)) | ||
|
||
|
||
- use sfCommand and testing improvements ([d801eef](https://github.com/salesforcecli/plugin-trust/commit/d801eef40cc5fa8e49820b52e8ed5d6cca02dadc)) | ||
|
||
# [2.1.0](https://github.com/salesforcecli/plugin-trust/compare/2.0.4...2.1.0) (2022-10-06) | ||
|
||
|
||
### Features | ||
|
||
* use sf-plugins-core for prompt ([#324](https://github.com/salesforcecli/plugin-trust/issues/324)) ([32b4a59](https://github.com/salesforcecli/plugin-trust/commit/32b4a5958812e722167abd4ac81f3afec836f38f)) | ||
|
||
|
||
- use sf-plugins-core for prompt ([#324](https://github.com/salesforcecli/plugin-trust/issues/324)) ([32b4a59](https://github.com/salesforcecli/plugin-trust/commit/32b4a5958812e722167abd4ac81f3afec836f38f)) | ||
|
||
## [2.0.4](https://github.com/salesforcecli/plugin-trust/compare/v2.0.3...2.0.4) (2022-09-14) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* replace old cli-ux imports ([#306](https://github.com/salesforcecli/plugin-trust/issues/306)) ([27bec3f](https://github.com/salesforcecli/plugin-trust/commit/27bec3fc8ed74b93a47ab22d4920e11e7fb9a636)) | ||
|
||
|
||
- replace old cli-ux imports ([#306](https://github.com/salesforcecli/plugin-trust/issues/306)) ([27bec3f](https://github.com/salesforcecli/plugin-trust/commit/27bec3fc8ed74b93a47ab22d4920e11e7fb9a636)) | ||
|
||
## [2.0.3](https://github.com/salesforcecli/plugin-trust/compare/v2.0.2...v2.0.3) (2022-08-05) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* replace `request` with `got` for HTTP calls ([#289](https://github.com/salesforcecli/plugin-trust/issues/289)) ([14e75a5](https://github.com/salesforcecli/plugin-trust/commit/14e75a536c7a6fccda6585fb20ba3a2d04be8389)), closes [#290](https://github.com/salesforcecli/plugin-trust/issues/290) | ||
|
||
|
||
- replace `request` with `got` for HTTP calls ([#289](https://github.com/salesforcecli/plugin-trust/issues/289)) ([14e75a5](https://github.com/salesforcecli/plugin-trust/commit/14e75a536c7a6fccda6585fb20ba3a2d04be8389)), closes [#290](https://github.com/salesforcecli/plugin-trust/issues/290) | ||
|
||
## [2.0.2](https://github.com/salesforcecli/plugin-trust/compare/v2.0.1...v2.0.2) (2022-08-03) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* update help messages ([#287](https://github.com/salesforcecli/plugin-trust/issues/287)) ([1a4c3b8](https://github.com/salesforcecli/plugin-trust/commit/1a4c3b896a19e87726425e215be235b1b6929d01)) | ||
|
||
|
||
- update help messages ([#287](https://github.com/salesforcecli/plugin-trust/issues/287)) ([1a4c3b8](https://github.com/salesforcecli/plugin-trust/commit/1a4c3b896a19e87726425e215be235b1b6929d01)) | ||
|
||
## [2.0.1](https://github.com/salesforcecli/plugin-trust/compare/v2.0.0...v2.0.1) (2022-06-08) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* bump npm to v8 to remove vulnerable json-schema ([#270](https://github.com/salesforcecli/plugin-trust/issues/270)) ([af03a4d](https://github.com/salesforcecli/plugin-trust/commit/af03a4d7075cb51f869807259ad3f951e02caac8)) | ||
|
||
|
||
- bump npm to v8 to remove vulnerable json-schema ([#270](https://github.com/salesforcecli/plugin-trust/issues/270)) ([af03a4d](https://github.com/salesforcecli/plugin-trust/commit/af03a4d7075cb51f869807259ad3f951e02caac8)) | ||
|
||
# [2.0.0](https://github.com/salesforcecli/plugin-trust/compare/v1.1.0...v2.0.0) (2022-04-20) | ||
|
||
|
||
|
||
# [1.1.0](https://github.com/salesforcecli/plugin-trust/compare/v1.0.11...v1.1.0) (2021-12-02) | ||
|
||
|
||
### Features | ||
|
||
* bump deps ([6edb393](https://github.com/salesforcecli/plugin-trust/commit/6edb393b14afb094cfaf8b85e1d95b4f0dd79fbc)) | ||
|
||
|
||
- bump deps ([6edb393](https://github.com/salesforcecli/plugin-trust/commit/6edb393b14afb094cfaf8b85e1d95b4f0dd79fbc)) | ||
|
||
## [1.0.11](https://github.com/salesforcecli/plugin-trust/compare/v1.0.10...v1.0.11) (2021-11-03) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* poll `npm pack` until tarball is available ([#185](https://github.com/salesforcecli/plugin-trust/issues/185)) ([001c1ab](https://github.com/salesforcecli/plugin-trust/commit/001c1ab3c79277bf411bc3e4459396e859e5672c)) | ||
|
||
|
||
- poll `npm pack` until tarball is available ([#185](https://github.com/salesforcecli/plugin-trust/issues/185)) ([001c1ab](https://github.com/salesforcecli/plugin-trust/commit/001c1ab3c79277bf411bc3e4459396e859e5672c)) | ||
|
||
## [1.0.10](https://github.com/salesforcecli/plugin-trust/compare/v1.0.9...v1.0.10) (2021-10-12) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* update dependencies ([094ea03](https://github.com/salesforcecli/plugin-trust/commit/094ea03c1f99333b75008376d8be1494e3a794ea)) | ||
|
||
|
||
- update dependencies ([094ea03](https://github.com/salesforcecli/plugin-trust/commit/094ea03c1f99333b75008376d8be1494e3a794ea)) | ||
|
||
## [1.0.9](https://github.com/salesforcecli/plugin-trust/compare/v1.0.8...v1.0.9) (2021-10-12) | ||
|
||
|
||
|
||
## [1.0.8](https://github.com/salesforcecli/plugin-trust/compare/v1.0.7...v1.0.8) (2021-09-24) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* verify fails if node not installed ([#167](https://github.com/salesforcecli/plugin-trust/issues/167)) ([0393b90](https://github.com/salesforcecli/plugin-trust/commit/0393b906a30e8858816625517eda5db69377c178)), closes [#168](https://github.com/salesforcecli/plugin-trust/issues/168) | ||
|
||
|
||
- verify fails if node not installed ([#167](https://github.com/salesforcecli/plugin-trust/issues/167)) ([0393b90](https://github.com/salesforcecli/plugin-trust/commit/0393b906a30e8858816625517eda5db69377c178)), closes [#168](https://github.com/salesforcecli/plugin-trust/issues/168) | ||
|
||
## [1.0.7](https://github.com/salesforcecli/plugin-trust/compare/v1.0.6...v1.0.7) (2021-09-17) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* use tag when getting npm meta ([#165](https://github.com/salesforcecli/plugin-trust/issues/165)) ([e9fe7f2](https://github.com/salesforcecli/plugin-trust/commit/e9fe7f229a716e4685b7cd54ee753c02667bccd8)) | ||
|
||
|
||
- use tag when getting npm meta ([#165](https://github.com/salesforcecli/plugin-trust/issues/165)) ([e9fe7f2](https://github.com/salesforcecli/plugin-trust/commit/e9fe7f229a716e4685b7cd54ee753c02667bccd8)) | ||
|
||
## [1.0.6](https://github.com/salesforcecli/plugin-trust/compare/v1.0.5...v1.0.6) (2021-09-10) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* install plugin-trust as an executable ([#164](https://github.com/salesforcecli/plugin-trust/issues/164)) ([34b293c](https://github.com/salesforcecli/plugin-trust/commit/34b293c1e9276e7653aff41a9fc8e17635ee0a92)) | ||
|
||
|
||
- install plugin-trust as an executable ([#164](https://github.com/salesforcecli/plugin-trust/issues/164)) ([34b293c](https://github.com/salesforcecli/plugin-trust/commit/34b293c1e9276e7653aff41a9fc8e17635ee0a92)) | ||
|
||
## [1.0.5](https://github.com/salesforcecli/plugin-trust/compare/v1.0.4...v1.0.5) (2021-09-07) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* use npm instead of http ([#154](https://github.com/salesforcecli/plugin-trust/issues/154)) ([2bce1f9](https://github.com/salesforcecli/plugin-trust/commit/2bce1f9bd331b75d81f0309bc46962b5c5d19b16)) | ||
|
||
|
||
- use npm instead of http ([#154](https://github.com/salesforcecli/plugin-trust/issues/154)) ([2bce1f9](https://github.com/salesforcecli/plugin-trust/commit/2bce1f9bd331b75d81f0309bc46962b5c5d19b16)) | ||
|
||
## [1.0.4](https://github.com/salesforcecli/plugin-trust/compare/v1.0.3...v1.0.4) (2021-05-10) | ||
|
||
|
||
|
||
## [1.0.3](https://github.com/salesforcecli/plugin-trust/compare/v1.0.2...v1.0.3) (2021-04-09) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* leif .yml merge [skip-validate-pr] ([2e6d278](https://github.com/salesforcecli/plugin-trust/commit/2e6d2785cf04497ea87a871564adc68c5a19f6be)) | ||
* leif .yml merge [skip-validate-pr] ([3703564](https://github.com/salesforcecli/plugin-trust/commit/37035649f051b0d42667be7bdf3f878c631d43a9)) | ||
|
||
|
||
- leif .yml merge [skip-validate-pr] ([2e6d278](https://github.com/salesforcecli/plugin-trust/commit/2e6d2785cf04497ea87a871564adc68c5a19f6be)) | ||
- leif .yml merge [skip-validate-pr] ([3703564](https://github.com/salesforcecli/plugin-trust/commit/37035649f051b0d42667be7bdf3f878c631d43a9)) | ||
|
||
## [1.0.2](https://github.com/salesforcecli/plugin-trust/compare/v1.0.1...v1.0.2) (2021-01-11) | ||
|
||
|
||
|
||
## [1.0.1](https://github.com/salesforcecli/plugin-trust/compare/v1.0.0...v1.0.1) (2020-11-20) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* add command, test, config/readme housekeeping ([218b596](https://github.com/salesforcecli/plugin-trust/commit/218b5965e4db531d478429abf9e85b3ce5e5f749)) | ||
* code review 1 ([836ecbc](https://github.com/salesforcecli/plugin-trust/commit/836ecbcac86b47d4b9a5b18fcb565c57d71d8295)) | ||
* remove plugins description from package ([10d0de6](https://github.com/salesforcecli/plugin-trust/commit/10d0de6882bcb7519ec8fcfa1d3c687c313cf1c8)) | ||
|
||
|
||
|
||
- add command, test, config/readme housekeeping ([218b596](https://github.com/salesforcecli/plugin-trust/commit/218b5965e4db531d478429abf9e85b3ce5e5f749)) | ||
- code review 1 ([836ecbc](https://github.com/salesforcecli/plugin-trust/commit/836ecbcac86b47d4b9a5b18fcb565c57d71d8295)) | ||
- remove plugins description from package ([10d0de6](https://github.com/salesforcecli/plugin-trust/commit/10d0de6882bcb7519ec8fcfa1d3c687c313cf1c8)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (c) 2022, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
import * as os from 'os'; | ||
import { Hook } from '@oclif/core'; | ||
import { SfError } from '@salesforce/core'; | ||
import { TelemetryGlobal } from '@salesforce/plugin-telemetry/lib/telemetryGlobal'; | ||
import { AppInsights } from '@salesforce/telemetry/lib/appInsights'; | ||
|
||
declare const global: TelemetryGlobal; | ||
|
||
const hook: Hook<'jit_plugin_not_installed'> = async function (opts) { | ||
try { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call | ||
global.cliTelemetry?.record({ | ||
eventName: 'JIT_INSTALL_STARTED', | ||
type: 'EVENT', | ||
version: opts.config.version, | ||
plugin: opts.command.pluginName, | ||
command: opts.command.id, | ||
}); | ||
|
||
await opts.config.runCommand('plugins:install', [`${opts.command.pluginName}@${opts.pluginVersion}`]); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call | ||
global.cliTelemetry?.record({ | ||
eventName: 'JIT_INSTALL_SUCCESS', | ||
type: 'EVENT', | ||
version: opts.config.version, | ||
plugin: opts.command.pluginName, | ||
command: opts.command.id, | ||
}); | ||
} catch (error) { | ||
const err = error as Error; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call | ||
global.cliTelemetry?.record({ | ||
eventName: 'JIT_INSTALL_FAILED', | ||
type: 'EVENT', | ||
message: err.message, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access | ||
stackTrace: err?.stack?.replace(new RegExp(os.homedir(), 'g'), AppInsights.GDPR_HIDDEN), | ||
version: opts.config.version, | ||
plugin: opts.command.pluginName, | ||
command: opts.command.id, | ||
}); | ||
|
||
throw new SfError(`Could not install ${opts.command.pluginName}`, 'JitPluginInstallError'); | ||
} | ||
}; | ||
|
||
export default hook; |
Oops, something went wrong.