Make Jitsi download script a JS script

It's awful but means that we create the directory on all platforms in-process.

Fixes https://github.com/vector-im/riot-web/issues/13215
This commit is contained in:
Travis Ralston 2020-04-16 12:37:41 -06:00
parent b5e8e5cf75
commit 005269e2ad
4 changed files with 32 additions and 27 deletions

View file

@ -38,7 +38,7 @@
"clean": "rimraf lib webapp electron_app/dist",
"build": "yarn clean && yarn build:genfiles && yarn build:compile && yarn build:types && yarn build:bundle",
"build-stats": "yarn clean && yarn build:genfiles && yarn build:compile && yarn build:types && yarn build:bundle-stats",
"build:jitsi": "scripts/build-jitsi.sh",
"build:jitsi": "node scripts/build-jitsi.js",
"build:res": "node scripts/copy-res.js",
"build:genfiles": "yarn reskindex && yarn build:res && yarn build:jitsi",
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
@ -135,6 +135,7 @@
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"modernizr": "^3.6.0",
"node-fetch": "^2.6.0",
"optimize-css-assets-webpack-plugin": "^5.0.3",
"postcss-extend": "^1.0.5",
"postcss-hexrgba": "^2.0.0",

22
scripts/build-jitsi.js Normal file
View file

@ -0,0 +1,22 @@
// This is a JS script so that the directory is created in-process on Windows.
// Sorry.
const fs = require("fs");
const path = require("path");
const mkdirp = require("mkdirp");
const fetch = require("node-fetch");
console.log("Making webapp directory");
mkdirp.sync("webapp");
// curl -s https://jitsi.riot.im/libs/external_api.min.js > ./webapp/jitsi_external_api.min.js
console.log("Downloading Jitsi script");
const fname = path.join("webapp", "jitsi_external_api.min.js");
fetch("https://jitsi.riot.im/libs/external_api.min.js").then(res => {
const stream = fs.createWriteStream(fname);
return new Promise((resolve, reject) => {
res.body.pipe(stream);
res.body.on('error', err => reject(err));
res.body.on('finish', () => resolve());
});
}).then(() => console.log('Done with Jitsi download'));

View file

@ -1,7 +0,0 @@
#!/bin/bash
if [[ ! -f "./webapp" ]]; then
mkdir "./webapp"
fi
curl -s https://jitsi.riot.im/libs/external_api.min.js > ./webapp/jitsi_external_api.min.js

View file

@ -7645,8 +7645,8 @@ matrix-mock-request@^1.2.3:
create-react-class "^15.6.0"
diff-dom "^4.1.3"
diff-match-patch "^1.0.4"
emojibase-data "^5.0.1"
emojibase-regex "^4.0.1"
emojibase-data "^4.0.2"
emojibase-regex "^3.0.0"
escape-html "^1.0.3"
file-saver "^1.3.3"
filesize "3.5.6"
@ -8136,6 +8136,11 @@ node-fetch@^1.0.1:
encoding "^0.1.11"
is-stream "^1.0.1"
node-fetch@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
node-forge@0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579"
@ -8191,22 +8196,6 @@ node-notifier@^5.4.2:
shellwords "^0.1.1"
which "^1.3.0"
node-pre-gyp@*:
version "0.14.0"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz#9a0596533b877289bcad4e143982ca3d904ddc83"
integrity sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA==
dependencies:
detect-libc "^1.0.2"
mkdirp "^0.5.1"
needle "^2.2.1"
nopt "^4.0.1"
npm-packlist "^1.1.6"
npmlog "^4.0.2"
rc "^1.2.7"
rimraf "^2.6.1"
semver "^5.3.0"
tar "^4.4.2"
node-pre-gyp@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz#db1f33215272f692cd38f03238e3e9b47c5dd054"
@ -11693,7 +11682,7 @@ tar-stream@^2.1.0:
inherits "^2.0.3"
readable-stream "^3.1.1"
tar@^4, tar@^4.4.2:
tar@^4:
version "4.4.13"
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.13.tgz#43b364bc52888d555298637b10d60790254ab525"
integrity sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==