Unverified 提交 bc55f22c authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo 提交者: GitHub

npm installation: Don't require Python if valid worker prebuilt binary is fetched (#1265)

上级 fb83d4f4
......@@ -3,7 +3,8 @@
### NEXT
* worker: Disable RtcLogger usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)).
* worker: Disable `RtcLogger` usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)).
* npm installation: Don't require Python if valid worker prebuilt binary is fetched ([PR #1265](https://github.com/versatica/mediasoup/pull/1265)).
### 3.13.11
......
......@@ -47,13 +47,6 @@ async function run()
{
switch (task)
{
case 'preinstall':
{
installInvoke();
break;
}
// As per NPM documentation (https://docs.npmjs.com/cli/v9/using-npm/scripts)
// `prepare` script:
//
......@@ -167,6 +160,8 @@ async function run()
case 'format:worker':
{
installInvoke();
executeCmd(`"${PYTHON}" -m invoke -r worker format`);
break;
......@@ -351,6 +346,8 @@ function buildWorker()
{
logInfo('buildWorker()');
installInvoke();
executeCmd(`"${PYTHON}" -m invoke -r worker mediasoup-worker`);
}
......@@ -358,6 +355,8 @@ function cleanWorkerArtifacts()
{
logInfo('cleanWorkerArtifacts()');
installInvoke();
// Clean build artifacts except `mediasoup-worker`.
executeCmd(`"${PYTHON}" -m invoke -r worker clean-build`);
// Clean downloaded dependencies.
......@@ -377,6 +376,8 @@ function lintWorker()
{
logInfo('lintWorker()');
installInvoke();
executeCmd(`"${PYTHON}" -m invoke -r worker lint`);
}
......@@ -384,6 +385,8 @@ function flatcNode()
{
logInfo('flatcNode()');
installInvoke();
// Build flatc if needed.
executeCmd(`"${PYTHON}" -m invoke -r worker flatc`);
......@@ -410,6 +413,8 @@ function flatcWorker()
{
logInfo('flatcWorker()');
installInvoke();
executeCmd(`"${PYTHON}" -m invoke -r worker flatc`);
}
......@@ -431,6 +436,8 @@ function testWorker()
{
logInfo('testWorker()');
installInvoke();
executeCmd(`"${PYTHON}" -m invoke -r worker test`);
}
......@@ -575,6 +582,8 @@ async function downloadPrebuiltWorker()
{
const resolvedBinPath = path.resolve(WORKER_RELEASE_BIN_PATH);
// This will always fail on purpose, but if status code is 41 then
// it's good.
execSync(
`"${resolvedBinPath}"`,
{
......@@ -583,15 +592,15 @@ async function downloadPrebuiltWorker()
env : {}
}
);
logInfo(
'downloadPrebuiltWorker() | fetched mediasoup-worker prebuilt binary is valid for current host'
);
}
catch (error)
{
if (error.status === 41)
{
logInfo(
'downloadPrebuiltWorker() | fetched mediasoup-worker prebuilt binary is valid for current host'
);
resolve(true);
}
else
......
......@@ -49,7 +49,6 @@
"nodejs"
],
"scripts": {
"preinstall": "node npm-scripts.mjs preinstall",
"prepare": "node npm-scripts.mjs prepare",
"postinstall": "node npm-scripts.mjs postinstall",
"typescript:build": "node npm-scripts.mjs typescript:build",
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论