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