Skip to content

Commit ed3d53f

Browse files
committed
support for in-process hooks
1 parent 2385db5 commit ed3d53f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ exports.postinstall = function postinstall(pkgdir) {
3737
}
3838
var hookFileName = generateHookName(pkg, hook);
3939
var hookPath = path.join(hookDir, hookFileName);
40-
fs.writeFileSync(hookPath, util.format('require("%s/%s");' + os.EOL, pkg.name, hook.script));
40+
41+
var trampoline = util.format('%srequire("%s/%s");', hook.inject ? 'module.exports = ' : '', pkg.name, hook.script);
42+
43+
fs.writeFileSync(hookPath, trampoline + os.EOL);
4144
hookFiles.push(path.relative(pkgdir, hookPath));
4245
});
4346

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-hook",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Helper module for installing hooks into NativeScript projects",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)