forked from Aymkdn/html-to-pdfmake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate-doc.js
More file actions
19 lines (18 loc) · 694 Bytes
/
update-doc.js
File metadata and controls
19 lines (18 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const package = require("./package.json");
const fs = require("fs");
const fileName = "./docs/index.html";
// delete all browser-*.js files
let content = fs.readdirSync('./docs/');
content.forEach(function(file) {
if (/^browser-[\d\.]+\.js$/.test(file)) fs.unlinkSync('./docs/'+file);
});
// copy the new one
fs.copyFileSync('./browser.js', './docs/browser-'+package.version+'.js');
// update the html file
fs.readFile(fileName, 'utf8', function(err, content) {
content = content.replace(/browser-[\d\.]+\.js/, 'browser-'+package.version+'.js');
fs.writeFile(fileName, content, function(err) {
if (err) throw err;
console.log("Documentation updated with last version");
});
})