forked from rockybars/atom-shell-packager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
targets.js
35 lines (29 loc) · 992 Bytes
/
targets.js
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
'use strict'
const common = require('./common')
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)) list = list.split(',')
for (let value of list) {
if (!supported[value]) {
return new Error(`Unsupported ${name}=${value}; must be one of: ${Object.keys(supported).join(', ')}`)
}
}
return list
}
}