@sequencemedia/music-library 1.1.147 → 1.1.149

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 CHANGED
@@ -2,32 +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 'fs/promises'
10
8
 
11
- import psList from 'ps-list'
12
-
13
9
  import {
14
10
  Command
15
11
  } from 'commander'
16
12
 
13
+ import debug from '#debug'
14
+
17
15
  import {
18
16
  DEFAULT_ERROR_MESSAGE
19
17
  } from '#music-library/common'
20
18
 
21
19
  import * as watch from '#music-library/watch'
22
20
 
23
- const {
24
- env: {
25
- DEBUG = '@sequencemedia/music-library*,@sequencemedia/music-library-parser*'
26
- }
27
- } = process
28
-
29
- if (DEBUG) debug.enable(DEBUG)
30
-
31
21
  const {
32
22
  library,
33
23
  library: {
@@ -42,9 +32,6 @@ log('`music-library` is awake')
42
32
 
43
33
  const commander = new Command()
44
34
 
45
- const NAME = 'ml.App'
46
- process.title = NAME
47
-
48
35
  async function app () {
49
36
  const PACKAGE = JSON.parse(await readFile('./package.json', 'utf8'))
50
37
 
@@ -52,37 +39,6 @@ async function app () {
52
39
  name
53
40
  } = PACKAGE
54
41
 
55
- /**
56
- * Permit only one instance of the application
57
- */
58
- try {
59
- const a = (await psList())
60
- .filter(({ name }) => name === NAME)
61
-
62
- if (a.length > 1) {
63
- const {
64
- pid: PID
65
- } = process
66
-
67
- const {
68
- pid
69
- } = a.find(({ pid }) => pid !== PID)
70
-
71
- const log = debug('@sequencemedia/music-library:process')
72
-
73
- log(`Killing application "${name}" in process ${pid}.`)
74
-
75
- process.kill(pid)
76
- }
77
- } catch ({
78
- message = DEFAULT_ERROR_MESSAGE
79
- }) {
80
- const error = debug('@sequencemedia/music-library:process:error')
81
-
82
- error(message)
83
- return
84
- }
85
-
86
42
  const {
87
43
  pid,
88
44
  argv,
@@ -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/music-library:kill-me-now')
14
+
15
+ log('`music-library` is awake')
16
+
17
+ export default killMeNow(hereIAm, pid, 'node')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequencemedia/music-library",
3
- "version": "1.1.147",
3
+ "version": "1.1.149",
4
4
  "description": "Watch Apple Music Library XML and parse to JSON, JS, ES, or M3U",
5
5
  "keywords": [
6
6
  "music",
@@ -36,6 +36,7 @@
36
36
  "url": "https://github.com/sequencemedia/music-library/issues"
37
37
  },
38
38
  "scripts": {
39
+ "kill-me-now": "cross-env NODE_OPTIONS=\"--no-warnings\" NODE_ENV=production node kill-me-now.mjs",
39
40
  "dev": "cross-env NODE_ENV=development node .",
40
41
  "lint": "eslint .",
41
42
  "lint:fix": "npm run lint -- --fix",
@@ -43,27 +44,26 @@
43
44
  "start": "cross-env NODE_OPTIONS=\"--no-warnings\" NODE_ENV=production node ."
44
45
  },
45
46
  "dependencies": {
46
- "@sequencemedia/music-library-parser": "1.1.103",
47
+ "@sequencemedia/music-library-parser": "1.1.104",
47
48
  "chokidar": "^4.0.3",
48
49
  "commander": "^13.1.0",
49
50
  "cross-env": "^7.0.3",
50
51
  "debug": "^4.4.0",
51
52
  "dotenv": "^16.5.0",
52
- "ps-list": "^8.1.1"
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
- "@sequencemedia/eslint-config-standard": "^0.2.55",
58
- "core-js": "^3.42.0",
56
+ "@sequencemedia/eslint-config-standard": "^0.2.56",
59
57
  "eslint": "^9.26.0",
60
- "globals": "^16.0.0",
58
+ "globals": "^16.1.0",
61
59
  "husky": "^9.1.7"
62
60
  },
63
61
  "imports": {
64
62
  "#music-library": "./src/index.mjs",
65
63
  "#music-library/*": "./src/*/index.mjs",
66
64
  "#music-library/common": "./src/common/index.mjs",
67
- "#music-library/common/*": "./src/common/*.mjs"
65
+ "#music-library/common/*": "./src/common/*.mjs",
66
+ "#where-am-i": "./where-am-i.mjs",
67
+ "#debug": "./src/debug.mjs"
68
68
  }
69
69
  }
package/src/debug.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import debug from 'debug'
2
+
3
+ const {
4
+ env: {
5
+ DEBUG = '@sequencemedia/music-library*'
6
+ }
7
+ } = process
8
+
9
+ if (DEBUG) debug.enable(DEBUG)
10
+
11
+ export default debug
package/where-am-i.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ dirname
3
+ } from 'node:path'
4
+
5
+ import {
6
+ fileURLToPath
7
+ } from 'node:url'
8
+
9
+ export default dirname(fileURLToPath(import.meta.url))
package/babel.config.cjs DELETED
@@ -1,14 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- [
4
- '@babel/env',
5
- {
6
- targets: {
7
- node: 'current'
8
- },
9
- useBuiltIns: 'usage',
10
- corejs: 3
11
- }
12
- ]
13
- ]
14
- }