-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathperformBump.ts
More file actions
33 lines (26 loc) · 1.24 KB
/
performBump.ts
File metadata and controls
33 lines (26 loc) · 1.24 KB
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
import { unlinkChangeFiles } from '../changefile/unlinkChangeFiles';
import { writeChangelog } from '../changelog/writeChangelog';
import type { BumpInfo } from '../types/BumpInfo';
import type { BeachballOptions } from '../types/BeachballOptions';
import { callHook } from './callHook';
import { updatePackageJsons } from './updatePackageJsons';
import { updateLockFile } from './updateLockFile';
/**
* Performs the bump and writes to the filesystem:
* update package.json files, update lock file, write changelogs, and delete change files.
*/
export async function performBump(bumpInfo: BumpInfo, options: BeachballOptions): Promise<BumpInfo> {
const { modifiedPackages, packageInfos, changeFileChangeInfos } = bumpInfo;
await callHook(options.hooks?.prebump, modifiedPackages, packageInfos, options.concurrency);
updatePackageJsons(modifiedPackages, packageInfos);
await updateLockFile(options);
if (options.generateChangelog) {
// Generate changelog
await writeChangelog(bumpInfo, options);
}
// Unlink changelogs
unlinkChangeFiles(changeFileChangeInfos, options);
await callHook(options.hooks?.postbump, modifiedPackages, packageInfos, options.concurrency);
// This is returned from bump() for testing
return bumpInfo;
}