8000 Added webpack shell script to copy build file to examples. · ITCSsDeveloper/phaser@13f49f6 · GitHub
Skip to content

Commit 13f49f6

Browse files
committed
Added webpack shell script to copy build file to examples.
1 parent 98c932e commit 13f49f6

7 files changed

Lines changed: 128 additions & 16 deletions

File tree

v3/copy-to-examples.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var fs = require('fs-extra');
2+
3+
var source = './dist/phaser.js';
4+
var dest = '../../phaser3-examples/public/js/phaser.js';
5+
6+
fs.copy(source, dest, function (err) {
7+
8+
if (err)
9+
{
10+
return console.error(err);
11+
}
12+
13+
console.log('Copied to ' + dest);
14+
15+
});

v3/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
"webpack": "2.1.0-beta.27"
3434
},
3535
"devDependencies": {
36-
"webpack-dev-server": "2.1.0-beta.11"
36+
"copy-webpack-plugin": "^4.0.1",
37+
"fs-extra": "^1.0.0",
38+
"webpack-dev-server": "2.1.0-beta.11",
39+
"webpack-shell-plugin": "^0.4.3"
3740
}
3841
}

v3/src/boot/Config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2016 Photon Storm Ltd.
4+
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
5+
*/
6+
7+
// var CONST = require('../const');
8+
9+
function Config (config)
10+
{
11+
if (config === undefined) { config = {}; }
12+
13+
this.renderType = config.renderType || 0;
14+
this.gameTitle = config.game || 'bomberman';
15+
}
16+
17+
Config.prototype.constructor = Config;
18+
19+
module.exports = Config;

v3/src/boot/DebugHeader.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66

77
var CONST = require('../const');
88

