mirror of
https://github.com/primer/css.git
synced 2024-11-23 11:27:26 +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}`
|
|
}
|
|
})
|
|
}
|