Giter Site home page Giter Site logo

Comments (14)

stovmascript avatar stovmascript commented on May 5, 2024

Looks like HEAD isn't pointing to any Git tag. Is that correct?

Thought: Maybe RNV should just skip adjusting Git tags when it doesn't find any, instead of throwing.

from react-native-version.

VinceBT avatar VinceBT commented on May 5, 2024

Yes you are maybe correct. Such a behaviour would be great

from react-native-version.

stovmascript avatar stovmascript commented on May 5, 2024

@VinceBT New version (2.6.1) is out now on npm.

from react-native-version.

VinceBT avatar VinceBT commented on May 5, 2024

I used --amend to try your modification and got the same error, I'm on 2.6.1
Could the && be the reason of the bug here ? :

EDIT: Changing it to || did nothing

from react-native-version.

stovmascript avatar stovmascript commented on May 5, 2024

Hm, weird. Here's what I just tried:

$ npm version patch
$ react-native-version -a
# commit amended, git tag adjusted

$ npm version patch
# another test commit
$ react-native-version -a
# commit amended, no git tag adjusted

LGTM

from react-native-version.

VinceBT avatar VinceBT commented on May 5, 2024

Could you reopen this issue ? I still don't have the amend working even with latest version :(

from react-native-version.

stovmascript avatar stovmascript commented on May 5, 2024

I'm going to need a reproducible example in order to dig deeper.

From your description I gather that you have something like a monorepo with multiple projects or apps in it. This shouldn't be a problem. However, about Git tags... Do you utilize them somehow in the other apps? Do you skip tag creation (--no-git-tag-version or disabling in npm config) when using npm version ... or are you using default settings?

AFAIK Git tags are global inside a repo, so they can be overwritten by the other apps.

from react-native-version.

VinceBT avatar VinceBT commented on May 5, 2024

I think my issue is related to this npm/npm#9111

Since my app is inside a subfolder, it doesnt not create a tag, so there is nothing to amend.

I've adapted my package.json to look like that:
image

But when using npm version, it creates two tags now:
image

EDIT:
I think this ticket can be closed and a second known issue can be added to your readme haha
If you can help me on the double tag issue tell me if I need to create a second issue of if there is a simple fix

from react-native-version.

stovmascript avatar stovmascript commented on May 5, 2024

Hm, wasn't aware of this. Maybe a check that Git exists in that directory should also be added. npm version simply skips tag creation if there isn't a .git/ directory. I think we should mirror that behaviour.

from react-native-version.

stovmascript avatar stovmascript commented on May 5, 2024

@VinceBT Can you try out react-native-version@next (2.6.3-0) and see if that works ok?

from react-native-version.

VinceBT avatar VinceBT commented on May 5, 2024

When using your new version I get this output and no git tag

[RNV] Versioning Android...
[RNV] Android updated
[RNV] Versioning iOS...
[RNV] iOS updated
[RNV] Amending...
[RNV] Done

But when creating a .git folder, I get this output and a git tag

[RNV] Versioning Android...
[RNV] Android updated
[RNV] Versioning iOS...
[RNV] iOS updated
[RNV] Amending...
[RNV] Adjusting Git tag...
[RNV] Done

The [RNV] Adjusting Git tag... step is triggered in the second case
I dont have the double tag issue anymore

from react-native-version.

stovmascript avatar stovmascript commented on May 5, 2024

Yeah, but isn't that what we want?

With "preversion": "mkdir .git", when you run npm version and the Git tag for that version does not exist in your repo, it will create the tag and proceed with "postversion": "react-native-version --amend", which will find the tag and adjust it to point to the amended commit.

If the Git tag already exists in the repo, npm version will throw an error because it does not use the --force option like RNV does.


But I have found and issue in the case when there is no .git/ folder, npm version will skip creating a Git tag and will not even commit the changes in package.json. RNV will then do its work and amend the current commit in error. The same commit validation we do for determining when to search for Git tags should be added before amending.

from react-native-version.

christophliftoff avatar christophliftoff commented on May 5, 2024

For me this was happening when I would try and run the react-native-version script without committing my changes. It seems that you can only run this script once per commit? Otherwise I'd get the error you shared above.

from react-native-version.

arafatalim avatar arafatalim commented on May 5, 2024

I fixed the problem by adding the missing .git folder to the apps/mobile folder.

Q. How can I check if my folder is missing?
A. I checked on vs code for this.

  • Open Settings -> Search or type exclude -> find the pattern **/.git, remove it temporarily, and click ok.
  • Check for the .git folder in the main project directory and the apps/mobile folder.
  • If the .git folder is not in the apps/mobile folder, create it. [Leave it empty]
  • Now, execute your command, like yarn mobile:staging:release.

from react-native-version.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.