forked from ray5273/TMP_extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-script.js
45 lines (39 loc) · 1.48 KB
/
build-script.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const fs = require("fs-extra");
const updateBackgroundFile = buildPath => {
const backgroundJS = `${buildPath}/background.js`;
const backgroundJS_original = './src/background.js';
const contentscriptJS = `${buildPath}/content.js`;
const contentscriptJS_original = './src/content.js';
const pdfscriptJS = `${buildPath}/pdf-button-script.js`;
const pdfscriptJS_original = './src/pdf-button-script.js';
let contentscriptContents = fs.readFileSync(contentscriptJS_original,"utf8");
let backgroundContents = fs.readFileSync(backgroundJS_original, "utf8");
let pdfscriptContents = fs.readFileSync(pdfscriptJS_original,"utf8");
// Write back the corrected background script
fs.writeFile(backgroundJS, backgroundContents, function(err) {
if (err) {
return console.log(err);
}
console.log("background.js updated.");
});
// Write back the corrected content-script
fs.writeFile(contentscriptJS, contentscriptContents, function(err) {
if (err) {
return console.log(err);
}
console.log("content-script.js updated.");
});
fs.writeFile(pdfscriptJS, pdfscriptContents, function(err) {
if (err) {
return console.log(err);
}
console.log("pdf-button-script.js updated.");
});
};
module.exports = {
updateBackgroundFile: updateBackgroundFile
};
if (require.main === module) {
const buildPath = "./build";
updateBackgroundFile(buildPath);
}