Skip to content

Commit

Permalink
feat: add versionBumpInfo (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: mawencan <1819293933@qq.com>
  • Loading branch information
antfu and hengshanMWC committed Jun 15, 2022
1 parent 85048ad commit 9d4b130
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
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
}

0 comments on commit 9d4b130

Please sign in to comment.