From e9a34bfedc478564e1d7ab5dd90eaf6c74cb847a Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 22 Mar 2023 16:05:29 +0000 Subject: [PATCH] Updated copy scripts --- scripts/copy-esm-to-examples-watch.js | 34 +++++++++++++++++++++++++++ scripts/copy-to-examples-watch.js | 3 ++- scripts/copy-to-examples.js | 33 ++------------------------ 3 files changed, 38 insertions(+), 32 deletions(-) create mode 100644 scripts/copy-esm-to-examples-watch.js diff --git a/scripts/copy-esm-to-examples-watch.js b/scripts/copy-esm-to-examples-watch.js new file mode 100644 index 000000000..df7b8de32 --- /dev/null +++ b/scripts/copy-esm-to-examples-watch.js @@ -0,0 +1,34 @@ +let fs = require('fs-extra'); + +let source = './build/phaser.esm.js'; +let sourceMap = './build/phaser.esm.js.map'; +let dest = '../phaser3-examples/public/build/dev.esm.js'; +let destDir = '../phaser3-examples/public/build/'; +let destMap = '../phaser3-examples/public/build/phaser.esm.js.map'; + +if (fs.existsSync(destDir)) +{ + 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); + + }); +} +else +{ + console.log('Copy-to-Examples failed: Phaser 3 Examples not present at ../phaser3-examples'); +} diff --git a/scripts/copy-to-examples-watch.js b/scripts/copy-to-examples-watch.js index 40d835227..00b300633 100644 --- a/scripts/copy-to-examples-watch.js +++ b/scripts/copy-to-examples-watch.js @@ -3,9 +3,10 @@ let fs = require('fs-extra'); let source = './build/phaser.js'; let sourceMap = './build/phaser.js.map'; let dest = '../phaser3-examples/public/build/dev.js'; +let destDir = '../phaser3-examples/public/build/'; let destMap = '../phaser3-examples/public/build/phaser.js.map'; -if (fs.existsSync(dest)) +if (fs.existsSync(destDir)) { fs.copy(sourceMap, destMap, function (err) { diff --git a/scripts/copy-to-examples.js b/scripts/copy-to-examples.js index 3e17a8801..2c542a68d 100644 --- a/scripts/copy-to-examples.js +++ b/scripts/copy-to-examples.js @@ -4,39 +4,10 @@ let sloc = require('node-sloc'); let source = './build/phaser.js'; let sourceMap = './build/phaser.js.map'; let dest = '../phaser3-examples/public/build/dev.js'; +let destDir = '../phaser3-examples/public/build/'; let destMap = '../phaser3-examples/public/build/phaser.js.map'; -let sourceFB = './build/phaser-facebook-instant-games.js'; -let sourceFBMap = './build/phaser-facebook-instant-games.js.map'; -let destFB = '../fbtest1/lib/dev.js'; -let destFBMap = '../fbtest1/lib/phaser.js.map'; - -/* -if (fs.existsSync(destFB)) -{ - fs.copy(source, destFB, function (err) { - - if (err) - { - return console.error(err); - } - - console.log('Build copied to ' + destFB); - - }); - - fs.copy(sourceMap, destFBMap, function (err) { - - if (err) - { - return console.error(err); - } - - }); -} -*/ - -if (fs.existsSync(dest)) +if (fs.existsSync(destDir)) { fs.copy(sourceMap, destMap, function (err) {