-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (26 loc) · 930 Bytes
/
index.js
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
// add validateConditions and prepare functions for semantic release plugin
import verifyConfig from './lib/verify-config.js';
import preparePackage from './lib/prepare.js';
import AggergateError from 'aggregate-error';
let verified = false;
export async function verifyConditions(pluginConfig, context) {
const { logger } = context;
logger.log('pluginConfig', pluginConfig);
const errors = await verifyConfig(pluginConfig, context);
verified = true;
if (errors.length > 0) {
throw new AggergateError(errors);
}
}
export async function prepare(pluginConfig, context) {
const errors = verified ? [] : await verifyConfig(pluginConfig, context);
if (errors.length > 0) {
throw new AggergateError(errors);
}
try {
// TODO: Reload package in case it is updated in previous step
await preparePackage(pluginConfig, context);
} catch (error) {
throw new AggergateError([error.message]);
}
}