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

Transition to consistent package linking #24

Open
nkuba opened this issue Jul 30, 2020 · 1 comment
Open

Transition to consistent package linking #24

nkuba opened this issue Jul 30, 2020 · 1 comment

Comments

@nkuba
Copy link
Member

nkuba commented Jul 30, 2020

Currently, we've got multiple ways of linking packages between local repos:

  1. npm link

    cd $WORKDIR/keep-core/solidity
    npm link
    cd $WORKDIR/keep-ecdsa/solidity
    npm link
    cd $WORKDIR/tbtc/solidity
    npm link
    printf "${LOG_START}Updating Keep Dashboard configuration...${LOG_END}"
    cd $WORKDIR/keep-core/solidity/dashboard
    npm link @keep-network/keep-core
    npm link @keep-network/keep-ecdsa
    npm link @keep-network/tbtc

  2. Replacing node_modules content

    rm -rf keep-ecdsa/solidity/node_modules/@keep-network/keep-core
    cp -R keep-core/solidity/. keep-ecdsa/solidity/node_modules/@keep-network/keep-core

  3. Replacing the dependency path in package.json

    TBTC_DIR="$WORKDIR/tbtc/solidity" jq '.dependencies."@keep-network/tbtc" = env.TBTC_DIR' package.json > package.json.tmp && mv package.json.tmp package.json

We should be consistent across install scripts (preferably use the first way).

@Shadowfiend
Copy link
Contributor

Notably, npm link creates a global link. That is, if someone wants a local setup working on two versions, they'd have to run the linking step when switching. Using file paths is more brittle to where the repos are with respect to each other, but it is a local link, so if you're maintaining two repo clones with distinct artifact states, as long as they're on the same chain, you can switch between them without modifying anything.

Just food for thought here---I have a mild bias for using a directory reference vs npm link for this reason, but it may not ultimately apply in the context of everything else we do.

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

2 participants