Giter VIP home page Giter VIP logo

connect-deps's Introduction

connect-deps NPM Version NPM Downloads NPM License

This is a CLI tool that intends to be a better yarn/npm link

When you do a yarn/npm link in the current repo, it creates a symlink to the dependency in your machine and this gives you the wrong dependency tree, because node_modules inside the linked dependency will be the one already in the there not the one that you would get from a clean yarn/npm install in the current repo.

This can became problematic in some cases, to solve this problem this package "links" (we call it connect) a dependency by running yarn pack in the connected dependency and yarn add file:/path/to/pack.tgz in the current repo.

For a real world example where npm link failed, see the blog post When npm link fails.

Support for unpublished packages or packages not listed in package.json is also included.

Usage

# first link the dependency from your current repo
connect-deps link ../package-linked
# after, you can `connect` to stay in sync
connect-deps connect
# or use watch mode to listen to changes and update the current repo
connect-deps connect -w
# after you done with coding run `reset` to cleanup and go back to previous versions
connect-deps reset
# Reset may not leave your package.json exactly like before `connect` (https://github.com/hugomrdias/connect-deps/issues/3#issuecomment-517668975) but the change should not be harmful and you can always ignore the change before commiting.

# tips
# link multiple, connect and watch in one command
connect-deps link ../package-linked ../package-linked2 --connect --watch

CLI

$ npm install --global connect-deps
$ connect-deps --help

Usage
    $ connect-deps [cmd]

Commands
    link /relative/path  Relative path from cwd to dependency to connect.
    connect              Connect a linked dependency.
    reset                Reset everything and clean up.

Options
    --help               Show help.
    --watch, -w          Watch for changes.
    --connect, -c        Can be used with link command to also connect.
    --manager            Package manager to use npm or yarn.

Examples
    $ connect-deps link ../dep-folder
    $ connect-deps link ../dep-folder1 ../dep-folder2 -c -w
    $ connect-deps connect -w

License

MIT © Hugo Dias

connect-deps's People

Contributors

dependabot-preview[bot] avatar hugomrdias avatar pcowgill avatar satazor avatar vmx avatar

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.