Skip to content

Commit

Permalink
Merge pull request #753 from oclif/cd/hooks
Browse files Browse the repository at this point in the history
feat: add `refresh-cache` hook
  • Loading branch information
mdonnalley committed Aug 1, 2024
2 parents 986c6ec + cbda936 commit 3b928cd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@
"devPlugins": [
"@oclif/plugin-help"
],
"flexibleTaxonomy": true
"flexibleTaxonomy": true,
"hooks": {
"plugins:postinstall": "./lib/hooks/refresh-cache.js",
"plugins:postuninstall": "./lib/hooks/refresh-cache.js"
}
},
"repository": "oclif/plugin-autocomplete",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions src/hooks/refresh-cache.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Hook} from '@oclif/core'

const hook: Hook<'refresh'> = async function (opts) {
// this `config` instance already have installed/uninstalled plugins loaded
await opts.config.runCommand('autocomplete:create')
}

export default hook

0 comments on commit 3b928cd

Please sign in to comment.