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

Add symlink yarn command and document linking #110

Merged
merged 1 commit into from
Mar 12, 2019

Conversation

vedrani
Copy link
Contributor

@vedrani vedrani commented Mar 11, 2019

FX-27

Description

Linking with yarn link is pretty straightforward. Problem is what and where to link.
I wrote tutorial on how to link picasso with project that uses picasso as dependency.
Also extracted symlink as separate command/script.

MAIN PROBLEM: React can work only with one instance and when you link picasso you have 2 instances in testbed. One solution is to add resolve alias in webpack of testbed project, but if you are using CRA2 it's not an option. Alternative is when you are doing linking of picasso you link react also. We can discuss is that final solution or we need to solve it differently.

facebook/react#14257 (comment)
facebook/react#13991 (comment)

Also review testbed
https://github.com/toptal/picasso-testbed/pull/1

How to test

Read readme section on deployed picasso to test linking. I'm working in VM so after unlinking when I run yarn install in testbed and picasso nothing happens. So I need to delete node_modules and do yarn install to achieve initial state before linking.

Review

  • CHANGELOG.md
  • README.md
  • Specs
  • Visual specs
  • Documentation

@vedrani vedrani requested review from a team, denieler, bytasv and MilosMosovsky March 11, 2019 11:39
package.json Outdated Show resolved Hide resolved
@toptal-devbot
Copy link
Collaborator

Successfully deployed demo at https://picasso.toptal.net/fx-27-document-npm-link

@bytasv
Copy link
Contributor

bytasv commented Mar 11, 2019

Tip for checklist on github :)

- [x] README.md
equals

  • README.md

README.md Outdated
To unlink picasso follow these steps:

1. In terminal navigate to picasso project directory
2. Create link with `yarn symlink:off`
Copy link
Contributor

@bytasv bytasv Mar 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Unlink with...?

-edit: Also wondering - what happens if you don't unlink Picasso itself? Is there any harm to that? Maybe it doesn't matter if it stays linked?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can, I can extend docs and say unlinking in picasso directory is optional.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would maybe even remove it if it doesn't really change anything (just to have simpler instructions). I assume the only problem would be if you had a couple of picasso folders on your machine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave it because it explains whole cycle.But I divided instructions into two groups so it will be clearer.

bin/symlink Outdated Show resolved Hide resolved
Copy link
Contributor

@bytasv bytasv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, but if current steps are working I think this is good to be merged

README.md Outdated
5. Create link with `yarn symlink` (creates picasso and react link)
6. In terminal navigate to your project directory
7. Link picasso with `yarn link @toptal/picasso`
8. Link react with `yarn link react`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we should link react, I tried linking with testbed and it worked with simply linking @toptal/picasso

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooks require one instance of React, while other React feature also they don't throw explicit error.
facebook/react#14257 (comment)

There is alternative approach with webpack resolve.alias but if you use CRA2 that is not an option. I would wait and see how users will use it. This is not optimal but it's robust linking solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe initial users will be us anyways, so lets leave it all here, we can add that it MAY BE optional, but in case we get stuck, we wouldn't have to look for an answer. We can always clean up in the future

README.md Outdated
2. Create link with `yarn symlink:off`
3. In terminal navigate to your project directory
4. Unlink picasso with `yarn unlink @toptal/picasso`
5. Unlink react with `yarn unlink react`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@toptal-devbot
Copy link
Collaborator

Successfully deployed demo at https://picasso.toptal.net/fx-27-document-npm-link

@bytasv bytasv added the Chore Everything not related to a new features label Mar 11, 2019
@bytasv
Copy link
Contributor

bytasv commented Mar 11, 2019

@vedrani I've added Chore label. When you create a PR add one of the labels so we that our changelog generator is aware of what kind of change should be marked when PR is merged :)

@toptal-devbot
Copy link
Collaborator

Successfully deployed demo at https://picasso.toptal.net/fx-27-document-npm-link

@toptal-devbot
Copy link
Collaborator

Successfully deployed demo at https://picasso.toptal.net/fx-27-document-npm-link

@toptal-devbot
Copy link
Collaborator

Successfully deployed demo at https://picasso.toptal.net/fx-27-document-npm-link

1 similar comment
@toptal-devbot
Copy link
Collaborator

Successfully deployed demo at https://picasso.toptal.net/fx-27-document-npm-link

@vedrani vedrani merged commit 0e82c6d into master Mar 12, 2019
@vedrani vedrani deleted the fx-27-document-npm-link branch March 12, 2019 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Chore Everything not related to a new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants