forked from microsoft/pxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatchUglifyify.js
More file actions
25 lines (17 loc) · 863 Bytes
/
patchUglifyify.js
File metadata and controls
25 lines (17 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// This script patches this bug:
// https://github.com/hughsk/uglifyify/issues/88
const fs = require("fs");
const path = require("path");
// uglifyify is a dev dependency so it might not exist
if (!fs.existsSync(path.resolve("./node_modules/uglifyify/package.json"))) {
return;
}
const packageJson = JSON.parse(fs.readFileSync(path.resolve("./node_modules/uglifyify/package.json"), "utf8"));
if (packageJson.version !== "5.0.2") {
throw new Error("patchUglifyify was written for version 5.0.2. If the version has been updated, update the script!");
}
const index = fs.readFileSync(path.resolve("./node_modules/uglifyify/index.js"), "utf8");
const lines = index.split("\n");
lines.splice(38, 0, " delete opts.ignore;");
fs.writeFileSync(path.resolve("./node_modules/uglifyify/index.js"), lines.join("\n"), "utf8");
console.log("Patched uglifyify")