Skip to content
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

Tidy and improve dev scripts #25978

Merged
merged 3 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"clean": "rimraf lib webapp",
"build": "yarn clean && yarn build:genfiles && yarn build:bundle",
"build-stats": "yarn clean && yarn build:genfiles && yarn build:bundle-stats",
"build:jitsi": "node scripts/build-jitsi.js",
"build:jitsi": "ts-node scripts/build-jitsi.ts",
"build:res": "node scripts/copy-res.js",
"build:genfiles": "yarn build:res && yarn build:jitsi && yarn build:module_system",
"build:modernizr": "modernizr -c .modernizr.json -d src/vector/modernizr.js",
Expand All @@ -61,7 +61,7 @@
"lint:style": "stylelint \"res/css/**/*.pcss\"",
"test": "jest",
"coverage": "yarn test --coverage",
"analyse:unused-exports": "node ./scripts/analyse_unused_exports.js",
"analyse:unused-exports": "ts-node ./scripts/analyse_unused_exports.ts",
"analyse:webpack-bundles": "webpack-bundle-analyzer webpack-stats.json webapp"
},
"resolutions": {
Expand Down Expand Up @@ -109,6 +109,7 @@
"@types/jsrsasign": "^10.5.4",
"@types/modernizr": "^3.5.3",
"@types/node": "^16",
"@types/node-fetch": "^2.6.4",
"@types/react": "17.0.58",
"@types/react-dom": "17.0.19",
"@types/ua-parser-js": "^0.7.36",
Expand Down Expand Up @@ -163,10 +164,10 @@
"postcss-scss": "^4.0.4",
"postcss-simple-vars": "^5.0.2",
"prettier": "2.8.8",
"proxy-agent": "^6.3.0",
"raw-loader": "^4.0.2",
"rimraf": "^5.0.0",
"semver": "^7.5.2",
"simple-proxy-agent": "^1.1.0",
"string-replace-loader": "3",
"style-loader": "2",
"stylelint": "^15.10.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/usr/bin/env node
"use strict";

const fs = require("fs");
const { exec } = require("node:child_process");
import * as fs from "node:fs";
import { exec } from "node:child_process";

const includeJSSDK = process.argv.includes("--include-js-sdk");
const ignore = [];
const ignore: string[] = [];

ignore.push(...Object.values(JSON.parse(fs.readFileSync(`${__dirname}/../components.json`))));
ignore.push(...Object.values<string>(JSON.parse(fs.readFileSync(`${__dirname}/../components.json`, "utf-8"))));
ignore.push("/index.ts");
// We ignore js-sdk by default as it may export for other non element-web projects
if (!includeJSSDK) ignore.push("matrix-js-sdk");
Expand All @@ -31,7 +30,7 @@ exec(command, (error, stdout, stderr) => {
// won't have an "/" character at the start, so we try to fix that for
// better UX
// TODO: This might break on Windows
lines = lines.reduce((newLines, line) => {
lines = lines.reduce<string[]>((newLines, line) => {
if (!line.startsWith("/")) newLines.push("/" + line);
else newLines.push(line);
return newLines;
Expand Down
21 changes: 9 additions & 12 deletions scripts/build-jitsi.js → scripts/build-jitsi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
// due to file associations in Windows.
// Sorry.

const fs = require("fs");
const path = require("path");
const { mkdirpSync } = require("mkdirp");
const fetch = require("node-fetch");
const ProxyAgent = require("simple-proxy-agent");
import * as fs from "node:fs";
import * as path from "node:path";
import { mkdirpSync } from "mkdirp";
import fetch from "node-fetch";
import { ProxyAgent } from "proxy-agent";

console.log("Making webapp directory");
mkdirpSync("webapp");
Expand All @@ -16,15 +16,12 @@ mkdirpSync("webapp");
console.log("Downloading Jitsi script");
const fname = path.join("webapp", "jitsi_external_api.min.js");

const options = {};
if (process.env.HTTPS_PROXY) {
options.agent = new ProxyAgent(process.env.HTTPS_PROXY, { tunnel: true });
}

fetch("https://meet.element.io/libs/external_api.min.js", options)
fetch("https://meet.element.io/libs/external_api.min.js", {
agent: new ProxyAgent(),
})
.then((res) => {
const stream = fs.createWriteStream(fname);
return new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
res.body.pipe(stream);
res.body.on("error", (err) => reject(err));
res.body.on("finish", () => resolve());
Expand Down
1 change: 0 additions & 1 deletion scripts/check-i18n.pl

This file was deleted.

Loading
Loading