-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Node: Remove compiled JavaScript from repository and compile TypeScript code on NPM prepare
script on demand when installed via git
#954
Conversation
- Let's remove JavaScript compiled code from the repository. - So move `typescript` dependency from `devDependencies` to `dependencies`.
Node CI on Windows fails because https://github.com/versatica/mediasoup/actions/runs/3444484978/jobs/5747136816 Unfortunately |
I'll apply the same to flatbuffers branch in order to avoid the many JS autogenerated files in the repo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately rmdir doesn't provide with any flag to not fail if the folder doesn't exist. Any suggestion?
Just ignore the error entirely, you don't have to fail.
Hm... you were so strongly against this before.
What is the motivation this time?
The way it is implemented seems pretty bad IMO because it forces everyone to have typescript
in their production node_modules
, which will lead to HUGE number of extra dependencies.
Also if you want to compile it at installation, you'll have to remove node/lib
from files
in package.json
.
I'd vote against this approach, it needs to compile before publishing, you can even make CI do the publishing when you push a tag.
Definitely the fact that having JS code in the repo is hell when it comes to review PRs.
And what is the problem? typescript package is 68.8 MB (unpacked size), 3.2 MB (minified), 828.3 kB (minified + gziped), and it has 0 dependencies: We are already fetching larger dependencies (
No need for it.
|
I think it's cleaner to only have the source files in the repo. Having the user download and compile the TS (the same way we do with C++ worker) looks good to me. We could, in the future, do this as part of the CI, if we find it worth it, but we are OK with no generating worker binaries too, so I'm not sure this would be required. |
I'm genuinely surprised by 0 dependencies, but 68.8M bigger
And clean it up after compilation, such that a single final executable is left in
I don't see how those are connected, you're publishing from local machine anyway. IMHO this needs to happen instead:
The only case when this is annoying is when people use What this PR does is functional, but it is an anti-pattern to include build dependencies in production dependencies. |
Well, pros and cons. We can delete
Well, I insist we already rely on ## Meson.
/worker/subprojects/*
!/worker/subprojects/*.wrap
## Node.
/node_modules/
## Rust.
/Cargo.lock
/rust/examples-frontend/*/node_modules
/rust/examples-frontend/*/package-lock.json
## Worker.
/worker/out/
/worker/scripts/node_modules/
# Vistual Studio generated Stuff.
/worker/**/Debug/
/worker/**/Release/
/worker/.vs/
# clang-fuzzer stuff is too big.
/worker/deps/clang-fuzzer
# Ignore all fuzzer generated test inputs.
/worker/fuzzer/new-corpus/*
!/worker/fuzzer/new-corpus/.placeholder
## Others.
/coverage/
/NO_GIT/
*.swp
*.swo
.DS_Store
# Vistual Studio Code stuff.
/.vscode/
# JetBrains IDE stuff.
/.idea/ and we don't need to explicitly say in
People (sometimes us) need to test a mediasoup branch within their application.. Unfortunately this is a very common use case and we cannot break it. |
I understand that it is not, there are two reasons:
I have seen way too many packages that package random unnecessary files to NPM. My point being it makes no sense to include path in
Fair, yet I still believe that must be the default workflow. If you want so much to compile things during installation instead of downloading precompiled stuff, what about moving TypeScript into separate location similarly to |
It would be nice to be able to ignore The problem is then that such directory cannot be added to the npm package via |
…s to dependencies
@nazar-pc I've removed
So why is it? Yes, |
So this PR allows mediasoup installation via GH instead of using a NPM package:
This works fine. |
Do not run `npm run typescript:build` after `npm install` since `npm install` implicitly calls the former and removes some dev deps
postinstall
on demandprepare
script on demand when installed via git
Guys this is done and I'm super proud of the result. Nice and inspiring talk yesterday with @jmillan. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like actually idiomatic Node.js approach that combines all the features we want without the drawbacks previous attempt had.
Very nice, thanks for finally doing it 🎉
- Remove slash in last forlders. - Improve `npm run release` script: - Make it update Node deps and `package-lock.json`. - Update `doc/Building.md`.
Waiting for final CI before merging. Only thing that I don't love is that worker built stuff and subprojects are cleaned on NPM $ MEDIASOUP_LOCAL_DEV=true npm install foo Another solution is: $ npm install --ignore-scripts foo |
I have added conditional code for that in Rust version too: Lines 130 to 143 in 47147af
|
Also in mediasoup-client: versatica/mediasoup-client#223 |
…pt code on NPM `prepare` script on demand when installed via git (versatica#954)
node/lib/
(this is, compiled JavaScript code) from the repository.prepare
NPM script.node/lib/
(as before this PR).devDependencies
are always installed (read NPM prepare docs) and TypeScript code is compiled to JS inprepare
script.BONUS TRACKS:
package-lock.json
so we ensure that mediasoup deps' versions are under our control.