Skip to content

Commit

Permalink
feat: add refresh-cache hook
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiand391 committed Jul 30, 2024
1 parent 986c6ec commit cbda936
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 cbda936

Please sign in to comment.