@sequencemedia/music-library 1.0.5 → 1.0.6
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/.husky/post-commit +4 -0
- package/build/gulp/post-commit.mjs +48 -0
- package/build/gulp/pre-commit.mjs +2 -2
- package/gulpfile.mjs +4 -0
- package/package.json +2 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import debug from 'debug'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
readFile
|
|
5
|
+
} from 'fs/promises'
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
exec
|
|
9
|
+
} from 'child_process'
|
|
10
|
+
|
|
11
|
+
const OPTIONS = {
|
|
12
|
+
maxBuffer: 1024 * 500
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const log = debug('@sequencemedia/music-library:build:gulp:post-commit')
|
|
16
|
+
const error = debug('@sequencemedia/music-library:build:gulp:post-commit:error')
|
|
17
|
+
|
|
18
|
+
log('`@sequencemedia/music-library` is awake')
|
|
19
|
+
|
|
20
|
+
export async function getPackageVersion () {
|
|
21
|
+
log('getPackageVersion')
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
version = '0.0.0'
|
|
25
|
+
} = JSON.parse(await readFile('./package.json', 'utf8'))
|
|
26
|
+
|
|
27
|
+
return version
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function gitTag (a = '0.0.0', m = `v${a}`) {
|
|
31
|
+
log('gitTag')
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
new Promise((resolve, reject) => {
|
|
35
|
+
exec(`git tag -a v${a} -m "${m}"`, OPTIONS, (e, v) => (!e) ? resolve(v) : reject(e))
|
|
36
|
+
})
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default async function postCommit () {
|
|
41
|
+
log('post-commit')
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
await gitTag(await getPackageVersion())
|
|
45
|
+
} catch ({ code = 'NONE', message = 'No error message defined' }) {
|
|
46
|
+
error({ code, message })
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -23,14 +23,14 @@ const BRANCH = 'master'
|
|
|
23
23
|
const trim = (v) => v.split('\n').map((v) => v.trimEnd()).join('\n').trim()
|
|
24
24
|
|
|
25
25
|
function use (key) {
|
|
26
|
-
const log = debug(`@
|
|
26
|
+
const log = debug(`@sequencemedia/music-library:${key}`)
|
|
27
27
|
|
|
28
28
|
return function use (v) {
|
|
29
29
|
log(trim(v))
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function getGitRemoteShowOriginHeadBranch () {
|
|
33
|
+
export function getGitRemoteShowOriginHeadBranch () {
|
|
34
34
|
log('getGitRemoteShowOriginHeadBranch')
|
|
35
35
|
|
|
36
36
|
return (
|
package/gulpfile.mjs
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import gulp from 'gulp'
|
|
2
2
|
|
|
3
3
|
import preCommit from '#build/gulp/pre-commit'
|
|
4
|
+
import postCommit from '#build/gulp/post-commit'
|
|
4
5
|
|
|
5
6
|
gulp
|
|
6
7
|
.task('pre-commit', preCommit)
|
|
7
8
|
|
|
9
|
+
gulp
|
|
10
|
+
.task('post-commit', postCommit)
|
|
11
|
+
|
|
8
12
|
gulp
|
|
9
13
|
.task('default', gulp.series('pre-commit'))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequencemedia/music-library",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Watch Apple Music Library XML and parse to JSON, JS, ES, or M3U",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"music",
|
|
@@ -38,6 +38,7 @@
|
|
|
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 && cross-env DEBUG=@sequencemedia/music-library,@sequencemedia/music-library:* npm run gulp -- pre-commit",
|
|
41
|
+
"post-commit": "cross-env DEBUG=@sequencemedia/music-library,@sequencemedia/music-library:* npm run gulp -- post-commit",
|
|
41
42
|
"prepare": "husky install"
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|