forked from rockybars/atom-shell-packager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtargets.js
More file actions
46 lines (38 loc) · 1.25 KB
/
targets.js
File metadata and controls
46 lines (38 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict'
const common = require('./common')
function unsupportedListOption (name, value, supported) {
return new Error(`Unsupported ${name}=${value} (${typeof value}); must be a String matching: ${Object.keys(supported).join(', ')}`)
}
module.exports = {
supportedArchs: common.archs.reduce((result, arch) => {
result[arch] = true
return result
}, {}),
// Maps to module filename for each platform (lazy-required if used)
supportedPlatforms: {
darwin: './mac',
linux: './linux',
mas: './mac', // map to darwin
win32: './win32'
},
// Validates list of architectures or platforms.
// Returns a normalized array if successful, or throws an Error.
validateListFromOptions: function validateListFromOptions (opts, supported, name) {
if (opts.all) return Object.keys(supported)
let list = opts[name] || process[name]
if (list === 'all') return Object.keys(supported)
if (!Array.isArray(list)) {
if (typeof list === 'string') {
list = list.split(',')
} else {
return unsupportedListOption(name, list, supported)
}
}
for (let value of list) {
if (!supported[value]) {
return unsupportedListOption(name, value, supported)
}
}
return list
}
}