Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add versionBumpInfo #2

Merged
merged 3 commits into from Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/index.ts
@@ -1,11 +1,9 @@
import { versionBump } from './version-bump'
import { versionBump, versionBumpInfo } from './version-bump'

// Exprot the external type definitions as named exports
export { ReleaseType } from './release-type'
export * from './types/version-bump-options'
export * from './types/version-bump-results'
export * from './types/version-bump-progress'

// Export `versionBump` as a named export and the default export
export { versionBump }
export default versionBump
export { versionBump, versionBumpInfo };
export default versionBump;
15 changes: 15 additions & 0 deletions src/version-bump.ts
Expand Up @@ -106,3 +106,18 @@ function printSummary(operation: Operation) {
console.log(` to ${green(bold(operation.state.newVersion))}`)
console.log()
}

/**
* Bumps the version number in one or more files, prompting users if necessary.
*/
export async function versionBumpInfo(arg: VersionBumpOptions | string = {}): Promise<Operation> {
if (typeof arg === 'string')
arg = { release: arg }

const operation = await Operation.start(arg)

// Get the old and new version numbers
await getOldVersion(operation)
await getNewVersion(operation)
return operation
}