This commit is contained in:
Elizabeth Craig 2023-08-30 16:26:03 -07:00
Родитель 6fa75774e0
Коммит 23c071e2e4
3 изменённых файлов: 37 добавлений и 20 удалений

Просмотреть файл

@ -1,8 +1,11 @@
*.log
*.snap
*.styl
*.svg
.*ignore
.DS_Store
.nojekyll
.nvmrc
docs/.vuepress/dist
/change/
/CHANGELOG.*

Просмотреть файл

@ -584,12 +584,12 @@ describe('version bumping', () => {
const jsonPath = path.join(packagePath, 'package.json');
expect(fs.readJSONSync(jsonPath).version).toBe('1.1.0');
},
}
};
await bump({
path: repo.rootPath,
bumpDeps: false,
hooks
hooks,
} as BeachballOptions);
expect(postBumpCalled).toBe(true);
@ -610,16 +610,16 @@ describe('version bumping', () => {
let postbumpCalled = false;
const hooks: BeachballOptions['hooks'] = {
postbump: async (packagePath, name, version) => {
postbumpCalled = true;
expect(packagePath.endsWith(path.join('packages', 'pkg-1'))).toBeTruthy();
expect(name).toBe('pkg-1');
expect(version).toBe('1.1.0');
postbump: async (packagePath, name, version) => {
postbumpCalled = true;
expect(packagePath.endsWith(path.join('packages', 'pkg-1'))).toBeTruthy();
expect(name).toBe('pkg-1');
expect(version).toBe('1.1.0');
const jsonPath = path.join(packagePath, 'package.json');
expect((await fs.readJSON(jsonPath)).version).toBe('1.1.0');
},
}
const jsonPath = path.join(packagePath, 'package.json');
expect((await fs.readJSON(jsonPath)).version).toBe('1.1.0');
},
};
await bump({
path: repo.rootPath,
@ -642,17 +642,16 @@ describe('version bumping', () => {
repo.push();
const hooks: BeachballOptions['hooks'] = {
postbump: async (_packagePath, _name, _version): Promise<void> => {
throw new Error('Foo');
},
}
postbump: async (_packagePath, _name, _version): Promise<void> => {
throw new Error('Foo');
},
};
const bumpResult = bump({
path: repo.rootPath,
bumpDeps: false,
hooks
hooks,
} as BeachballOptions);
await expect(bumpResult).rejects.toThrow('Foo');

Просмотреть файл

@ -204,7 +204,12 @@ export interface HooksOptions {
* @param version The post-bump version of the package to be published
* @param packageInfos Metadata about other packages processed by Beachball. Computed post-bump. Readonly.
*/
prepublish?: (packagePath: string, name: string, version: string, packageInfos: Readonly<PackageInfos>) => void | Promise<void>;
prepublish?: (
packagePath: string,
name: string,
version: string,
packageInfos: Readonly<PackageInfos>
) => void | Promise<void>;
/**
* Runs for each package after the publish command.
@ -215,7 +220,12 @@ export interface HooksOptions {
* @param version The post-bump version of the package to be published
* @param packageInfos Metadata about other packages processed by Beachball. Computed post-bump. Readonly.
*/
postpublish?: (packagePath: string, name: string, version: string, packageInfos: Readonly<PackageInfos>) => void | Promise<void>;
postpublish?: (
packagePath: string,
name: string,
version: string,
packageInfos: Readonly<PackageInfos>
) => void | Promise<void>;
/**
* Runs for each package, before writing changelog and package.json updates
@ -236,7 +246,12 @@ export interface HooksOptions {
* @param version The post-bump version of the package to be published
* @param packageInfos Metadata about other packages processed by Beachball. Computed post-bump. Readonly.
*/
postbump?: (packagePath: string, name: string, version: string, packageInfos: Readonly<PackageInfos>) => void | Promise<void>;
postbump?: (
packagePath: string,
name: string,
version: string,
packageInfos: Readonly<PackageInfos>
) => void | Promise<void>;
/**
* Runs once after all bumps to all packages before committing changes