@colyseus/tools 0.15.46 → 0.15.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -4
- package/post-deploy.js +10 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colyseus/tools",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.47",
|
|
4
4
|
"description": "Colyseus Tools for Production",
|
|
5
5
|
"input": "./src/index.ts",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -44,9 +44,11 @@
|
|
|
44
44
|
"node-os-utils": "^1.3.7",
|
|
45
45
|
"cors": "^2.8.5",
|
|
46
46
|
"dotenv": "^8.2.0",
|
|
47
|
-
"express": "^4.16.2"
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
"express": "^4.16.2"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@colyseus/core": "0.15.x",
|
|
51
|
+
"@colyseus/ws-transport": "0.15.x"
|
|
50
52
|
},
|
|
51
53
|
"publishConfig": {
|
|
52
54
|
"access": "public"
|
package/post-deploy.js
CHANGED
|
@@ -6,27 +6,32 @@ const shared = require('./pm2/shared');
|
|
|
6
6
|
|
|
7
7
|
const opts = { env: process.env.NODE_ENV || "production", };
|
|
8
8
|
|
|
9
|
-
const CONFIG_FILE =
|
|
9
|
+
const CONFIG_FILE = [
|
|
10
10
|
'ecosystem.config.cjs',
|
|
11
11
|
'ecosystem.config.js',
|
|
12
12
|
'pm2.config.cjs',
|
|
13
13
|
'pm2.config.js',
|
|
14
14
|
].find((filename) => fs.existsSync(path.resolve(pm2.cwd, filename)));
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* TODO: if not provided, auto-detect entry-point & dynamically generate ecosystem config
|
|
18
|
+
*/
|
|
18
19
|
if (!CONFIG_FILE) {
|
|
19
20
|
throw new Error('missing ecosystem config file. make sure to provide one with a valid "script" entrypoint file path.');
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
const CONFIG_FILE_PATH = `${pm2.cwd}/${CONFIG_FILE}`;
|
|
24
|
+
|
|
25
|
+
let config = undefined;
|
|
26
|
+
|
|
22
27
|
/**
|
|
23
28
|
* Try to handle post-deploy via PM2 module first (pm2 install @colyseus/tools)
|
|
24
29
|
* If not available, fallback to legacy post-deploy script.
|
|
25
30
|
*/
|
|
26
|
-
pm2.trigger('@colyseus/tools', 'post-deploy', `${pm2.cwd}:${
|
|
31
|
+
pm2.trigger('@colyseus/tools', 'post-deploy', `${pm2.cwd}:${CONFIG_FILE_PATH}`, async function (err, result) {
|
|
27
32
|
if (err) {
|
|
28
33
|
console.log("Proceeding with legacy post-deploy script...");
|
|
29
|
-
config = await shared.getAppConfig(
|
|
34
|
+
config = await shared.getAppConfig(CONFIG_FILE_PATH);
|
|
30
35
|
postDeploy();
|
|
31
36
|
|
|
32
37
|
} else {
|