mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Improve dead code detection (#22829)
This commit is contained in:
parent
b3b8e2e0a2
commit
ee3b9c3310
@ -4,15 +4,21 @@
|
||||
const fs = require("fs");
|
||||
const { exec } = require("node:child_process");
|
||||
|
||||
const includeJSSDK = process.argv.includes("--include-js-sdk");
|
||||
const ignore = [];
|
||||
|
||||
ignore.push(...Object.values(JSON.parse(fs.readFileSync(`${__dirname}/../components.json`))));
|
||||
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");
|
||||
|
||||
const command = `yarn ts-prune --ignore "${ignore.join("|")}" | grep -v "(used in module)"`;
|
||||
|
||||
exec(command, (error, stdout) => {
|
||||
exec(command, (error, stdout, stderr) => {
|
||||
if (error) throw error;
|
||||
// We have to do this as piping the output of ts-prune causes the return
|
||||
// code to be 0
|
||||
if (stderr) throw Error(stderr);
|
||||
|
||||
let lines = stdout.split("\n");
|
||||
// Remove the first line as that is the command that was being run and we
|
||||
|
Loading…
Reference in New Issue
Block a user