Skip to content

Commit cbda936

Browse files
committed
feat: add refresh-cache hook
1 parent 986c6ec commit cbda936

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@
5757
"devPlugins": [
5858
"@oclif/plugin-help"
5959
],
60-
"flexibleTaxonomy": true
60+
"flexibleTaxonomy": true,
61+
"hooks": {
62+
"plugins:postinstall": "./lib/hooks/refresh-cache.js",
63+
"plugins:postuninstall": "./lib/hooks/refresh-cache.js"
64+
}
6165
},
6266
"repository": "oclif/plugin-autocomplete",
6367
"scripts": {

src/hooks/refresh-cache.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import {Hook} from '@oclif/core'
2+
3+
const hook: Hook<'refresh'> = async function (opts) {
4+
// this `config` instance already have installed/uninstalled plugins loaded
5+
await opts.config.runCommand('autocomplete:create')
6+
}
7+
8+
export default hook

0 commit comments

Comments
 (0)