Giter VIP home page Giter VIP logo

allene's Introduction

Allene: keep interdependent JS packages in sync

Working on multiple related packages? Dependency tree look something like this?

******MyPackageA******
 ^      ^         ^
 |      |         |
 | MyPackageB MyPackageC
 |      ^
 |      |
MyPackageD

Allene can help. It keeps your packages in sync across your whole project:

  • always use latest versions of your packages
  • uniformly update third-party dependencies
  • find unused dependencies

This is an alternative to using a monorepo with lerna and yarn workspaces. You get many of the same benefits, but you can continue using a separate repo for each package.

Install

  1. Install dependencies: bash, parallel, sed, jq, Node.js and NPM/Yarn
  2. Get repo: git clone https://github.com/ariutta/allene.git
  3. Add allene to PATH: export PATH="allene:$PATH"

Usage

  1. Login: npm login or yarn login (to let Allene know which packages belong to you)

  2. In an empty directory of your choosing, initialize for your package: allene init '<your-package-name>'

    Your specified package and any of its dependencies that are also yours will be organized like this:

    |--node_modules (third-party)
    |--packages (yours)
    |  |--MyPackageA
    |  |  |--package.json
    |  |  |--...
    |  |--MyPackageB
    |  |  |--package.json
    |  |  |--...
    |  |--MyPackageC
    |  |  |--package.json
    |  |  |--...
    |  |--MyPackageD
    |  |  |--package.json
    |  |  |--...
    |--...
    

    You can cd into your packages, edit files and git push/pull just like normal.

  3. Update dependencies: allene update

  4. Find unused dependencies: allene depcheck

Run allene --help to see all available commands.

If you have yarn installed, allene will use it instead of npm. To force usage of npm, set the ALLENE_PACMAN_CLI env var: export ALLENE_PACMAN_CLI="npm"

Example

If you're on the Pvjs team, you can create a dev environment for package @wikipathways/pvjs:

  1. Login: npm login
  2. Create workspaces structure for package @wikipathways/pvjs: ALLENE_PACMAN_CLI="npm"; ../../allene/allene init '@wikipathways/pvjs'
  3. Update: ALLENE_PACMAN_CLI="npm"; ../../allene/allene update
  4. Find unused dependencies: ../../allene/allene depcheck

TODO

all namespaced or all not

handle the case where all deps are namespaced or all are not

tsc --rootDirs

Do we want to specify rootDirs for the top-level package.json?

npm package version formats

"^1.9 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3.0.0"

Useful JQ queries

Get the path to any peerDependencies keys: cat npm-ls-out.json | jq 'path(..|.peerDependencies? | select(. != null))'

allene's People

Contributors

ariutta avatar dependabot[bot] avatar

Watchers

 avatar  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.