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

corp-semantic-release is forgetting to commit lock files #64

Open
rodoabad opened this issue Jul 12, 2018 · 11 comments
Open

corp-semantic-release is forgetting to commit lock files #64

rodoabad opened this issue Jul 12, 2018 · 11 comments

Comments

@rodoabad
Copy link

I have noticed that corp-semantic-release is not committing and pushing lock files. Is anyone else having this problem?

@leonardoanalista
Copy link
Owner

yes, you are right. This is the line which adds the files: https://github.com/leonardoanalista/corp-semantic-release/blob/master/src/lib/addFilesAndCreateTag.js#L10

If you have a chance to right a PR let me know. Otherwise give me a few hours to be able to write a PR.

@leonardoanalista
Copy link
Owner

That line could potentially be code = shell.exec('git add package.json package-lock.json CHANGELOG.md').code;

Code should add and commit package-lock.json as part of the changes. This is a possible breaking changes as some could be using yarn.lock instead.

Alternatively, a preferred solution would be identify if the project uses npm or yarn.lock and add/commit the appropriated file.

@rodoabad
Copy link
Author

@leonardoanalista let's do a little bit of hashing out the details. You've identified one challenge and that is to try and identify if the consumer is using either npm or yarn or it could even be both (they update both lock files).

I think one more challenge is to identify if they have set npm and yarn to not generate lock files which is what I did for the mean time in order to not trigger two consecutive CI runs.

@rodoabad
Copy link
Author

rodoabad commented Jul 13, 2018

@leonardoanalista here's a rough snippet. I can submit a PR if you want too. Is this what you had in mind?

  code = shell.exec('git add package.json CHANGELOG.md').code;
  if (shell.test('-f', 'package-lock.json')) {
    code = shell.exec('git package-lock.json').code;
  }
  if (shell.test('-f', 'yarn.lock')) {
    code = shell.exec('git yarn.lock').code;
  }

@leonardoanalista
Copy link
Owner

Maybe the first line can do what it was doing before:

code = shell.exec('git add package.json CHANGELOG.md').code;

Then have the 2 if conditions to add package or yarn lock files if they exist.

@rodoabad
Copy link
Author

LOL. Good catch.

@BBlackwo
Copy link

BBlackwo commented Jul 26, 2018

yarn.lock doesn't contain the package version so it shouldn't need to be updated and committed, right? Or am I missing something?

@rodoabad
Copy link
Author

@leonardoanalista do you have time to do this? I am getting pulled away from things right now. I"m sorry!

@leonardoanalista
Copy link
Owner

Bblackwo made a good point. I m on holidays now and can’t look into details but I agree with him.
We need to see how we use this package on the apps. When we run a release, this package modified package.json, add and commit. I ll need to look at this when I return

@rodoabad
Copy link
Author

NP. Thanks, @BBlackwo!

@rodoabad
Copy link
Author

@leonardoanalista any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants