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

Function options.execute to make bumpp more flexible #53

Closed
3 tasks done
s3xysteak opened this issue Oct 14, 2024 · 0 comments · Fixed by #54
Closed
3 tasks done

Function options.execute to make bumpp more flexible #53

s3xysteak opened this issue Oct 14, 2024 · 0 comments · Fixed by #54
Labels
enhancement New feature or request

Comments

@s3xysteak
Copy link

s3xysteak commented Oct 14, 2024

Clear and concise description of the problem

Currently, execute is used to run scripts before git commit. It is a common API but there are some drawbacks like it cannot get the new version after bumping. Also #11 tried using %s placeholder, which is ambiguous. We can imagine how many features are difficult to implement due to script limitations.

But bumpp could have a config file bump.config.ts, which gave the proposal an opportunity. In bump.config.ts, user could pass a function options.execute to achieve more functions that are difficult for scripts to achieve.

Suggested solution

https://github.com/antfu-collective/bumpp/blob/main/src/types/version-bump-options.ts#L138

/**
 * Excute additional command after bumping and before commiting
 */
execute?: string | ((config?: Operation) => Awaitable<void>)

https://github.com/antfu-collective/bumpp/blob/main/src/version-bump.ts#L74

  await updateFiles(operation)

  if (operation.options.execute) {
   if (typeof operation.options.execute === 'function') {
      await operation.options.execute(operation)
    }
    else {
      console.log(symbols.info, 'Executing script', operation.options.execute)
      await ezSpawn.async(operation.options.execute, { stdio: 'inherit' })
      console.log(symbols.success, 'Script finished')
    }
  }

Alternative

No response

Additional context

No response

Validations

@s3xysteak s3xysteak added the enhancement New feature or request label Oct 14, 2024
@antfu antfu closed this as completed in #54 Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant