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

Bit CLI has issue tagging modified components #356

Closed
theetrain opened this issue Oct 27, 2017 · 4 comments
Closed

Bit CLI has issue tagging modified components #356

theetrain opened this issue Oct 27, 2017 · 4 comments

Comments

@theetrain
Copy link
Contributor

User info

Host system: MacOS Sierra 10.12.6
Terminal: Hyper (bash)
Node version: 8.2.1 (using nvm 0.33.4)
npm version: 5.5.1
Bit version: 0.10.9
Component: https://bitsrc.io/enricotelus/bit-test/components/button

Background

I was able to use bit successfully to create, stage, tag, and export a component that is now at v1. When I made a change, my bit status listed the component under 'modified components', which is great. Though the next part gets cryptic:

$ bit tag -am 'add text to button'
TypeError: component.addVersion is not a function
    at SourceRepository._callee4$ (/Users/enrico/.nvm/versions/node/v8.2.1/lib/node_modules/bit-bin/dist/scope/repositories/sources.js:449:27)
    at tryCatch (/Users/enrico/.nvm/versions/node/v8.2.1/lib/node_modules/bit-bin/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/Users/enrico/.nvm/versions/node/v8.2.1/lib/node_modules/bit-bin/node_modules/regenerator-runtime/runtime.js:299:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/enrico/.nvm/versions/node/v8.2.1/lib/node_modules/bit-bin/node_modules/regenerator-runtime/runtime.js:117:21)
    at step (/Users/enrico/.nvm/versions/node/v8.2.1/lib/node_modules/bit-bin/dist/scope/repositories/sources.js:109:191)
    at /Users/enrico/.nvm/versions/node/v8.2.1/lib/node_modules/bit-bin/dist/scope/repositories/sources.js:109:361
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Expected result

I expected my button component to tag at v2 and become staged for exporting.

Additional info

Not sure why it was working earlier, and then suddenly not working. For added context, my project tree does have two .bit projects since I'm testing this tool out 😃

image

@GiladShoham
Copy link
Member

@theetrain
Thanks for the reporting.
We are checking this now and will keep you updated.

@GiladShoham
Copy link
Member

Hi, @theetrain
I looked into your working directory and I think that the reason for the issue is an error during the export process, that led to a data corruption in the .bit.map.json file (this, in turn, led to the error you got).
I am still unable to reproduce the flow that caused the data-corruption in the .bit.map.json file. I'm keeping this issue open for now, to continue investigating it.

In the meantime, you can workaround the issue by editing .bit.map.json file.
Right now, the file looks like this:

{
    "enricotelus.bit-test/components/button@1": {
        "files": [
            {
                "relativePath": "src/components/button.jsx",
                "test": false,
                "name": "button.jsx"
            }
        ],
        "mainFile": "src/components/button.jsx",
        "origin": "AUTHORED"
    },
    "components/button": {
        "files": [
            {
                "relativePath": "src/components/button.jsx",
                "test": false,
                "name": "button.jsx"
            }
        ],
        "mainFile": "src/components/button.jsx",
        "origin": "AUTHORED"
    }
}

Simply edit it to look like this (without the components/button entry):

{
    "enricotelus.bit-test/components/button@1": {
        "files": [
            {
                "relativePath": "src/components/button.jsx",
                "test": false,
                "name": "button.jsx"
            }
        ],
        "mainFile": "src/components/button.jsx",
        "origin": "AUTHORED"
    }
}

Please update the issue if this error keeps reproducing.

@GiladShoham
Copy link
Member

Hi, @theetrain
I've found the root cause of this problem.
This caused by the fact that you probably added the component again after the export.

Perhaps this is because after the export command you ran the status command, and the component was no longer visible there?
If that's the reason, the bit list command is here to help. This lists all components in the local scope (unlike status which gives you a status for the workspace).

At any case, that's something I'm fixing, as Bit should not allow adding the same component several times.

@davidfirst
Copy link
Member

As described by @GiladShoham, the issue happened as a result of re-adding a component after export.
The following (merged) PR #361 helps to prevent such cases from happening in the future.

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

3 participants