Skip to content

Commit 381e5fd

Browse files
committed
update readme
1 parent f5b87f8 commit 381e5fd

File tree

4 files changed

+98
-12
lines changed

4 files changed

+98
-12
lines changed

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is a Phaser 3 project template that uses webpack for bundling. It supports
88

99
This template has been updated for:
1010

11-
- [Phaser 3.80.1](https://github.com/phaserjs/phaser)
11+
- [Phaser 3.85.0](https://github.com/phaserjs/phaser)
1212
- [Webpack 5.91.0](https://github.com/webpack/webpack)
1313

1414
![screenshot](screenshot.png)
@@ -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 `dist` 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

@@ -95,6 +97,52 @@ You can write modern ES6+ JavaScript and Babel will transpile it to a version of
9597

9698
If you want to customize your build, such as adding a new webpack loader or plugin (i.e. for loading CSS or fonts), you can modify the `webpack/config.js` 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 [Webpack documentation](https://webpack.js.org/) for more information.
9799

100+
## About log.js
101+
102+
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.
103+
104+
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.
105+
106+
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.
107+
108+
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.
109+
110+
However, if you don't want to send any data, you can use these commands instead:
111+
112+
Dev:
113+
114+
```bash
115+
npm run dev-nolog
116+
```
117+
118+
Build:
119+
120+
```bash
121+
npm run build-nolog
122+
```
123+
124+
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`:
125+
126+
Before:
127+
128+
```json
129+
"scripts": {
130+
"dev": "node log.js dev && vite --config vite/config.dev.mjs",
131+
"build": "node log.js build && vite build --config vite/config.prod.mjs"
132+
},
133+
```
134+
135+
After:
136+
137+
```json
138+
"scripts": {
139+
"dev": "vite --config vite/config.dev.mjs",
140+
"build": "vite build --config vite/config.prod.mjs"
141+
},
142+
```
143+
144+
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.
145+
98146
## Join the Phaser Community!
99147

100148
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: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
22
"name": "template-webpack",
3-
"version": "3.2.0",
3+
"version": "3.2.1",
44
"main": "src/main.js",
55
"scripts": {
6-
"dev": "webpack-dev-server --config webpack/config.js --open",
7-
"build": "webpack --config webpack/config.prod.js"
6+
"dev": "node log.js dev & webpack-dev-server --config webpack/config.js --open",
7+
"build": "node log.js build & webpack --config webpack/config.prod.js",
8+
"dev-nolog": "webpack-dev-server --config webpack/config.js --open",
9+
"build-nolog": "webpack --config webpack/config.prod.js"
810
},
911
"repository": {
1012
"type": "git",
@@ -33,6 +35,6 @@
3335
"webpack-merge": "^5.10.0"
3436
},
3537
"dependencies": {
36-
"phaser": "^3.80.1"
38+
"phaser": "^3.85.0"
3739
}
38-
}
40+
}

0 commit comments

Comments
 (0)