9-
var DebugHeader = function (renderType, ie)
9+
var DebugHeader = function (config)
1010
{
11-
var c = (renderType === CONST.CANVAS) ? 'Canvas' : 'WebGL';
11+
var c = (config.renderType === CONST.CANVAS) ? 'Canvas' : 'WebGL';
12+
13+
var ie = false;
1214

1315
if (!ie)
1416
{
1517
var args = [
16-
'%c %c %c %c %c Phaser v' + CONST.VERSION + ' / ' + c + ' %c http://phaser.io',
18+
'%c %c %c %c %c ' + config.gameTitle + ' / Phaser v' + CONST.VERSION + ' / ' + c + ' %c http://phaser.io',
1719
'background: #ff0000',
1820
'background: #ffff00',
1921
'background: #00ff00',

v3/src/boot/Game.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
*/
66

7+
var Config = require('./Config');
78
var DebugHeader = require('./DebugHeader');
89

9-
var Game = function ()
10+
var Game = function (config)
1011
{
11-
DebugHeader(0);
12+
this.config = new Config(config);
13+
14+
DebugHeader(this.config);
1215
};
1316

1417
module.exports = Game;

v3/webpack.config.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const webpack = require('webpack');
4+
const WebpackShellPlugin = require('webpack-shell-plugin');
45

56
module.exports = {
67

@@ -13,12 +14,14 @@ module.exports = {
1314
output: {
1415
path: './dist',
1516
filename: '[name].js',
16-
library: 'Phaser',
17-
publicPath: '/lib'
17+
library: 'Phaser'
1818
},
1919

20-
devServer: {
21-
contentBase: '/src'
22-
}
20+
plugins: [
2321

22+
new WebpackShellPlugin({
23+
onBuildEnd: 'node copy-to-examples.js'
24+
})
25+
26+
]
2427
};

v3/yarn.lock

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ block-stream@*:
182182
dependencies:
183183
inherits "~2.0.0"
184184

185+
bluebird@^2.10.2:
186+
version "2.11.0"
187+
resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-2.11.0.tgz#534b9033c022c9579c56ba3b3e5a5caafbb650e1"
188+
185189
bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0:
186190
version "4.11.6"
187191
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.6.tgz#53344adb14617a13f6e8dd2ce28905d1c0ba3215"
@@ -427,6 +431,19 @@ cookie@0.3.1:
427431
version "0.3.1"
428432
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
429433

434+
copy-webpack-plugin@^4.0.1:
435+
version "4.0.1"
436+
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.0.1.tgz#9728e383b94316050d0c7463958f2b85c0aa8200"
437+
dependencies:
438+
bluebird "^2.10.2"
439+
fs-extra "^0.26.4"
440+
glob "^6.0.4"
441+
is-glob "^3.1.0"
442+
loader-utils "^0.2.15"
443+
lodash "^4.3.0"
444+
minimatch "^3.0.0"
445+
node-dir "^0.1.10"
446+
430447
core-util-is@~1.0.0:
431448
version "1.0.2"
432449
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@@ -744,6 +761,24 @@ fresh@0.3.0:
744761
version "0.3.0"
745762
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.3.0.tgz#651f838e22424e7566de161d8358caa199f83d4f"
746763

764+
fs-extra@^0.26.4:
765+
version "0.26.7"
766+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.26.7.tgz#9ae1fdd94897798edab76d0918cf42d0c3184fa9"
767+
dependencies:
768+
graceful-fs "^4.1.2"
769+
jsonfile "^2.1.0"
770+
klaw "^1.0.0"
771+
path-is-absolute "^1.0.0"
772+
rimraf "^2.2.8"
773+
774+
fs-extra@^1.0.0:
775+
version "1.0.0"
776+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950"
777+
dependencies:
778+
graceful-fs "^4.1.2"
779+
jsonfile "^2.1.0"
780+
klaw "^1.0.0"
781+
747782
fs.realpath@^1.0.0:
748783
version "1.0.0"
749784
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
@@ -819,6 +854,16 @@ glob-parent@^2.0.0:
819854
dependencies:
820855
is-glob "^2.0.0"
821856

857+
glob@^6.0.4:
858+
version "6.0.4"
859+
resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22"
860+
dependencies:
861+
inflight "^1.0.4"
862+
inherits "2"
863+
minimatch "2 || 3"
864+
once "^1.3.0"
865+
path-is-absolute "^1.0.0"
866+
822867
glob@^7.0.5:
823868
version "7.1.1"
824869
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8"
@@ -830,7 +875,7 @@ glob@^7.0.5:
830875
once "^1.3.0"
831876
path-is-absolute "^1.0.0"
832877

833-
graceful-fs@^4.1.2:
878+
graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
834879
version "4.1.10"
835880
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.10.tgz#f2d720c22092f743228775c75e3612632501f131"
836881

@@ -1041,7 +1086,7 @@ is-glob@^2.0.0, is-glob@^2.0.1:
10411086
dependencies:
10421087
is-extglob "^1.0.0"
10431088

1044-
is-glob@^3.0.0:
1089+
is-glob@^3.0.0, is-glob@^3.1.0:
10451090
version "3.1.0"
10461091
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a"
10471092
dependencies:
@@ -1128,6 +1173,12 @@ json5@^0.5.0:
11281173
version "0.5.0"
11291174
resolved "https://registry.yarnpkg.com/json5/-/json5-0.5.0.tgz#9b20715b026cbe3778fd769edccd822d8332a5b2"
11301175

1176+
jsonfile@^2.1.0:
1177+
version "2.4.0"
1178+
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8"
1179+
optionalDependencies:
1180+
graceful-fs "^4.1.6"
1181+
11311182
jsonify@~0.0.0:
11321183
version "0.0.0"
11331184
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
@@ -1150,6 +1201,12 @@ kind-of@^3.0.2:
11501201
dependencies:
11511202
is-buffer "^1.0.2"
11521203

1204+
klaw@^1.0.0:
1205+
version "1.3.1"
1206+
resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439"
1207+
optionalDependencies:
1208+
graceful-fs "^4.1.9"
1209+
11531210
lazy-cache@^1.0.3:
11541211
version "1.0.4"
11551212
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
@@ -1174,7 +1231,7 @@ loader-runner@^2.2.0:
11741231
version "2.2.0"
11751232
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.2.0.tgz#824c1b699c4e7a2b6501b85902d5b862bf45b3fa"
11761233

1177-
loader-utils@^0.2.16:
1234+
loader-utils@^0.2.15, loader-utils@^0.2.16:
11781235
version "0.2.16"
11791236
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d"
11801237
dependencies:
@@ -1253,7 +1310,7 @@ minimalistic-assert@^1.0.0:
12531310
version "1.0.0"
12541311
resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz#702be2dda6b37f4836bcb3f5db56641b64a1d3d3"
12551312

1256-
minimatch@^3.0.0, minimatch@^3.0.2:
1313+
"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2:
12571314
version "3.0.3"
12581315
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
12591316
dependencies:
@@ -1285,6 +1342,12 @@ negotiator@0.6.1:
12851342
version "0.6.1"
12861343
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
12871344

1345+
node-dir@^0.1.10:
1346+
version "0.1.16"
1347+
resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.16.tgz#d2ef583aa50b90d93db8cdd26fcea58353957fe4"
1348+
dependencies:
1349+
minimatch "^3.0.2"
1350+
12881351
node-libs-browser@^1.0.0:
12891352
version "1.0.0"
12901353
resolved "https://registry.yarnpkg.com/node-libs-browser/-/node-libs-browser-1.0.0.tgz#ff8ad6c2cfa78043bdd0091ec07f0aaa581620fc"
@@ -1695,7 +1758,7 @@ right-align@^0.1.1:
16951758
dependencies:
16961759
align-text "^0.1.1"
16971760

1698-
rimraf@2, rimraf@~2.5.1, rimraf@~2.5.4:
1761+
rimraf@2, rimraf@^2.2.8, rimraf@~2.5.1, rimraf@~2.5.4:
16991762
version "2.5.4"
17001763
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04"
17011764
dependencies:
@@ -2094,6 +2157,10 @@ webpack-dev-server@2.1.0-beta.11:
20942157
webpack-dev-middleware "^1.4.0"
20952158
yargs "^6.0.0"
20962159

2160+
webpack-shell-plugin@^0.4.3:
2161+
version "0.4.3"
2162+
resolved "https://registry.yarnpkg.com/webpack-shell-plugin/-/webpack-shell-plugin-0.4.3.tgz#a633e98c16b3bed5b6963e98059ca783841f3043"
2163+
20972164
webpack-sources@^0.1.0:
20982165
version "0.1.3"
20992166
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-0.1.3.tgz#15ce2fb79d0a1da727444ba7c757bf164294f310"

0 commit comments

Comments
 (0)