You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
545 B
22 lines
545 B
3 years ago
|
let fs = require('fs')
|
||
|
|
||
|
function embedJs(src, dst) {
|
||
|
fs.readFile(src, 'utf8', function(err, data) {
|
||
|
if(err) throw err;
|
||
|
|
||
|
data = data.replace(/\\"/g, '\\\\"');
|
||
|
data = "(<any>window)['"+src.replace(/^.*[\\\/]/, '')+"'] = `" + data + "`;";
|
||
|
|
||
|
fs.writeFile(dst, data, function(err) {
|
||
|
if(err) throw err;
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
let toolsDir = __dirname;
|
||
|
let dataDir = toolsDir + "/../data";
|
||
|
let srcDir = toolsDir + "/../src";
|
||
|
let intermediateDir = toolsDir + "/../.intermediate";
|
||
|
|
||
|
embedJs(intermediateDir+'/app.js', intermediateDir+'/app.js.ts');
|