backend-manager 3.2.176 → 3.2.178
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 +5 -5
- package/src/cli/cli.js +2 -2
- package/src/manager/server-manager.js +48 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backend-manager",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.178",
|
|
4
4
|
"description": "Quick tools for developing Firebase functions",
|
|
5
5
|
"main": "src/manager/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@firebase/rules-unit-testing": "^2.0.7",
|
|
45
|
-
"@google-cloud/storage": "^7.
|
|
45
|
+
"@google-cloud/storage": "^7.12.0",
|
|
46
46
|
"@octokit/rest": "^19.0.13",
|
|
47
47
|
"@sendgrid/mail": "^7.7.0",
|
|
48
48
|
"@sentry/node": "^6.19.7",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"cors": "^2.8.5",
|
|
53
53
|
"dotenv": "^16.4.5",
|
|
54
54
|
"express": "^4.19.2",
|
|
55
|
-
"firebase-admin": "^12.
|
|
55
|
+
"firebase-admin": "^12.3.0",
|
|
56
56
|
"firebase-functions": "^5.0.1",
|
|
57
57
|
"fs-jetpack": "^5.1.0",
|
|
58
58
|
"glob": "^11.0.0",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"moment": "^2.30.1",
|
|
70
70
|
"nanoid": "^3.3.7",
|
|
71
71
|
"node-fetch": "^2.7.0",
|
|
72
|
-
"node-powertools": "^1.
|
|
72
|
+
"node-powertools": "^1.5.7",
|
|
73
73
|
"npm-api": "^1.0.1",
|
|
74
74
|
"paypal-server-api": "^2.0.14",
|
|
75
75
|
"pushid": "^1.0.0",
|
|
76
76
|
"resolve-account": "^1.0.25",
|
|
77
|
-
"semver": "^7.6.
|
|
77
|
+
"semver": "^7.6.3",
|
|
78
78
|
"shortid": "^2.2.16",
|
|
79
79
|
"sizeitup": "^1.0.9",
|
|
80
80
|
"uid-generator": "^2.0.0",
|
package/src/cli/cli.js
CHANGED
|
@@ -101,14 +101,14 @@ Main.prototype.process = async function (args) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// Install local BEM
|
|
104
|
-
if ((self.options.i || self.options.install) && (self.options.
|
|
104
|
+
if ((self.options.i || self.options.install) && (self.options.dev || self.options.development) || self.options.local) {
|
|
105
105
|
await uninstallPkg('backend-manager');
|
|
106
106
|
// return await installPkg('file:../../../ITW-Creative-Works/backend-manager');
|
|
107
107
|
return await installPkg('file:/Users/ian/Developer/Repositories/ITW-Creative-Works/backend-manager');
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
// Install live BEM
|
|
111
|
-
if ((self.options.i || self.options.install) && (self.options.
|
|
111
|
+
if ((self.options.i || self.options.install) && (self.options.prod || self.options.production) || self.options.live) {
|
|
112
112
|
await uninstallPkg('backend-manager');
|
|
113
113
|
return await installPkg('backend-manager');
|
|
114
114
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const powertools = require('node-powertools');
|
|
2
|
+
const yargs = require('yargs/yargs');
|
|
3
|
+
const { hideBin } = require('yargs/helpers');
|
|
4
|
+
|
|
5
|
+
function ServerManager(command) {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
ServerManager.prototype.monitor = function (command, options) {
|
|
9
|
+
const self = this;
|
|
10
|
+
|
|
11
|
+
return new Promise(async function(resolve, reject) {
|
|
12
|
+
// Set the options
|
|
13
|
+
options = options || {};
|
|
14
|
+
options.log = options.log === undefined ? true : options.log;
|
|
15
|
+
|
|
16
|
+
// Set the command
|
|
17
|
+
self.command = command || yargs(hideBin(process.argv)).argv.command || 'npm start';
|
|
18
|
+
|
|
19
|
+
// Log
|
|
20
|
+
console.log('Starting server...', self.command);
|
|
21
|
+
|
|
22
|
+
// Start the server
|
|
23
|
+
await powertools.execute(self.command, options, (serverProcess) => {
|
|
24
|
+
serverProcess.on('exit', (code) => {
|
|
25
|
+
if (code !== 0) {
|
|
26
|
+
console.log('Server crashed. Restarting...');
|
|
27
|
+
|
|
28
|
+
// Restart the server
|
|
29
|
+
setTimeout(function () {
|
|
30
|
+
self.monitor();
|
|
31
|
+
}, 1000);
|
|
32
|
+
} else {
|
|
33
|
+
console.log('Server stopped manually.');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
})
|
|
37
|
+
.then((r) => resolve)
|
|
38
|
+
.catch((e) => reject);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// Check if the script is run directly from the command line
|
|
43
|
+
if (require.main === module) {
|
|
44
|
+
const manager = new ServerManager();
|
|
45
|
+
manager.monitor();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = ServerManager;
|