music-routes-data 1.0.7 → 1.1.0
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/README.md +0 -2
- package/data/artist_track.json +4 -0
- package/data/artists.json +6 -0
- package/data/individual_artist.json +4 -0
- package/data/individual_track.json +15 -7
- package/data/individuals.json +6 -0
- package/data/releases.json +6 -0
- package/data/track_release.json +4 -0
- package/data/tracks.json +6 -0
- package/lib/Data/index.js +64 -69
- package/lib/cli/add.js +2 -2
- package/lib/cli/argv.js +41 -43
- package/lib/cli/index.js +4 -4
- package/lib/cli/link.js +11 -11
- package/lib/cli/search.js +6 -6
- package/package.json +34 -13
package/README.md
CHANGED
package/data/artist_track.json
CHANGED
|
@@ -54778,5 +54778,9 @@
|
|
|
54778
54778
|
{
|
|
54779
54779
|
"artist_id": "413",
|
|
54780
54780
|
"track_id": "13477"
|
|
54781
|
+
},
|
|
54782
|
+
{
|
|
54783
|
+
"artist_id": "1767",
|
|
54784
|
+
"track_id": "13478"
|
|
54781
54785
|
}
|
|
54782
54786
|
]
|
package/data/artists.json
CHANGED
|
@@ -10424,5 +10424,11 @@
|
|
|
10424
10424
|
"names": [
|
|
10425
10425
|
"Back Street Crawler"
|
|
10426
10426
|
]
|
|
10427
|
+
},
|
|
10428
|
+
{
|
|
10429
|
+
"_id": "1767",
|
|
10430
|
+
"names": [
|
|
10431
|
+
"Joel Frahm"
|
|
10432
|
+
]
|
|
10427
10433
|
}
|
|
10428
10434
|
]
|
|
@@ -19374,5 +19374,9 @@
|
|
|
19374
19374
|
{
|
|
19375
19375
|
"artist_id": "1766",
|
|
19376
19376
|
"individual_id": "1960"
|
|
19377
|
+
},
|
|
19378
|
+
{
|
|
19379
|
+
"individual_id": "11050",
|
|
19380
|
+
"artist_id": "1767"
|
|
19377
19381
|
}
|
|
19378
19382
|
]
|
|
@@ -257171,7 +257171,7 @@
|
|
|
257171
257171
|
"track_id": "13475",
|
|
257172
257172
|
"individual_id": "4668"
|
|
257173
257173
|
},
|
|
257174
|
-
|
|
257174
|
+
{
|
|
257175
257175
|
"track_id": "13475",
|
|
257176
257176
|
"individual_id": "11041"
|
|
257177
257177
|
},
|
|
@@ -257199,7 +257199,7 @@
|
|
|
257199
257199
|
"track_id": "13476",
|
|
257200
257200
|
"individual_id": "11047"
|
|
257201
257201
|
},
|
|
257202
|
-
|
|
257202
|
+
{
|
|
257203
257203
|
"track_id": "13476",
|
|
257204
257204
|
"individual_id": "1960"
|
|
257205
257205
|
},
|
|
@@ -257219,11 +257219,11 @@
|
|
|
257219
257219
|
"track_id": "13477",
|
|
257220
257220
|
"individual_id": "6058"
|
|
257221
257221
|
},
|
|
257222
|
-
|
|
257222
|
+
{
|
|
257223
257223
|
"track_id": "13477",
|
|
257224
257224
|
"individual_id": "11048"
|
|
257225
257225
|
},
|
|
257226
|
-
|
|
257226
|
+
{
|
|
257227
257227
|
"track_id": "13477",
|
|
257228
257228
|
"individual_id": "11049"
|
|
257229
257229
|
},
|
|
@@ -257239,7 +257239,7 @@
|
|
|
257239
257239
|
"track_id": "13477",
|
|
257240
257240
|
"individual_id": "6109"
|
|
257241
257241
|
},
|
|
257242
|
-
|
|
257242
|
+
{
|
|
257243
257243
|
"track_id": "13477",
|
|
257244
257244
|
"individual_id": "6112"
|
|
257245
257245
|
},
|
|
@@ -257247,16 +257247,24 @@
|
|
|
257247
257247
|
"track_id": "13477",
|
|
257248
257248
|
"individual_id": "405"
|
|
257249
257249
|
},
|
|
257250
|
-
|
|
257250
|
+
{
|
|
257251
257251
|
"track_id": "13477",
|
|
257252
257252
|
"individual_id": "3190"
|
|
257253
257253
|
},
|
|
257254
|
-
|
|
257254
|
+
{
|
|
257255
257255
|
"track_id": "13477",
|
|
257256
257256
|
"individual_id": "1392"
|
|
257257
257257
|
},
|
|
257258
257258
|
{
|
|
257259
257259
|
"track_id": "13477",
|
|
257260
257260
|
"individual_id": "1393"
|
|
257261
|
+
},
|
|
257262
|
+
{
|
|
257263
|
+
"individual_id": "11050",
|
|
257264
|
+
"track_id": "13478"
|
|
257265
|
+
},
|
|
257266
|
+
{
|
|
257267
|
+
"individual_id": "8600",
|
|
257268
|
+
"track_id": "13478"
|
|
257261
257269
|
}
|
|
257262
257270
|
]
|
package/data/individuals.json
CHANGED
|
@@ -62967,5 +62967,11 @@
|
|
|
62967
62967
|
"names": [
|
|
62968
62968
|
"Vincent Bonham"
|
|
62969
62969
|
]
|
|
62970
|
+
},
|
|
62971
|
+
{
|
|
62972
|
+
"_id": "11050",
|
|
62973
|
+
"names": [
|
|
62974
|
+
"Joel Frahm"
|
|
62975
|
+
]
|
|
62970
62976
|
}
|
|
62971
62977
|
]
|
package/data/releases.json
CHANGED
|
@@ -14747,5 +14747,11 @@
|
|
|
14747
14747
|
"names": [
|
|
14748
14748
|
"2nd Street"
|
|
14749
14749
|
]
|
|
14750
|
+
},
|
|
14751
|
+
{
|
|
14752
|
+
"_id": "2483",
|
|
14753
|
+
"names": [
|
|
14754
|
+
"Don't Explain"
|
|
14755
|
+
]
|
|
14750
14756
|
}
|
|
14751
14757
|
]
|
package/data/track_release.json
CHANGED
|
@@ -54286,5 +54286,9 @@
|
|
|
54286
54286
|
{
|
|
54287
54287
|
"track_id": "13477",
|
|
54288
54288
|
"release_id": "1242"
|
|
54289
|
+
},
|
|
54290
|
+
{
|
|
54291
|
+
"release_id": "2483",
|
|
54292
|
+
"track_id": "13478"
|
|
54289
54293
|
}
|
|
54290
54294
|
]
|
package/data/tracks.json
CHANGED
|
@@ -80063,5 +80063,11 @@
|
|
|
80063
80063
|
"names": [
|
|
80064
80064
|
"Hummingbird"
|
|
80065
80065
|
]
|
|
80066
|
+
},
|
|
80067
|
+
{
|
|
80068
|
+
"_id": "13478",
|
|
80069
|
+
"names": [
|
|
80070
|
+
"Don't Explain"
|
|
80071
|
+
]
|
|
80066
80072
|
}
|
|
80067
80073
|
]
|
package/lib/Data/index.js
CHANGED
|
@@ -1,154 +1,149 @@
|
|
|
1
|
-
|
|
1
|
+
const fs = require('fs')
|
|
2
2
|
|
|
3
3
|
function Data (options) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const data = {}
|
|
5
|
+
const collectionFields = {
|
|
6
6
|
tracks: ['names'],
|
|
7
7
|
artists: ['names'],
|
|
8
8
|
individuals: ['names'],
|
|
9
9
|
releases: ['names']
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const linkCollectionFields = {
|
|
13
13
|
artist_track: [],
|
|
14
14
|
individual_artist: [],
|
|
15
15
|
individual_track: [],
|
|
16
16
|
track_release: []
|
|
17
|
-
}
|
|
17
|
+
}
|
|
18
18
|
|
|
19
|
-
this.dataCollections = Object.freeze(Object.keys(collectionFields))
|
|
20
|
-
this.linkCollections = Object.freeze(Object.keys(linkCollectionFields))
|
|
19
|
+
this.dataCollections = Object.freeze(Object.keys(collectionFields))
|
|
20
|
+
this.linkCollections = Object.freeze(Object.keys(linkCollectionFields))
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const collections = this.dataCollections.concat(this.linkCollections)
|
|
23
23
|
collections.forEach(function (value) {
|
|
24
|
-
data[value] = []
|
|
25
|
-
})
|
|
24
|
+
data[value] = []
|
|
25
|
+
})
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
return { status: status, message: message }
|
|
29
|
-
}
|
|
27
|
+
const makeReturnValue = function (status, message) {
|
|
28
|
+
return { status: status, message: message }
|
|
29
|
+
}
|
|
30
30
|
|
|
31
|
-
this.StatusEnum = Object.freeze({ OK: 0, ERROR: 1 })
|
|
31
|
+
this.StatusEnum = Object.freeze({ OK: 0, ERROR: 1 })
|
|
32
32
|
|
|
33
33
|
this.search = function (options) {
|
|
34
|
-
var rv;
|
|
35
|
-
var collection;
|
|
36
|
-
var filterCallback;
|
|
37
|
-
var results;
|
|
38
|
-
|
|
39
34
|
if (typeof options === 'undefined') {
|
|
40
|
-
return makeReturnValue(this.StatusEnum.ERROR, 'options must be specified')
|
|
35
|
+
return makeReturnValue(this.StatusEnum.ERROR, 'options must be specified')
|
|
41
36
|
}
|
|
42
37
|
|
|
43
|
-
collection = options.collection
|
|
38
|
+
const collection = options.collection
|
|
44
39
|
|
|
45
40
|
if (typeof collection === 'undefined') {
|
|
46
|
-
return makeReturnValue(this.StatusEnum.ERROR, 'collection is a required option.')
|
|
41
|
+
return makeReturnValue(this.StatusEnum.ERROR, 'collection is a required option.')
|
|
47
42
|
}
|
|
48
43
|
|
|
49
44
|
if (collections.indexOf(collection) === -1) {
|
|
50
|
-
return makeReturnValue(this.StatusEnum.ERROR, 'collection ' + collection + ' does not exist.')
|
|
45
|
+
return makeReturnValue(this.StatusEnum.ERROR, 'collection ' + collection + ' does not exist.')
|
|
51
46
|
}
|
|
52
47
|
|
|
53
48
|
// If no filterCallback sent, return everything
|
|
54
|
-
filterCallback = options.filterCallback || function (value) { return true
|
|
49
|
+
const filterCallback = options.filterCallback || function (value) { return true }
|
|
55
50
|
|
|
56
51
|
if (typeof filterCallback !== 'function') {
|
|
57
|
-
return makeReturnValue(this.StatusEnum.ERROR, 'filterCallback must be a function, got ' + typeof filterCallback)
|
|
52
|
+
return makeReturnValue(this.StatusEnum.ERROR, 'filterCallback must be a function, got ' + typeof filterCallback)
|
|
58
53
|
}
|
|
59
54
|
|
|
60
|
-
results = data[collection].filter(filterCallback)
|
|
55
|
+
const results = data[collection].filter(filterCallback)
|
|
61
56
|
|
|
62
|
-
rv = makeReturnValue(this.StatusEnum.OK, '')
|
|
63
|
-
rv.results = results
|
|
64
|
-
return rv
|
|
65
|
-
}
|
|
57
|
+
const rv = makeReturnValue(this.StatusEnum.OK, '')
|
|
58
|
+
rv.results = results
|
|
59
|
+
return rv
|
|
60
|
+
}
|
|
66
61
|
|
|
67
62
|
this.create = function (collection, entry) {
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
const newEntry = {}
|
|
64
|
+
let isFieldMissing = false
|
|
70
65
|
|
|
71
66
|
if (this.dataCollections.indexOf(collection) === -1) {
|
|
72
|
-
return makeReturnValue(this.StatusEnum.ERROR, 'Collection does not exist: ' + collection)
|
|
67
|
+
return makeReturnValue(this.StatusEnum.ERROR, 'Collection does not exist: ' + collection)
|
|
73
68
|
}
|
|
74
69
|
|
|
75
70
|
if (!entry._id) {
|
|
76
|
-
return makeReturnValue(this.StatusEnum.ERROR, 'Missing _id')
|
|
71
|
+
return makeReturnValue(this.StatusEnum.ERROR, 'Missing _id')
|
|
77
72
|
}
|
|
78
73
|
|
|
79
74
|
if (typeof entry._id !== 'string') {
|
|
80
|
-
return makeReturnValue(this.StatusEnum.ERROR, '_id must be a string, got ' + typeof entry._id)
|
|
75
|
+
return makeReturnValue(this.StatusEnum.ERROR, '_id must be a string, got ' + typeof entry._id)
|
|
81
76
|
}
|
|
82
77
|
|
|
83
78
|
// Check if _id already exists. It should not.
|
|
84
|
-
if (data[collection].filter(function (value) { return value._id === entry._id
|
|
85
|
-
return makeReturnValue(this.StatusEnum.ERROR, '_id ' + entry._id + ' already exists')
|
|
79
|
+
if (data[collection].filter(function (value) { return value._id === entry._id }).length > 0) {
|
|
80
|
+
return makeReturnValue(this.StatusEnum.ERROR, '_id ' + entry._id + ' already exists')
|
|
86
81
|
}
|
|
87
82
|
|
|
88
|
-
newEntry._id = entry._id
|
|
83
|
+
newEntry._id = entry._id
|
|
89
84
|
|
|
90
85
|
collectionFields[collection].forEach(function (field) {
|
|
91
86
|
if (!entry[field]) {
|
|
92
|
-
isFieldMissing = true
|
|
93
|
-
return
|
|
87
|
+
isFieldMissing = true
|
|
88
|
+
return
|
|
94
89
|
}
|
|
95
90
|
|
|
96
91
|
if (!(entry[field] instanceof Array)) {
|
|
97
|
-
isFieldMissing = true
|
|
98
|
-
return
|
|
92
|
+
isFieldMissing = true
|
|
93
|
+
return
|
|
99
94
|
}
|
|
100
95
|
|
|
101
96
|
// If some element in field array is not a string, reject the entry.
|
|
102
|
-
if (entry[field].some(function (value) { return typeof value !== 'string'
|
|
103
|
-
isFieldMissing = true
|
|
104
|
-
return
|
|
97
|
+
if (entry[field].some(function (value) { return typeof value !== 'string' })) {
|
|
98
|
+
isFieldMissing = true
|
|
99
|
+
return
|
|
105
100
|
}
|
|
106
101
|
|
|
107
|
-
newEntry[field] = entry[field]
|
|
108
|
-
})
|
|
102
|
+
newEntry[field] = entry[field]
|
|
103
|
+
})
|
|
109
104
|
|
|
110
105
|
if (isFieldMissing) {
|
|
111
|
-
return makeReturnValue(this.StatusEnum.ERROR, 'Required field is missing')
|
|
106
|
+
return makeReturnValue(this.StatusEnum.ERROR, 'Required field is missing')
|
|
112
107
|
}
|
|
113
108
|
|
|
114
|
-
data[collection].push(newEntry)
|
|
115
|
-
return makeReturnValue(this.StatusEnum.OK, '')
|
|
116
|
-
}
|
|
109
|
+
data[collection].push(newEntry)
|
|
110
|
+
return makeReturnValue(this.StatusEnum.OK, '')
|
|
111
|
+
}
|
|
117
112
|
|
|
118
113
|
this.link = function (collection, entry) {
|
|
119
114
|
// TODO: error checking for linkage that already exists
|
|
120
115
|
// TODO: how to handle credits? separate command? handle it here? I guess real challenge is handling from the command line.
|
|
121
116
|
if (this.linkCollections.indexOf(collection) === -1) {
|
|
122
|
-
return makeReturnValue(this.StatusEnum.ERROR, 'Invalid link collection specified')
|
|
117
|
+
return makeReturnValue(this.StatusEnum.ERROR, 'Invalid link collection specified')
|
|
123
118
|
}
|
|
124
|
-
data[collection].push(entry)
|
|
125
|
-
return makeReturnValue(this.StatusEnum.OK, '')
|
|
126
|
-
}
|
|
119
|
+
data[collection].push(entry)
|
|
120
|
+
return makeReturnValue(this.StatusEnum.OK, '')
|
|
121
|
+
}
|
|
127
122
|
|
|
128
|
-
|
|
123
|
+
const fsOp = function (dir, callback) {
|
|
129
124
|
if (!dir || typeof dir !== 'string') {
|
|
130
|
-
return makeReturnValue(this.StatusEnum.ERROR, 'No directory specified')
|
|
125
|
+
return makeReturnValue(this.StatusEnum.ERROR, 'No directory specified')
|
|
131
126
|
}
|
|
132
127
|
|
|
133
128
|
try {
|
|
134
|
-
collections.forEach(callback)
|
|
129
|
+
collections.forEach(callback)
|
|
135
130
|
} catch (e) {
|
|
136
|
-
return makeReturnValue(this.StatusEnum.ERROR, e.message || 'Unknown error')
|
|
131
|
+
return makeReturnValue(this.StatusEnum.ERROR, e.message || 'Unknown error')
|
|
137
132
|
}
|
|
138
|
-
return makeReturnValue(this.StatusEnum.OK, '')
|
|
139
|
-
}
|
|
133
|
+
return makeReturnValue(this.StatusEnum.OK, '')
|
|
134
|
+
}
|
|
140
135
|
|
|
141
136
|
this.read = function (dir) {
|
|
142
137
|
return fsOp.call(this, dir, function (collection) {
|
|
143
|
-
data[collection] = JSON.parse(fs.readFileSync(dir + '/' + collection + '.json'))
|
|
144
|
-
})
|
|
145
|
-
}
|
|
138
|
+
data[collection] = JSON.parse(fs.readFileSync(dir + '/' + collection + '.json'))
|
|
139
|
+
})
|
|
140
|
+
}
|
|
146
141
|
|
|
147
142
|
this.write = function (dir) {
|
|
148
143
|
return fsOp.call(this, dir, function (collection) {
|
|
149
|
-
fs.writeFileSync(dir + '/' + collection + '.json', JSON.stringify(data[collection], null, 2))
|
|
150
|
-
})
|
|
151
|
-
}
|
|
144
|
+
fs.writeFileSync(dir + '/' + collection + '.json', JSON.stringify(data[collection], null, 2))
|
|
145
|
+
})
|
|
146
|
+
}
|
|
152
147
|
}
|
|
153
148
|
|
|
154
|
-
module.exports = Data
|
|
149
|
+
module.exports = Data
|
package/lib/cli/add.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
module.exports = function (data, collection, _id, names) {
|
|
2
|
-
return data.create(collection, { _id: _id.toString(), names: [names] })
|
|
3
|
-
}
|
|
2
|
+
return data.create(collection, { _id: _id.toString(), names: [names] })
|
|
3
|
+
}
|
package/lib/cli/argv.js
CHANGED
|
@@ -1,76 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const Data = require('../Data')
|
|
4
|
+
const add = require('./add')
|
|
5
|
+
const search = require('./search')
|
|
6
|
+
const link = require('./link')
|
|
7
7
|
|
|
8
8
|
module.exports = function (argv) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var inputRv;
|
|
9
|
+
const that = this
|
|
10
|
+
const action = argv._[0]
|
|
11
|
+
const args = argv._.splice(1)
|
|
12
|
+
let rv = {}
|
|
13
|
+
let inputRv
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const outputDir = argv.outputDir || argv.o
|
|
16
|
+
const inputDir = argv.inputDir || argv.i
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
const data = new Data()
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
const save = function () {
|
|
22
21
|
if (rv.status === data.StatusEnum.OK) {
|
|
23
22
|
if (outputDir) {
|
|
24
|
-
data.write(outputDir)
|
|
23
|
+
data.write(outputDir)
|
|
25
24
|
} else {
|
|
26
|
-
that.error('No output directory specified. Your data will not be saved.\nUse -o to specify an output directory.')
|
|
25
|
+
that.error('No output directory specified. Your data will not be saved.\nUse -o to specify an output directory.')
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
}
|
|
28
|
+
}
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const run = function (actionFunction) {
|
|
31
|
+
const actionRv = actionFunction.apply(undefined, [data].concat(args))
|
|
33
32
|
if (actionRv.message) {
|
|
34
|
-
that.error(actionRv.message)
|
|
33
|
+
that.error(actionRv.message)
|
|
35
34
|
}
|
|
36
|
-
return actionRv
|
|
37
|
-
}
|
|
35
|
+
return actionRv
|
|
36
|
+
}
|
|
38
37
|
|
|
39
38
|
if (inputDir) {
|
|
40
|
-
inputRv = data.read(inputDir)
|
|
39
|
+
inputRv = data.read(inputDir)
|
|
41
40
|
if (inputRv.message) {
|
|
42
|
-
this.error(inputRv.message)
|
|
41
|
+
this.error(inputRv.message)
|
|
43
42
|
}
|
|
44
43
|
if (inputRv.status === data.StatusEnum.ERROR) {
|
|
45
|
-
this.exit(1)
|
|
44
|
+
this.exit(1)
|
|
46
45
|
}
|
|
47
46
|
} else {
|
|
48
|
-
this.error('No input directory specified. Operating on empty data set.\nUse -i to specify a data directory.')
|
|
47
|
+
this.error('No input directory specified. Operating on empty data set.\nUse -i to specify a data directory.')
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
switch (action) {
|
|
52
51
|
case 'add':
|
|
53
|
-
rv = run(add)
|
|
54
|
-
save()
|
|
55
|
-
break
|
|
52
|
+
rv = run(add)
|
|
53
|
+
save()
|
|
54
|
+
break
|
|
56
55
|
|
|
57
56
|
case 'link':
|
|
58
|
-
rv = run(link)
|
|
59
|
-
save()
|
|
60
|
-
break
|
|
57
|
+
rv = run(link)
|
|
58
|
+
save()
|
|
59
|
+
break
|
|
61
60
|
|
|
62
61
|
case 'search':
|
|
63
|
-
rv = run(search)
|
|
62
|
+
rv = run(search)
|
|
64
63
|
if (rv.status === data.StatusEnum.OK) {
|
|
65
|
-
this.dir(rv.results)
|
|
64
|
+
this.dir(rv.results)
|
|
66
65
|
}
|
|
67
|
-
break
|
|
66
|
+
break
|
|
68
67
|
|
|
69
68
|
default:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
rv = { status: data.StatusEnum.ERROR };
|
|
69
|
+
this.error(fs.readFileSync(path.join(__dirname, '..', '..', 'doc', 'cli', 'help.txt'), 'utf8'))
|
|
70
|
+
rv = { status: data.StatusEnum.ERROR }
|
|
73
71
|
}
|
|
74
|
-
code = rv.status === data.StatusEnum.OK ? 0 : 1
|
|
75
|
-
this.exit(code)
|
|
76
|
-
}
|
|
72
|
+
const code = rv.status === data.StatusEnum.OK ? 0 : 1
|
|
73
|
+
this.exit(code)
|
|
74
|
+
}
|
package/lib/cli/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
dir: function (output) {
|
|
3
|
-
console.dir(output)
|
|
3
|
+
console.dir(output)
|
|
4
4
|
},
|
|
5
5
|
|
|
6
6
|
exit: function (code) {
|
|
7
|
-
process.exit(code)
|
|
7
|
+
process.exit(code)
|
|
8
8
|
},
|
|
9
9
|
|
|
10
10
|
error: function (message) {
|
|
11
|
-
console.error(message)
|
|
11
|
+
console.error(message)
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
argv: require('./argv')
|
|
15
|
-
}
|
|
15
|
+
}
|
package/lib/cli/link.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
module.exports = function (data, collection1, id1, collection2, id2) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
link[field1] = id1.toString()
|
|
7
|
-
link[field2] = id2.toString()
|
|
2
|
+
let linkCollection = collection1 + '_' + collection2
|
|
3
|
+
const field1 = collection1 + '_id'
|
|
4
|
+
const field2 = collection2 + '_id'
|
|
5
|
+
const link = {}
|
|
6
|
+
link[field1] = id1.toString()
|
|
7
|
+
link[field2] = id2.toString()
|
|
8
8
|
|
|
9
9
|
if (data.linkCollections.indexOf(linkCollection) === -1) {
|
|
10
10
|
// Try track_release if release_track is what we have
|
|
11
|
-
linkCollection = collection2 + '_' + collection1
|
|
11
|
+
linkCollection = collection2 + '_' + collection1
|
|
12
12
|
if (data.linkCollections.indexOf(linkCollection) === -1) {
|
|
13
|
-
this.error(collection1 + ' and ' + collection2 + ' cannot be linked')
|
|
14
|
-
return { status: data.StatusEnum.ERROR }
|
|
13
|
+
this.error(collection1 + ' and ' + collection2 + ' cannot be linked')
|
|
14
|
+
return { status: data.StatusEnum.ERROR }
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
return data.link(linkCollection, link)
|
|
18
|
-
}
|
|
17
|
+
return data.link(linkCollection, link)
|
|
18
|
+
}
|
package/lib/cli/search.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module.exports = function (data, collection, searchTerm) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return names.indexOf(searchTerm) !== -1
|
|
5
|
-
}
|
|
6
|
-
return data.search({ collection: collection, filterCallback: filterCallback })
|
|
7
|
-
}
|
|
2
|
+
const filterCallback = function (value) {
|
|
3
|
+
const names = value.names
|
|
4
|
+
return names.indexOf(searchTerm) !== -1
|
|
5
|
+
}
|
|
6
|
+
return data.search({ collection: collection, filterCallback: filterCallback })
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "music-routes-data",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "What musicians played on what tracks",
|
|
5
5
|
"homepage": "https://github.com/Trott/music-routes-data",
|
|
6
6
|
"files": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"README.md"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"test": "
|
|
15
|
+
"test": "standard && c8 jasmine spec/*.js && bin/verify"
|
|
16
16
|
},
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
@@ -30,20 +30,41 @@
|
|
|
30
30
|
"Trott"
|
|
31
31
|
],
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
33
|
+
"@semantic-release/changelog": "^6.0.1",
|
|
34
|
+
"@semantic-release/git": "^10.0.1",
|
|
35
|
+
"c8": "^7.11.0",
|
|
36
|
+
"glob": "^7.2.0",
|
|
37
|
+
"jasmine": "^4.0.2",
|
|
38
|
+
"semantic-release": "^19.0.2",
|
|
39
|
+
"standard": "^16.0.4"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"minimist": "^1.2.5"
|
|
43
43
|
},
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
44
|
+
"release": {
|
|
45
|
+
"branches": [
|
|
46
|
+
"main"
|
|
47
|
+
],
|
|
48
|
+
"plugins": [
|
|
49
|
+
"@semantic-release/commit-analyzer",
|
|
50
|
+
"@semantic-release/release-notes-generator",
|
|
51
|
+
[
|
|
52
|
+
"@semantic-release/changelog",
|
|
53
|
+
{
|
|
54
|
+
"changelogFile": "CHANGELOG"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"@semantic-release/npm",
|
|
58
|
+
[
|
|
59
|
+
"@semantic-release/git",
|
|
60
|
+
{
|
|
61
|
+
"assets": [
|
|
62
|
+
"CHANGELOG",
|
|
63
|
+
"package.json"
|
|
64
|
+
],
|
|
65
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
]
|
|
48
69
|
}
|
|
49
70
|
}
|