Skip to content

Commit

Permalink
add proccess on file change hook
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-ge committed Mar 4, 2021
1 parent 4de3d90 commit b7d5322
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-node-dev",
"version": "1.1.6",
"name": "ts-node-dev-with-hook",
"version": "1.1.7",
"description": "Compiles your TS app and restarts when files are modified.",
"keywords": [
"restart",
Expand Down Expand Up @@ -97,4 +97,4 @@
"publishConfig": {
"registry": "https://registry.npmjs.org"
}
}
}
21 changes: 11 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export const runDev = (
// The child_process
let child:
| (ChildProcess & {
stopping?: boolean
respawn?: boolean
})
stopping?: boolean
respawn?: boolean
})
| undefined

const wrapper = resolveMain(__dirname + '/wrap.js')
Expand Down Expand Up @@ -92,12 +92,12 @@ export const runDev = (

log.info(
'ts-node-dev ver. ' +
version +
' (using ts-node ver. ' +
tsNodeVersion +
', typescript ver. ' +
tsVersion +
')'
version +
' (using ts-node ver. ' +
tsNodeVersion +
', typescript ver. ' +
tsVersion +
')'
)

/**
Expand Down Expand Up @@ -250,7 +250,8 @@ export const runDev = (
const result = vm.runInNewContext(code, {
require: require("esm")(module),
module,
console
console,
process
});
if (!result) {
notify('FileChangeHook', 'Hook exit code: 0.')
Expand Down

0 comments on commit b7d5322

Please sign in to comment.