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

Make it easy for corp-semantic-release to update other source files with the new version number #26

Closed
uglow opened this issue Feb 23, 2017 · 0 comments

Comments

@uglow
Copy link
Collaborator

uglow commented Feb 23, 2017

Currently the --pre-commit <script> flag supports calling an NPM script before commiting changes back to git. But as a user, I don't know what the new version number is or whether package.json has been updated with the new version already.

I see two main use-cases for the existing option:

  1. Run an NPM script which is unrelated to the new version number
  2. Run an NPM script which requires the new version number

For the second case, typically you want the new version number so that you can update other files.

So I propose:

  • passing the new version number as an argument to the --pre-commit <script>
  • writing a new NPM module which can be figured to parse a file which contains user-defined configuration for replacing the version number in files:

updateVersion.yml:

process: 
  - name: path/file.ext
    searchRE: /^version:.*$/m
    replacement: `version: ${version}`
  - name: path/file2.ext
    searchRE: /^id:.*$/m
    replacement: `id: ${version}`

package.json

  "scripts": {
    "release": "corp-semantic-release --pre-commit updateVersions",
    "updateVersions": "newFileUpdatingModuleWhichReceivesTheNewVersionNumber updateVersion.yml"
  }
  
  ...
  "devDependencies": {
    "newFileUpdatingModuleWhichReceivesTheNewVersionNumber": "1.0.0"
  }
@uglow uglow changed the title Make it easy for corp-semantic-release to updated other source files with the new version number Make it easy for corp-semantic-release to update other source files with the new version number Feb 23, 2017
@uglow uglow closed this as completed in 7febd66 Feb 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant