for #2543 BREAKING CHANGE: semantic-release is now ESM-only. since it is used through its own executable, the impact on consuming projects should be minimal BREAKING CHANGE: references to plugin files in configs need to include the file extension because of executing in an ESM context
19 lines
607 B
JavaScript
19 lines
607 B
JavaScript
import {isString, mapValues, omit, remove, template} from 'lodash-es';
|
|
import micromatch from 'micromatch';
|
|
import {getBranches} from '../git.js';
|
|
|
|
export default async (repositoryUrl, {cwd}, branches) => {
|
|
const gitBranches = await getBranches(repositoryUrl, {cwd});
|
|
|
|
return branches.reduce(
|
|
(branches, branch) => [
|
|
...branches,
|
|
...remove(gitBranches, (name) => micromatch(gitBranches, branch.name).includes(name)).map((name) => ({
|
|
name,
|
|
...mapValues(omit(branch, 'name'), (value) => (isString(value) ? template(value)({name}) : value)),
|
|
})),
|
|
],
|
|
[]
|
|
);
|
|
}
|