Skip to content

Commit

Permalink
workerChannel: Do not copy the addon binary into node/lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan committed May 22, 2024
1 parent 9f24c50 commit a003c63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
7 changes: 6 additions & 1 deletion node/src/workerChannel/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import { EnhancedEventEmitter } from '../../enhancedEvents';

const buildType = process.env.MEDIASOUP_BUILDTYPE ?? 'Release';

/**
* NOTE: The following path is reachable from:
* - current file: node/src/workerChannel/src/index.ts
* - transpiled JS file: node/lib/workerChannel/src/index.js
*/
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { WorkerChannel: NativeWorkerChannel } = require(
`../build/${buildType}/worker-channel.node`
`../../../src/workerChannel/build/${buildType}/worker-channel.node`
);

export type WorkerChannelEvents = {
Expand Down
17 changes: 0 additions & 17 deletions npm-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,6 @@ function buildTypescript({ force = false } = { force: false }) {

deleteNodeLib();
executeCmd('tsc --project node');

copyAddon();
}

function buildWorkerLib() {
Expand All @@ -349,21 +347,6 @@ function buildAddon() {
executeCmd(
`cd ${WORKER_CHANNEL_ADDON_PATH} && node scripts.mjs binding:build`
);

copyAddon();
}

function copyAddon() {
logInfo('copyAddon()');

const buildType = process.env.MEDIASOUP_BUILDTYPE || 'Release';
const outDir = `node/lib/workerChannel/build/${buildType}`;

ensureDir(outDir);

fs.cpSync(`${WORKER_CHANNEL_ADDON_PATH}/build/${buildType}`, outDir, {
recursive: true,
});
}

function cleanWorkerArtifacts() {
Expand Down

0 comments on commit a003c63

Please sign in to comment.