@colyseus/tools 0.15.32 → 0.15.33
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 +1 -1
- package/post-deploy.js +21 -3
package/package.json
CHANGED
package/post-deploy.js
CHANGED
|
@@ -62,13 +62,14 @@ function updateColyseusBootService() {
|
|
|
62
62
|
const COLYSEUS_CLOUD_BOOT_SERVICE = '/etc/systemd/system/colyseus-boot.service';
|
|
63
63
|
|
|
64
64
|
// ignore if no boot service found
|
|
65
|
-
if (!fs.existsSync(COLYSEUS_CLOUD_BOOT_SERVICE)) {
|
|
65
|
+
if (!fs.existsSync(COLYSEUS_CLOUD_BOOT_SERVICE)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
66
68
|
|
|
67
69
|
const workingDirectory = pm2.cwd;
|
|
68
|
-
const execStart =
|
|
70
|
+
const execStart = `${detectPackageManager()} run colyseus-post-deploy`;
|
|
69
71
|
|
|
70
72
|
const contents = fs.readFileSync(COLYSEUS_CLOUD_BOOT_SERVICE, 'utf8');
|
|
71
|
-
|
|
72
73
|
try {
|
|
73
74
|
fs.writeFileSync(COLYSEUS_CLOUD_BOOT_SERVICE, contents
|
|
74
75
|
.replace(/WorkingDirectory=(.*)/, `WorkingDirectory=${workingDirectory}`)
|
|
@@ -120,6 +121,23 @@ function updateAndReloadNginx() {
|
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
123
|
|
|
124
|
+
function detectPackageManager() {
|
|
125
|
+
const lockfiles = {
|
|
126
|
+
npm: path.resolve(pm2.cwd, 'package-lock.json'),
|
|
127
|
+
yarn: path.resolve(pm2.cwd, 'yarn.lock'),
|
|
128
|
+
pnpm: path.resolve(pm2.cwd, 'pnpm-lock.yaml'),
|
|
129
|
+
bun: path.resolve(pm2.cwd, 'bun.lockb'),
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
for (const [key, value] of Object.entries(lockfiles)) {
|
|
133
|
+
if (fs.existsSync(value)) {
|
|
134
|
+
return key;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return "npm";
|
|
139
|
+
}
|
|
140
|
+
|
|
123
141
|
function bailOnErr(err) {
|
|
124
142
|
if (err) {
|
|
125
143
|
console.error(err);
|