Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: immediate recompilation #256

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ If you have an issue, please create one. But, before:
- try to run it with `--debug` flag and see the output
- try to make create repro example

## Building

Run `tsc --build tsconfig.build.json` to transpile this project.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… just because I had to look and experiment for a while to figure out how to compile this project.


## Versioning

Currently versioning is not stable and it is still treated as pre-release. You might expect some options API changes. If you want to avoid unexpected problems it is recommended to fixate the installed version and update only in case of issues, you may consult [CHANGELOG](CHANGELOG.md) for updates.
Expand Down
5 changes: 3 additions & 2 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@ export const makeCompiler = (
}
},
compile: function (params: CompileParams) {
const fileName = params.compile
const code = fs.readFileSync(fileName, 'utf-8')
const compiledPath = params.compiledPath

// Prevent occasional duplicate compilation requests
Expand All @@ -255,7 +253,10 @@ export const makeCompiler = (
if (fs.existsSync(compiledPath)) {
return
}

const starTime = new Date().getTime()

const fileName = params.compile
const m: any = {
_compile: writeCompiled,
}
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ export const runDev = (
child.stopping = true
child.respawn = true
if (child.connected === undefined || child.connected === true) {
log.debug('Disconnecting from child')
child.disconnect()
if (!willTerminate) {
if (willTerminate) {
log.debug('Disconnecting from child')
child.disconnect()
} else {
killChild()
}
}
Expand Down