-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (28 loc) · 992 Bytes
/
index.js
File metadata and controls
34 lines (28 loc) · 992 Bytes
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
import { defaultTo, castArray } from "lodash-es";
import verifyGit from "./lib/verify.js";
import prepareGit from "./lib/prepare.js";
let verified;
export function verifyConditions(pluginConfig, context) {
const { options } = context;
// If the Git prepare plugin is used and has `assets` or `message` configured, validate them now in order to prevent any release if the configuration is wrong
if (options.prepare) {
const preparePlugin =
castArray(options.prepare).find(
(config) => config.path && config.path === "@semantic-release/git",
) || {};
pluginConfig.assets = defaultTo(pluginConfig.assets, preparePlugin.assets);
pluginConfig.message = defaultTo(
pluginConfig.message,
preparePlugin.message,
);
}
verifyGit(pluginConfig);
verified = true;
}
export async function prepare(pluginConfig, context) {
if (!verified) {
verifyGit(pluginConfig);
verified = true;
}
await prepareGit(pluginConfig, context);
}