diff --git a/README.md b/README.md index 3e49d80..64ff8d4 100644 --- a/README.md +++ b/README.md @@ -104,3 +104,20 @@ And finally, when installing in-process hooks through this module, you need to e }, } ``` + +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: +```json +{ + "nativescript": { + "hooks": [ + { + "type": "after-prepare", + "script": "lib/after-prepare.js", + "name": "my-custom-hook" + } + ] + }, +} +``` + + diff --git a/index.js b/index.js index 8ad9aa7..e46082d 100644 --- a/index.js +++ b/index.js @@ -20,7 +20,7 @@ var mkdirp = require('mkdirp'); var glob = require('glob'); function generateHookName(pkg, hook) { - return pkg.name + '.js'; + return (hook.name || pkg.name) + '.js'; } function findProjectDir(pkgdir) {