-
Notifications
You must be signed in to change notification settings - Fork 60
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
Improve tsc watch/client signal + stderr support #136
Comments
Hi @gilamran ps: thanks for your lib :) |
Looks very good! |
BTW, I want to upgrade to node 12.12.x and use ESM modules (which is actually required already) in this major upgrade |
@gilamran Sure! |
@pp0rtal I've converted the project to Typescript, you can see it here: https://github.com/gilamran/tsc-watch/tree/v5 Thanks |
@gilamran Cool you initiated the project 👍 (minor note) You can put More importantly, I didn't succeed to make type works :/ Probably this file https://github.com/gilamran/tsc-watch/blob/v5/index.js should expose the client directly and not anything else, to match your statement in package.json // index.js
module.exports.TscWatchClient = require('./dist/client').TscWatchClient;
// -- other file
// Example of working usage
import { TscWatchClient } from "tsc-watch"; But I'm afraid this won't fit a direct What about emitting the types alongside the JS files? // package.json
"exports": "./dist/tsc-watch.js",
"main": "dist/index.js",
"types": "dist/index.d.ts", You lib/index.ts #!/usr/bin/env node
export {TscWatchClient} from "./client";
// not sure tsc-watch can be imported? It's just an exposed .bin?
// import * as tscAlias from "./tsc-watch";
// export default tscAlias; |
Thanks, I'll check it out. |
I did some big changed to the structure. please review. I want to publish an alpha version so we can test it properly |
@gilamran Great! I'll do a full try by next week! 😉 Have a good WE |
@gilamran I gave a try to the latest Client is not compiled( tsc-watch/tsconfig-client.json Line 16 in 41f58c6
should match all Ts files in the folder src/client/**/*.ts will fix
The client can't require tsc-watch libConcretely it is searching inside my project, and not ths tsc-client package, see:
That's because the client can be launched with a different process folder tsc-watch/src/client/client.ts Line 9 in 41f58c6
I advise to search tsc-watch relatively to the client: const tscWatch = require.resolve(join(__dirname, '..', 'lib', 'tsc-watch')); Except this, types for the client works perfectly well 💯 |
@pp0rtal regarding 1 I don't understand why you think that client.js is not emitted... as long as the |
@gilamran The problem is that |
@gilamran Hello, I don't know if my last message made sense, As soon you merge the Ts refactor, I can open a PR about this issue. |
@pp0rtal That's very strange. when telling typescript to emit a file that |
@gilamran Ok I found why (I don't know the real explaination to this) See: mkdir node_modules ; cd node_modules # same bug when in any sub dir of node_modules
git clone git@github.com:gilamran/tsc-watch.git ; cd tsc-watch ; git checkout v5 ; npm install
npm run build ; ls dist/client/
index.d.ts index.js Why Typescript doesn't work correctly when inside a directly In any case you can let your config, as long you build the |
Yea, probably a typescript thing. treating Anyways, I've started converting the tests to typescript as well, so we wont have to require from |
ok, did another big change:
|
Hi!
I'm running a big app, requiring a lot of mem in watch mem (2-3GB+). I've been strugling to spot a fatal error which happens on some envs with low node compiled with a low mem profile, because this lib is hiding everything at process level.
tsc-watch and tsc-client are hiding the error for those reasons:
stderr
of the tsc program (minor)0
exit
event, so we can't use some exit event using JsCurrent schema:
At ❌ we are annoyed because stderr can't be retrieved and we don't know if it was something bad.
I'm suggesting behavior to be able to pass-on signals / process code in an event.
I'm running client inside a gulp process to illustrate how we can know issues inside the software too and not only at process level.
RFC
tsc-watch.js
bahaviorIssue: behavior when tsc crashes
Here is what happen is node run out of memory:
Expectation when tsc crashes
Here is what happen is node run out of memory:
RFC:
client.js
behaviorFor the record, I'm using the client inside Gulp
It's Gulp duty to restart processed, but it has to be ware using a callback (with an error or no)
Issue: behavior when tsc-watch crashes
I have no way to say my worker has to be restared,
I can watch the process but it's hazardous.
Expected client event
tsc client is not supposed to close, and if it does I'd prefer be ISO with the
tsc
state (code, signal)I suggest to add a
.on('exit', (code: number, signal: string) => void)
support which is the same prototype as a process support:Example if we spot a
SIGABRT
, we can traceIf we manually
kill tsc
for instance, thencode === 0
and we don't trace.Impact
Breaking change: could break someone workflow!
Why? Maybe someone is used to not crash, or rely on the process to exit with 0 whatever the reason.
Thus, I suggest to release this in a version
v5.x
ℹ️ Note I will do the PR
The text was updated successfully, but these errors were encountered: