'use strict'; const fs = require('fs'); const path = require('path'); const assets = path.join(__dirname, '..', 'assets'); const original = fs.readFileSync(path.join(assets, 'chart-4.4.8.umd.js'), 'utf8'); const prefix = '(function () {\nvar hadChart = Object.prototype.hasOwnProperty.call(window, "Chart");\nvar previousChart = window.Chart;\nvar module = {exports: {}}; var exports = module.exports;\n'; const suffix = '\nwindow.O6HVpsChart = module.exports;\nif (hadChart) window.Chart = previousChart; else delete window.Chart;\n}());\n'; fs.writeFileSync(path.join(assets, 'chart-4.4.8.scoped.js'), prefix + original.replace(/^\/\/# sourceMappingURL=.*$/m, '') + suffix);