disable-devtool/helper/mod-index-html-version.js
2021-07-25 17:52:51 +08:00

13 lines
481 B
JavaScript

const pkg = require('../package.json');
const util = require('./util');
function modIndexHtmlVersion () {
util.read('index.html', (html) => {
const res = html.match(new RegExp(`https://cdn.jsdelivr.net/npm/disable-devtool@.*/disable-devtool.min.js#use`));
if (res) {
util.write('index.html', html.replace(res[0], `https://cdn.jsdelivr.net/npm/disable-devtool@${pkg.version}/disable-devtool.min.js#use`));
}
});
}
modIndexHtmlVersion();