@sequencemedia/minimserver 1.3.251 → 1.3.253
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 +2 -44
- package/kill-me-now.mjs +17 -0
- package/package.json +7 -5
- package/src/debug.mjs +11 -0
- package/where-am-i.mjs +9 -0
- package/babel.config.cjs +0 -14
package/app.mjs
CHANGED
|
@@ -2,35 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
import 'dotenv/config'
|
|
4
4
|
|
|
5
|
-
import debug from 'debug'
|
|
6
|
-
|
|
7
5
|
import {
|
|
8
6
|
readFile
|
|
9
7
|
} from 'node:fs/promises'
|
|
10
8
|
|
|
11
|
-
import psList from 'ps-list'
|
|
12
|
-
|
|
13
9
|
import {
|
|
14
10
|
Command
|
|
15
11
|
} from 'commander'
|
|
16
12
|
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
env: {
|
|
21
|
-
DEBUG = '@sequencemedia/minimserver*'
|
|
22
|
-
}
|
|
23
|
-
} = process
|
|
13
|
+
import debug from '#debug'
|
|
24
14
|
|
|
25
|
-
|
|
15
|
+
import minimServer from './src/index.mjs'
|
|
26
16
|
|
|
27
17
|
const log = debug('@sequencemedia/minimserver')
|
|
28
18
|
|
|
29
19
|
log('`minimserver` is awake')
|
|
30
20
|
|
|
31
|
-
const NAME = 'ms.App'
|
|
32
|
-
process.title = NAME
|
|
33
|
-
|
|
34
21
|
const commander = new Command()
|
|
35
22
|
|
|
36
23
|
async function app () {
|
|
@@ -40,35 +27,6 @@ async function app () {
|
|
|
40
27
|
name
|
|
41
28
|
} = PACKAGE
|
|
42
29
|
|
|
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
30
|
const {
|
|
73
31
|
pid,
|
|
74
32
|
argv,
|
package/kill-me-now.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import killMeNow from 'kill-me-now'
|
|
4
|
+
|
|
5
|
+
import debug from '#debug'
|
|
6
|
+
|
|
7
|
+
import hereIAm from '#where-am-i'
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
pid
|
|
11
|
+
} = process
|
|
12
|
+
|
|
13
|
+
const log = debug('@sequencemedia/minimserver:kill-me-now')
|
|
14
|
+
|
|
15
|
+
log('`minimserver` is awake')
|
|
16
|
+
|
|
17
|
+
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.253",
|
|
4
4
|
"description": "Watch for changes to M3Us and rescan MinimServer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"minimserver",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "cross-env NODE_OPTIONS=\"--no-warnings\" NODE_ENV=development node .",
|
|
38
|
+
"kill-me-now": "cross-env NODE_OPTIONS=\"--no-warnings\" NODE_ENV=production node kill-me-now.mjs",
|
|
38
39
|
"lint": "eslint .",
|
|
39
40
|
"lint:fix": "npm run lint -- --fix",
|
|
40
41
|
"prepare": "husky",
|
|
@@ -49,15 +50,16 @@
|
|
|
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
|
+
"#debug": "./debug.mjs",
|
|
63
|
+
"#where-am-i": "./where-am-i.mjs"
|
|
62
64
|
}
|
|
63
65
|
}
|
package/src/debug.mjs
ADDED
package/where-am-i.mjs
ADDED