Skip to content

Commit c6e4d39

Browse files
committed
Custom hook name
1 parent d444b4a commit c6e4d39

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,20 @@ And finally, when installing in-process hooks through this module, you need to e
104104
},
105105
}
106106
```
107+
108+
You have the ability to define a custom name to your hook in `package.json`, this attribute is optional and defaults to the plugin package name:
109+
```json
110+
{
111+
"nativescript": {
112+
"hooks": [
113+
{
114+
"type": "after-prepare",
115+
"script": "lib/after-prepare.js",
116+
"name": "my-custom-hook"
117+
}
118+
]
119+
},
120+
}
121+
```
122+
123+

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var mkdirp = require('mkdirp');
2020
var glob = require('glob');
2121

2222
function generateHookName(pkg, hook) {
23-
return pkg.name + '.js';
23+
return (hook.name || pkg.name) + '.js';
2424
}
2525

2626
function findProjectDir(pkgdir) {

0 commit comments

Comments
 (0)