phaser/scripts/copy-to-examples-watch.js

60 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2021-10-19 17:42:48 +00:00
let fs = require('fs-extra');
let source = './build/phaser.js';
let sourceMap = './build/phaser.js.map';
let dest = '../phaser3-examples/public/build/dev.js';
2023-03-22 16:05:29 +00:00
let destDir = '../phaser3-examples/public/build/';
2021-10-19 17:42:48 +00:00
let destMap = '../phaser3-examples/public/build/phaser.js.map';
2024-06-27 11:29:41 +00:00
let dest2 = '../examples/public/build/dev.js';
let dest2Dir = '../examples/public/build/';
let dest2Map = '../examples/public/build/phaser.js.map';
2021-10-19 17:42:48 +00:00
2023-03-22 16:05:29 +00:00
if (fs.existsSync(destDir))
2021-10-19 17:42:48 +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);
});
}
2024-06-27 11:29:41 +00:00
else if (fs.existsSync(dest2Dir))
{
fs.copy(sourceMap, dest2Map, function (err) {
if (err)
{
return console.error(err);
}
});
fs.copy(source, dest2, function (err) {
if (err)
{
return console.error(err);
}
console.log('Build copied to ' + dest2);
});
}
2021-10-19 17:42:48 +00:00
else
{
2024-06-27 11:29:41 +00:00
console.log('Copy-to-Examples failed: Phaser 3 Examples not present at ../phaser3-examples or ../examples');
2021-10-19 17:42:48 +00:00
}