@sequencemedia/music-library 1.0.9 → 1.0.17
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 +10 -11
- package/build/gulp/common.mjs +0 -141
- package/build/gulp/post-commit.mjs +0 -21
- package/build/gulp/pre-commit.mjs +0 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequencemedia/music-library",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "Watch Apple Music Library XML and parse to JSON, JS, ES, or M3U",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"music",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"dev": "cross-env DEBUG=@sequencemedia/music-library,@sequencemedia/music-library:*,@sequencemedia/music-library-parser,@sequencemedia/music-library-parser:* NODE_ENV=development node .",
|
|
39
39
|
"gulp": "gulp --color",
|
|
40
40
|
"pre-commit": "npm run lint",
|
|
41
|
-
"post-commit": "
|
|
41
|
+
"post-commit": "npm run gulp -- post-commit",
|
|
42
42
|
"prepare": "husky install"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sequencemedia/music-library-parser": "1.0.
|
|
45
|
+
"@sequencemedia/music-library-parser": "1.0.11",
|
|
46
46
|
"chokidar": "^3.5.2",
|
|
47
47
|
"commander": "^8.3.0",
|
|
48
48
|
"cross-env": "^7.0.3",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"ps-list": "^8.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@babel/cli": "^7.16.
|
|
55
|
-
"@babel/core": "^7.16.
|
|
54
|
+
"@babel/cli": "^7.16.7",
|
|
55
|
+
"@babel/core": "^7.16.7",
|
|
56
56
|
"@babel/eslint-parser": "^7.16.5",
|
|
57
|
-
"@babel/plugin-proposal-export-default-from": "^7.16.
|
|
58
|
-
"@babel/plugin-proposal-export-namespace-from": "^7.16.
|
|
59
|
-
"@babel/preset-env": "^7.16.
|
|
60
|
-
"@sequencemedia/hooks": "^1.0.
|
|
57
|
+
"@babel/plugin-proposal-export-default-from": "^7.16.7",
|
|
58
|
+
"@babel/plugin-proposal-export-namespace-from": "^7.16.7",
|
|
59
|
+
"@babel/preset-env": "^7.16.7",
|
|
60
|
+
"@sequencemedia/hooks": "^1.0.1",
|
|
61
61
|
"core-js": "^3.20.1",
|
|
62
62
|
"eslint": "7.32.0",
|
|
63
63
|
"eslint-config-standard": "^16.0.3",
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
"#music-library/watch/library/playlists": "./src/watch/library/playlists/index.mjs",
|
|
82
82
|
"#music-library/watch/library/playlists/transform": "./src/watch/library/playlists/transform/index.mjs",
|
|
83
83
|
"#music-library/watch/library/tracks": "./src/watch/library/tracks/index.mjs",
|
|
84
|
-
"#music-library/watch/library/tracks/transform": "./src/watch/library/tracks/transform/index.mjs"
|
|
85
|
-
"#build/gulp/*": "./build/gulp/*.mjs"
|
|
84
|
+
"#music-library/watch/library/tracks/transform": "./src/watch/library/tracks/transform/index.mjs"
|
|
86
85
|
}
|
|
87
86
|
}
|
package/build/gulp/common.mjs
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import debug from 'debug'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
exec
|
|
5
|
-
} from 'child_process'
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
readFile
|
|
9
|
-
} from 'fs/promises'
|
|
10
|
-
|
|
11
|
-
const log = debug('@sequencemedia/music-library:build:gulp:common')
|
|
12
|
-
|
|
13
|
-
export const PACKAGE_VERSION_CHANGES = /\-+\s+"version":\s+"(\d+\.\d+\.\d+)",+\s+\++\s+"version":\s+"(\d+\.\d+\.\d+)",+\s+/ /* eslint-disable-line no-useless-escape */
|
|
14
|
-
|
|
15
|
-
export const HAS_STAGED_CHANGES = /Changes to be committed/s
|
|
16
|
-
|
|
17
|
-
export const NOT_STAGED_CHANGES = /Changes not staged for commit/s
|
|
18
|
-
|
|
19
|
-
export const OPTIONS = {
|
|
20
|
-
maxBuffer: 1024 * 500
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const BRANCH = 'master'
|
|
24
|
-
|
|
25
|
-
export const trim = (v) => v.split('\n').map((v) => v.trimEnd()).join('\n').trim()
|
|
26
|
-
|
|
27
|
-
export function use (key) {
|
|
28
|
-
const log = debug(`@sequencemedia/music-library:${key}`)
|
|
29
|
-
|
|
30
|
-
return function use (v) {
|
|
31
|
-
log(trim(v))
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function getGitRemoteShowOriginHeadBranch () {
|
|
36
|
-
log('getGitRemoteShowOriginHeadBranch')
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
new Promise((resolve, reject) => {
|
|
40
|
-
const command = 'git remote show origin | awk \'/HEAD branch/ {print $NF}\''
|
|
41
|
-
|
|
42
|
-
const {
|
|
43
|
-
stdout,
|
|
44
|
-
stderr
|
|
45
|
-
} = exec(command, OPTIONS, (e, v = '') => (!e) ? resolve(trim(v)) : reject(e))
|
|
46
|
-
|
|
47
|
-
stdout.on('data', use('git-remote-show-origin-head-branch'))
|
|
48
|
-
stderr.on('data', use('git-remote-show-origin-head-branch'))
|
|
49
|
-
})
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function hasPackageVersionChanges (branch = BRANCH) {
|
|
54
|
-
log('hasPackageVersionChanges')
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
new Promise((resolve, reject) => {
|
|
58
|
-
exec(`git diff HEAD origin/${branch} package.json`, OPTIONS, (e, v) => (!e) ? resolve(PACKAGE_VERSION_CHANGES.test(v)) : reject(e))
|
|
59
|
-
})
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function notPackageVersionChanges (branch = BRANCH) {
|
|
64
|
-
log('notPackageVersionChanges')
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
new Promise((resolve, reject) => {
|
|
68
|
-
exec(`git diff HEAD origin/${branch} package.json`, OPTIONS, (e, v) => (!e) ? resolve(PACKAGE_VERSION_CHANGES.test(v) !== true) : reject(e))
|
|
69
|
-
})
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function addPackageVersionChanges () {
|
|
74
|
-
log('addPackageVersionChanges')
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
new Promise((resolve, reject) => {
|
|
78
|
-
exec('git add package.json package-lock.json', OPTIONS, (e) => (!e) ? resolve() : reject(e))
|
|
79
|
-
})
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function hasStagedChanges () {
|
|
84
|
-
log('hasStagedChanges')
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
new Promise((resolve, reject) => {
|
|
88
|
-
exec('git status', OPTIONS, (e, v) => (!e) ? resolve(HAS_STAGED_CHANGES.test(v)) : reject(e))
|
|
89
|
-
})
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function notStagedChanges () {
|
|
94
|
-
log('notStagedChanges')
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
new Promise((resolve, reject) => {
|
|
98
|
-
exec('git status', OPTIONS, (e, v) => (!e) ? resolve(NOT_STAGED_CHANGES.test(v)) : reject(e))
|
|
99
|
-
})
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export function notPushedChanges (branch = BRANCH) {
|
|
104
|
-
log('notPushedChanges')
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
new Promise((resolve, reject) => {
|
|
108
|
-
exec(`git log origin/${branch}..HEAD`, OPTIONS, (e, v) => (!e) ? resolve(!!v) : reject(e))
|
|
109
|
-
})
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export async function getPackageVersion () {
|
|
114
|
-
log('getPackageVersion')
|
|
115
|
-
|
|
116
|
-
const {
|
|
117
|
-
version = '0.0.0'
|
|
118
|
-
} = JSON.parse(await readFile('./package.json', 'utf8'))
|
|
119
|
-
|
|
120
|
-
return version
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export function patchPackageVersion () {
|
|
124
|
-
log('patchPackageVersion')
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
new Promise((resolve, reject) => {
|
|
128
|
-
exec('npm version patch -m %s -n --no-git-tag-version --no-verify', OPTIONS, (e) => (!e) ? resolve() : reject(e))
|
|
129
|
-
})
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export function gitTag (a = '0.0.0', m = `v${a}`) {
|
|
134
|
-
log('gitTag')
|
|
135
|
-
|
|
136
|
-
return (
|
|
137
|
-
new Promise((resolve, reject) => {
|
|
138
|
-
exec(`git tag -a v${a} -m "${m}"`, OPTIONS, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
139
|
-
})
|
|
140
|
-
)
|
|
141
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import debug from 'debug'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getPackageVersion,
|
|
5
|
-
gitTag
|
|
6
|
-
} from '#build/gulp/common'
|
|
7
|
-
|
|
8
|
-
const log = debug('@sequencemedia/music-library:build:gulp:post-commit')
|
|
9
|
-
const error = debug('@sequencemedia/music-library:build:gulp:post-commit:error')
|
|
10
|
-
|
|
11
|
-
log('`@sequencemedia/music-library` is awake')
|
|
12
|
-
|
|
13
|
-
export default async function postCommit () {
|
|
14
|
-
log('post-commit')
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
await gitTag(await getPackageVersion())
|
|
18
|
-
} catch ({ code = 'NONE', message = 'No error message defined' }) {
|
|
19
|
-
error({ code, message })
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import debug from 'debug'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
notStagedChanges,
|
|
5
|
-
hasStagedChanges,
|
|
6
|
-
getGitRemoteShowOriginHeadBranch,
|
|
7
|
-
notPackageVersionChanges,
|
|
8
|
-
patchPackageVersion,
|
|
9
|
-
addPackageVersionChanges
|
|
10
|
-
} from '#build/gulp/common'
|
|
11
|
-
|
|
12
|
-
const log = debug('@sequencemedia/music-library:build:gulp:pre-commit')
|
|
13
|
-
const error = debug('@sequencemedia/music-library:build:gulp:pre-commit:error')
|
|
14
|
-
|
|
15
|
-
log('`@sequencemedia/music-library` is awake')
|
|
16
|
-
|
|
17
|
-
export default async function preCommit () {
|
|
18
|
-
log('pre-commit')
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
/**
|
|
22
|
-
* Not changes added, exit
|
|
23
|
-
*/
|
|
24
|
-
if (await notStagedChanges()) return
|
|
25
|
-
/**
|
|
26
|
-
* Has changes added, continue
|
|
27
|
-
*/
|
|
28
|
-
if (await hasStagedChanges()) {
|
|
29
|
-
/**
|
|
30
|
-
* Not package version changes, continue
|
|
31
|
-
*/
|
|
32
|
-
if (await notPackageVersionChanges(await getGitRemoteShowOriginHeadBranch())) {
|
|
33
|
-
await patchPackageVersion()
|
|
34
|
-
await addPackageVersionChanges()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
} catch ({ code = 'NONE', message = 'No error message defined' }) {
|
|
38
|
-
error({ code, message })
|
|
39
|
-
}
|
|
40
|
-
}
|