mirror of
https://github.com/primer/css.git
synced 2024-11-30 01:04:04 +03:00
17 lines
505 B
JavaScript
17 lines
505 B
JavaScript
const each = require('./each')
|
|
|
|
module.exports = function addSource(options = {}) {
|
|
const {namespace = 'data'} = options
|
|
for (const key of ['branch', 'repository']) {
|
|
if (!options[key]) {
|
|
throw new Error(`addSource() plugin requires options.${key} (got ${JSON.stringify(options[key])})`)
|
|
}
|
|
}
|
|
const {branch, repository} = options
|
|
return each((file, source) => {
|
|
if (file[namespace]) {
|
|
file[namespace].source = `${repository}/tree/${branch}/modules/${source}`
|
|
}
|
|
})
|
|
}
|