@sequencemedia/minimserver 1.3.251 → 1.3.252
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/app.mjs +0 -34
- package/kill-me-now.mjs +25 -0
- package/package.json +6 -5
- package/where-am-i.mjs +9 -0
- package/babel.config.cjs +0 -14
package/app.mjs
CHANGED
|
@@ -8,8 +8,6 @@ import {
|
|
|
8
8
|
readFile
|
|
9
9
|
} from 'node:fs/promises'
|
|
10
10
|
|
|
11
|
-
import psList from 'ps-list'
|
|
12
|
-
|
|
13
11
|
import {
|
|
14
12
|
Command
|
|
15
13
|
} from 'commander'
|
|
@@ -28,9 +26,6 @@ const log = debug('@sequencemedia/minimserver')
|
|
|
28
26
|
|
|
29
27
|
log('`minimserver` is awake')
|
|
30
28
|
|
|
31
|
-
const NAME = 'ms.App'
|
|
32
|
-
process.title = NAME
|
|
33
|
-
|
|
34
29
|
const commander = new Command()
|
|
35
30
|
|
|
36
31
|
async function app () {
|
|
@@ -40,35 +35,6 @@ async function app () {
|
|
|
40
35
|
name
|
|
41
36
|
} = PACKAGE
|
|
42
37
|
|
|
43
|
-
/**
|
|
44
|
-
* Permit only one instance of the application
|
|
45
|
-
*/
|
|
46
|
-
try {
|
|
47
|
-
const a = (await psList())
|
|
48
|
-
.filter(({ name }) => name === NAME)
|
|
49
|
-
|
|
50
|
-
if (a.length > 1) {
|
|
51
|
-
const {
|
|
52
|
-
pid: PID
|
|
53
|
-
} = process
|
|
54
|
-
|
|
55
|
-
const {
|
|
56
|
-
pid
|
|
57
|
-
} = a.find(({ pid }) => pid !== PID)
|
|
58
|
-
|
|
59
|
-
const log = debug('@sequencemedia/minimserver:process')
|
|
60
|
-
|
|
61
|
-
log(`Killing application "${name}" in process ${pid}.`)
|
|
62
|
-
|
|
63
|
-
process.kill(pid)
|
|
64
|
-
}
|
|
65
|
-
} catch ({ message }) {
|
|
66
|
-
const error = debug('@sequencemedia/minimserver:process:error')
|
|
67
|
-
|
|
68
|
-
error(message)
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
|
|
72
38
|
const {
|
|
73
39
|
pid,
|
|
74
40
|
argv,
|
package/kill-me-now.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import debug from 'debug'
|
|
4
|
+
|
|
5
|
+
import killMeNow from 'kill-me-now'
|
|
6
|
+
|
|
7
|
+
import hereIAm from '#where-am-i'
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
env: {
|
|
11
|
+
DEBUG = '@sequencemedia/minimserver*'
|
|
12
|
+
}
|
|
13
|
+
} = process
|
|
14
|
+
|
|
15
|
+
if (DEBUG) debug.enable(DEBUG)
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
pid
|
|
19
|
+
} = process
|
|
20
|
+
|
|
21
|
+
const log = debug('@sequencemedia/minimserver:kill-me-now')
|
|
22
|
+
|
|
23
|
+
log('`minimserver` is awake')
|
|
24
|
+
|
|
25
|
+
export default killMeNow(hereIAm, pid, 'node')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequencemedia/minimserver",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.252",
|
|
4
4
|
"description": "Watch for changes to M3Us and rescan MinimServer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"minimserver",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/sequencemedia/minimserver/issues"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
+
"kill-me-now": "cross-env NODE_OPTIONS=\"--no-warnings\" NODE_ENV=production node kill-me-now.mjs",
|
|
37
38
|
"dev": "cross-env NODE_OPTIONS=\"--no-warnings\" NODE_ENV=development node .",
|
|
38
39
|
"lint": "eslint .",
|
|
39
40
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -49,15 +50,15 @@
|
|
|
49
50
|
"del": "^8.0.0",
|
|
50
51
|
"dotenv": "^16.5.0",
|
|
51
52
|
"fs-extra": "^11.3.0",
|
|
52
|
-
"
|
|
53
|
+
"kill-me-now": "^0.0.9"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
|
-
"@babel/core": "^7.27.1",
|
|
56
|
-
"@babel/preset-env": "^7.27.2",
|
|
57
56
|
"@sequencemedia/eslint-config-standard": "^0.2.56",
|
|
58
|
-
"core-js": "^3.42.0",
|
|
59
57
|
"eslint": "^9.26.0",
|
|
60
58
|
"globals": "^16.1.0",
|
|
61
59
|
"husky": "^9.1.7"
|
|
60
|
+
},
|
|
61
|
+
"imports": {
|
|
62
|
+
"#where-am-i": "./where-am-i.mjs"
|
|
62
63
|
}
|
|
63
64
|
}
|
package/where-am-i.mjs
ADDED