Skip to content

Commit c8a7113

Browse files
authored
Node: Remove compiled JavaScript from repository and compile TypeScript code on NPM prepare script on demand when installed via git (#954)
1 parent 47147af commit c8a7113

File tree

96 files changed

+10353
-8841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+10353
-8841
lines changed

.gitattributes

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Tell GitHub to ignore some folders when detecting the project language.
22
art/* linguist-vendored=true
33
doc/* linguist-vendored=true
4-
node/lib/* linguist-vendored=true
54
node/test/* linguist-vendored=true
65
rust/benches/* linguist-vendored=true
76
rust/examples/* linguist-vendored=true

.github/workflows/mediasoup-node.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,4 @@ jobs:
4141
- run: npm install
4242
- run: npm run lint:node
4343
if: runner.os == 'Linux'
44-
- run: npm run typescript:build
4544
- run: npm run test:node

.gitignore

+15-14
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,35 @@
33
!/worker/subprojects/*.wrap
44

55
## Node.
6-
/node_modules/
6+
/node_modules
7+
/node/lib
78

89
## Rust.
910
/Cargo.lock
10-
/rust/examples-frontend/*/node_modules/
11+
/rust/examples-frontend/*/node_modules
1112
/rust/examples-frontend/*/package-lock.json
12-
/target/
13+
/target
1314

1415
## Worker.
15-
/worker/out/
16-
/worker/scripts/node_modules/
16+
/worker/out
17+
/worker/scripts/node_modules
1718
# Vistual Studio generated Stuff.
18-
/worker/**/Debug/
19-
/worker/**/Release/
20-
/worker/.vs/
19+
/worker/**/Debug
20+
/worker/**/Release
21+
/worker/.vs
2122
# clang-fuzzer stuff is too big.
22-
/worker/deps/clang-fuzzer/
23+
/worker/deps/clang-fuzzer
2324
# Ignore all fuzzer generated test inputs.
2425
/worker/fuzzer/new-corpus/*
2526
!/worker/fuzzer/new-corpus/.placeholder
2627

2728
## Others.
28-
/coverage/
29-
/NO_GIT/
29+
/coverage
30+
/NO_GIT
3031
*.swp
3132
*.swo
32-
.DS_Store/
33+
.DS_Store
3334
# Vistual Studio Code stuff.
34-
/.vscode/
35+
/.vscode
3536
# JetBrains IDE stuff.
36-
/.idea/
37+
/.idea

.npmrc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
package-lock=false
1+
# Generate package-lock.json.
2+
package-lock=true
3+
# For bad node/npm version to throw actual error.
4+
engine-strict=true

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
### NEXT
55

6+
* Node: Remove compiled JavaScript from repository and compile TypeScript code on NPM `prepare` script on demand when installed via git (PR #954).
67
* `Worker`: Add `RTC::Shared` singleton for RTC entities (PR #953).
78

89

doc/Building.md

+49-21
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Compiles mediasoup TypeScript code (`lib` folder) JavaScript and places it into
1717

1818
Compiles mediasoup TypeScript code (`lib` folder) JavaScript, places it into the `lib` directory an watches for changes in the TypeScript files.
1919

20+
21+
### `npm run worker:build`
22+
23+
Builds the `mediasoup-worker` binary. It invokes `make`below.
24+
25+
2026
### `npm run lint`
2127

2228
Runs both `npm run lint:node` and `npm run lint:worker`.
@@ -57,41 +63,30 @@ Runs [Catch2](https://github.com/catchorg/Catch2) test units located at `worker/
5763
Same as `npm run test:node` but it also opens a browser window with JavaScript coverage results.
5864

5965

60-
## Makefile
66+
### `npm run install-deps:node`
6167

62-
The `worker` folder contains a `Makefile` for the mediasoup-worker C++ subproject. It includes the following tasks:
68+
Installs NPM dependencies and updates `package-lock.json`.
6369

6470

65-
### `make` or `make mediasoup-worker`
71+
### `npm run install-clang-tools`
6672

67-
Builds the `mediasoup-worker` binary at `worker/out/Release/`.
73+
Installs clang tools needed for local development.
6874

69-
If the "MEDIASOUP_MAX_CORES" environment variable is set, the build process will use that number of CPU cores. Otherwise it will auto-detect the number of cores in the machine.
7075

71-
"MEDIASOUP_BUILDTYPE" environment variable controls build types, `Release` and `Debug` are presets optimized for those use cases.
72-
Other build types are possible too, but they are not presets and will require "MESON_ARGS" use to customize build configuration.
73-
Check the meaning of useful macros in the `worker/include/Logger.hpp` header file if you want to enable tracing or other debug information.
74-
75-
Binary is built at `worker/out/MEDIASOUP_BUILDTYPE/build`.
76+
## Makefile
7677

77-
In order to instruct the mediasoup Node.js module to use the `Debug` mediasoup-worker binary, an environment variable must be set before running the Node.js application:
78+
The `worker` folder contains a `Makefile` for the mediasoup-worker C++ subproject. It includes the following tasks:
7879

79-
```bash
80-
$ MEDIASOUP_BUILDTYPE=Debug node myapp.js
81-
```
8280

83-
If the "MEDIASOUP_WORKER_BIN" environment variable is set, mediasoup will use the it as mediasoup-worker binary and **won't** compile the binary:
81+
### `make` or `make mediasoup-worker`
8482

85-
```bash
86-
$ MEDIASOUP_WORKER_BIN="/home/xxx/src/foo/mediasoup-worker" node myapp.js
87-
```
83+
Alias of ``make mediasoup-worker` below.
8884

8985

90-
### `make libmediasoup-worker`
86+
### `make meson-ninja`
9187

92-
Builds the `libmediasoup-worker` static library at `worker/out/Release/`.
88+
Installs `meson` and `ninja`.
9389

94-
`MEDIASOUP_MAX_CORES` and `MEDIASOUP_BUILDTYPE` environment variables from above still apply for static library build.
9590

9691
### `make clean`
9792

@@ -128,6 +123,39 @@ $ make update-wrap-file SUBPROJECT=openssl
128123
```
129124

130125

126+
### `make mediasoup-worker`
127+
128+
Builds the `mediasoup-worker` binary at `worker/out/Release/`.
129+
130+
If the "MEDIASOUP_MAX_CORES" environment variable is set, the build process will use that number of CPU cores. Otherwise it will auto-detect the number of cores in the machine.
131+
132+
"MEDIASOUP_BUILDTYPE" environment variable controls build types, `Release` and `Debug` are presets optimized for those use cases.
133+
Other build types are possible too, but they are not presets and will require "MESON_ARGS" use to customize build configuration.
134+
Check the meaning of useful macros in the `worker/include/Logger.hpp` header file if you want to enable tracing or other debug information.
135+
136+
Binary is built at `worker/out/MEDIASOUP_BUILDTYPE/build`.
137+
138+
In order to instruct the mediasoup Node.js module to use the `Debug` mediasoup-worker binary, an environment variable must be set before running the Node.js application:
139+
140+
```bash
141+
$ MEDIASOUP_BUILDTYPE=Debug node myapp.js
142+
```
143+
144+
If the "MEDIASOUP_WORKER_BIN" environment variable is set, mediasoup will use the it as mediasoup-worker binary and **won't** compile the binary:
145+
146+
```bash
147+
$ MEDIASOUP_WORKER_BIN="/home/xxx/src/foo/mediasoup-worker" node myapp.js
148+
```
149+
150+
151+
152+
### `make libmediasoup-worker`
153+
154+
Builds the `libmediasoup-worker` static library at `worker/out/Release/`.
155+
156+
`MEDIASOUP_MAX_CORES` and `MEDIASOUP_BUILDTYPE` environment variables from above still apply for static library build.
157+
158+
131159
### `make xcode`
132160

133161
Builds a Xcode project for the mediasoup-worker subproject.

node/lib/ActiveSpeakerObserver.d.ts

-36
This file was deleted.

node/lib/ActiveSpeakerObserver.d.ts.map

-1
This file was deleted.

node/lib/ActiveSpeakerObserver.js

-44
This file was deleted.

node/lib/AudioLevelObserver.d.ts

-55
This file was deleted.

node/lib/AudioLevelObserver.d.ts.map

-1
This file was deleted.

node/lib/AudioLevelObserver.js

-56
This file was deleted.

0 commit comments

Comments
 (0)