Nutty Peanut Marshmallow

    @318h7/nlink

    1.3.0 • Public • Published

    nlink

    pipeline coverage TypeScript MIT Licence tested with jest semantic-release PRs Welcome

    nlink is a CLI utility to aid linking Node.js projects for development

    • wrapper around npm\yarn link
    • analyzes multi-repo folder to create a map of interdependent projects
    • links projects to bring mono-repo powers to multi-repos
    • TypeScript friendly
    • contextual actions to aid linking during development

    Status

    The project is in beta phase. PRs are very welcome. As well as issues and suggestions

    If something isn't working for you, do raise an issue.

    Work in progress:

    • Typescript type safe linking
    • Scope (wildcard) matching

    Planned functionality:

    • Watch mode (link and wait, then unlink on quit)

    Installation

    yarn

    yarn global add @318h7/nlink

    npm

    npm install -g @318h7/nlink

    Note: You will probably need to run the commands with sudo

    Usage

    nlk [command]
    
    Commands:
      nlk setup          Creates project map in the current location
      nlk link [name]    Links project dependencies
      nlk unlink [name]  Uninks project dependencies
    
    Options:
      --help     Show help                                                 [boolean]
      --version  Show version number                                       [boolean]

    Description

    Setup

    To analyze a folder and link all developed projects together:

    cd projects/my_multy_repo
    nlk setup
    nlk link

    The setup command will traverse current directory in search of node projects, and save a map in the file .nlink.json Don't be afraid to edit the file manually according to your needs, it's just a plane JSON. After creating the file it will run yarn/npm link to register projects for linking. Running link command without parameters will link together all developed projects. Consequent runs of setup will just prepare the links.

    In order to regenerate the projects map:

    nlk setup --force

    Linking 🔗

    Info

    • nlink accepts the package name (name field in the package.json) or the folder name where the project is located as a dependency name.

    • nlink will detect if project is using npm or yarn as dependency manager and execute the appropriate command.

    • nlink will also detect if project is using TypeScript and check if any other project dependencies depend on the same package you are trying to link. It will link all related projects, to avoid type errors in case of incompatible type update in related projects.

    Commands

    To setup links for all project dependencies:

    cd project_in_question
    nlk link

    Note: If run from a projects that has no dependencies, creates links in all projects that depend on that package:

    To link a dependency:

    cd depending_project
    nlk link <dependency>

    Note: If run from a project that has no named dependency, will try to link current directory project in the named one.

    To link couple of packages:

    cd depending_project
    nlk link <dependency_A> <dependency_B>

    To link scoped packages:

    cd depending_project
    nlk link @example/**

    Will link all dependencies that have @example scope in the name.

    🦄 To link all the dependencies in the multi-repo:

    cd <folder with .nlink.json>
    nlk link

    Install

    npm i @318h7/nlink

    DownloadsWeekly Downloads

    12

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    152 kB

    Total Files

    27

    Last publish

    Collaborators

    • 318h7