Skip to content

Commit f672735

Browse files
committed
phaser update
1 parent da6c639 commit f672735

File tree

4 files changed

+97
-11
lines changed

4 files changed

+97
-11
lines changed

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This is a Phaser 3 project template that uses the Angular framework. It includes
66

77
This template has been updated for:
88

9-
- [Phaser 3.80.1](https://github.com/phaserjs/phaser)
9+
- [Phaser 3.85.0](https://github.com/phaserjs/phaser)
1010
- [Angular 17.2.0](https://github.com/angular)
1111
- [TypeScript 5.3.2](https://github.com/microsoft/TypeScript)
1212

@@ -24,6 +24,8 @@ This template has been updated for:
2424
| `npm install` | Install project dependencies |
2525
| `npm run dev` | Launch a development web server |
2626
| `npm run build` | Create a production build in the `build` folder |
27+
| `npm run dev-nolog` | Launch a development web server without sending anonymous data (see "About log.js" below) |
28+
| `npm run build-nolog` | Create a production build in the `dist` folder without sending anonymous data (see "About log.js" below) |
2729

2830
## Writing Code
2931

@@ -173,6 +175,52 @@ In order to deploy your game, you will need to upload *all* of the contents of t
173175

174176
If you want to customize your build, such as adding plugin (i.e. for loading CSS or fonts), you can modify the `angular.json` file for cross-project changes, or you can modify and/or create new configuration files and target them in specific npm tasks inside of `package.json`. Please see the [Angular documentation](https://angular.io/guide/workspace-config) for more information.
175177

178+
## About log.js
179+
180+
If you inspect our node scripts you will see there is a file called `log.js`. This file makes a single silent API call to a domain called `gryzor.co`. This domain is owned by Phaser Studio Inc. The domain name is a homage to one of our favorite retro games.
181+
182+
We send the following 3 pieces of data to this API: The name of the template being used (vue, react, etc). If the build was 'dev' or 'prod' and finally the version of Phaser being used.
183+
184+
At no point is any personal data collected or sent. We don't know about your project files, device, browser or anything else. Feel free to inspect the `log.js` file to confirm this.
185+
186+
Why do we do this? Because being open source means we have no visible metrics about which of our templates are being used. We work hard to maintain a large and diverse set of templates for Phaser developers and this is our small anonymous way to determine if that work is actually paying off, or not. In short, it helps us ensure we're building the tools for you.
187+
188+
However, if you don't want to send any data, you can use these commands instead:
189+
190+
Dev:
191+
192+
```bash
193+
npm run dev-nolog
194+
```
195+
196+
Build:
197+
198+
```bash
199+
npm run build-nolog
200+
```
201+
202+
Or, to disable the log entirely, simply delete the file `log.js` and remove the call to it in the `scripts` section of `package.json`:
203+
204+
Before:
205+
206+
```json
207+
"scripts": {
208+
"dev": "node log.js dev && vite --config vite/config.dev.mjs",
209+
"build": "node log.js build && vite build --config vite/config.prod.mjs"
210+
},
211+
```
212+
213+
After:
214+
215+
```json
216+
"scripts": {
217+
"dev": "vite --config vite/config.dev.mjs",
218+
"build": "vite build --config vite/config.prod.mjs"
219+
},
220+
```
221+
222+
Either of these will stop `log.js` from running. If you do decide to do this, please could you at least join our Discord and tell us which template you're using! Or send us a quick email. Either will be super-helpful, thank you.
223+
176224
## Join the Phaser Community!
177225

178226
We love to see what developers like you create with Phaser! It really motivates us to keep improving. So please join our community and show-off your work 😄

log.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const fs = require('fs');
2+
const https = require('https');
3+
4+
const main = async () => {
5+
const args = process.argv.slice(2);
6+
const packageData = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
7+
const event = args[0] || 'unknown';
8+
const phaserVersion = packageData.dependencies.phaser;
9+
10+
const options = {
11+
hostname: 'gryzor.co',
12+
port: 443,
13+
path: `/v/${event}/${phaserVersion}/${packageData.name}`,
14+
method: 'GET'
15+
};
16+
17+
try {
18+
const req = https.request(options, (res) => {
19+
res.on('data', () => {});
20+
res.on('end', () => {
21+
process.exit(0);
22+
});
23+
});
24+
25+
req.on('error', (error) => {
26+
process.exit(1);
27+
});
28+
29+
req.end();
30+
} catch (error) {
31+
// Silence is the canvas where the soul paints its most profound thoughts.
32+
process.exit(1);
33+
}
34+
}
35+
36+
main();

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "template-angular",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "A Phaser 3 project template that demonstrates Angular communication.",
55
"repository": {
66
"type": "git",
@@ -21,8 +21,10 @@
2121
],
2222
"scripts": {
2323
"ng": "ng",
24-
"dev": "ng serve",
25-
"build": "ng build --base-href='./'"
24+
"dev": "node log dev & ng serve",
25+
"build": "node log.js build & ng build --base-href='./'",
26+
"dev-nolog": "ng serve",
27+
"build-nolog": "ng build --base-href='./'"
2628
},
2729
"dependencies": {
2830
"@angular/animations": "^17.2.0",
@@ -33,7 +35,7 @@
3335
"@angular/platform-browser": "^17.2.0",
3436
"@angular/platform-browser-dynamic": "^17.2.0",
3537
"@angular/router": "^17.2.0",
36-
"phaser": "^3.80.1",
38+
"phaser": "^3.85.0",
3739
"rxjs": "~7.8.0",
3840
"tslib": "^2.3.0",
3941
"zone.js": "~0.14.3"

0 commit comments

Comments
 (0)