phaser/scripts/copy-to-examples.js

45 lines
1,002 B
JavaScript
Raw Permalink Normal View History

2017-10-11 16:06:21 +00:00
let fs = require('fs-extra');
2018-07-11 11:34:12 +00:00
let sloc = require('node-sloc');
let source = './build/phaser.js';
let sourceMap = './build/phaser.js.map';
2018-01-09 22:29:08 +00:00
let dest = '../phaser3-examples/public/build/dev.js';
2023-03-22 16:05:29 +00:00
let destDir = '../phaser3-examples/public/build/';
2018-02-13 03:23:16 +00:00
let destMap = '../phaser3-examples/public/build/phaser.js.map';
2018-09-20 13:13:59 +00:00
2023-03-22 16:05:29 +00:00
if (fs.existsSync(destDir))
{
2018-02-13 03:23:16 +00:00
fs.copy(sourceMap, destMap, function (err) {
if (err)
{
return console.error(err);
}
});
fs.copy(source, dest, function (err) {
if (err)
{
return console.error(err);
}
console.log('Build copied to ' + dest);
2017-10-11 16:06:21 +00:00
const options = {
path: './src',
2021-09-28 14:59:46 +00:00
extensions: [ 'js' ]
2017-10-11 16:06:21 +00:00
};
2021-09-28 14:59:46 +00:00
2018-07-11 11:34:12 +00:00
sloc(options).then((res) => {
2021-09-28 14:59:46 +00:00
console.log('Source files: ' + res.files + '\nLines of code: ' + res.sloc);
2018-07-11 11:34:12 +00:00
});
2017-10-11 16:06:21 +00:00
});
}
else
{
2018-09-20 13:13:59 +00:00
// console.log('Copy-to-Examples failed: Phaser 3 Examples not present at ../phaser3-examples');
}