@qelos/api-kit 3.4.1 → 3.5.5
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/dist/shutdown.d.ts +1 -1
- package/dist/shutdown.js +26 -10
- package/dist/shutdown.js.map +1 -1
- package/package.json +2 -2
- package/src/shutdown.ts +23 -9
- package/CONTRIBUTING.md +0 -7
package/dist/shutdown.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare let shutdown: () => never;
|
|
1
|
+
declare let shutdown: (_code?: number) => never;
|
|
2
2
|
export default shutdown;
|
package/dist/shutdown.js
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
6
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
let shutdown = (_code) => {
|
|
4
9
|
process.exit();
|
|
5
10
|
};
|
|
6
11
|
if (process.env.NODE_ENV !== 'production') {
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
console.log('trying to require tmp file...');
|
|
13
|
+
try {
|
|
9
14
|
const cwd = process.cwd();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
const tempFolder = node_path_1.default.join(cwd, 'tmp');
|
|
16
|
+
const tempFile = node_path_1.default.join(tempFolder, 'tmp.js');
|
|
17
|
+
if (!node_fs_1.default.existsSync(tempFolder)) {
|
|
18
|
+
node_fs_1.default.mkdirSync(tempFolder);
|
|
19
|
+
}
|
|
20
|
+
if (!node_fs_1.default.existsSync(tempFile)) {
|
|
21
|
+
node_fs_1.default.writeFileSync(tempFile, '');
|
|
22
|
+
}
|
|
23
|
+
require(tempFile);
|
|
24
|
+
shutdown = (code) => {
|
|
25
|
+
if (code?.toString() === '1') {
|
|
26
|
+
node_fs_1.default.writeFileSync(tempFile, '');
|
|
14
27
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
28
|
+
process.exit();
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
console.error(err);
|
|
33
|
+
}
|
|
18
34
|
process.on('exit', shutdown);
|
|
19
35
|
}
|
|
20
36
|
globalThis.shutdown = shutdown;
|
package/dist/shutdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../src/shutdown.ts"],"names":[],"mappings":";;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,IAAI,QAAQ,GAAG,CAAC,KAAc,EAAE,EAAE;IAChC,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC,CAAC;AAEF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAA;IAC5C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,MAAM,UAAU,GAAG,mBAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACzC,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,iBAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;QAC1B,CAAC;QACD,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7B,iBAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC,CAAA;QAEjB,QAAQ,GAAG,CAAC,IAAsB,EAAE,EAAE;YACpC,IAAI,IAAI,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,CAAC;gBAC7B,iBAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;YAChC,CAAC;YACD,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC,CAAA;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACpB,CAAC;IAED,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAE/B,kBAAe,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qelos/api-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.5",
|
|
4
4
|
"description": "API-Kit package to help with qelos infrastructure and reuse capabilities across services",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"express": "^4.19.2",
|
|
19
19
|
"morgan": "^1.10.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "da6f1d89085777ae496b5da81d5e3bb0f038a43f",
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^20.12.8",
|
|
24
24
|
"typescript": "^5.4.5"
|
package/src/shutdown.ts
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
let shutdown = (_code?: number) => {
|
|
2
5
|
process.exit();
|
|
3
6
|
};
|
|
4
7
|
|
|
5
8
|
if (process.env.NODE_ENV !== 'production') {
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
console.log('trying to require tmp file...')
|
|
10
|
+
try {
|
|
8
11
|
const cwd = process.cwd();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const tempFolder = path.join(cwd, 'tmp');
|
|
13
|
+
const tempFile = path.join(tempFolder, 'tmp.js');
|
|
14
|
+
if (!fs.existsSync(tempFolder)) {
|
|
15
|
+
fs.mkdirSync(tempFolder)
|
|
16
|
+
}
|
|
17
|
+
if (!fs.existsSync(tempFile)) {
|
|
18
|
+
fs.writeFileSync(tempFile, '');
|
|
19
|
+
}
|
|
20
|
+
require(tempFile)
|
|
21
|
+
|
|
22
|
+
shutdown = (code?: number | string) => {
|
|
23
|
+
if (code?.toString() === '1') {
|
|
24
|
+
fs.writeFileSync(tempFile, '')
|
|
13
25
|
}
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
process.exit();
|
|
27
|
+
}
|
|
28
|
+
} catch (err) {
|
|
29
|
+
console.error(err)
|
|
16
30
|
}
|
|
17
31
|
|
|
18
32
|
process.on('exit', shutdown);
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Contribute to Greenpress api-kit
|
|
2
|
-
|
|
3
|
-
## Greenpress [Contribute Guide](https://docs.greenpress.info/guide/contribute/getting-started.html)
|
|
4
|
-
|
|
5
|
-
## Greenpress [Installation Guide](https://docs.greenpress.info/guide/getting-started.html)
|
|
6
|
-
|
|
7
|
-
## [Open Issues](https://github.com/greenpress/api-kit/issues)
|