Git Product home page Git Product logo

narn's Introduction

narn

Never have to switch between yarn, npm, and pnpm commands ever again.

narn is a CLI that detects whether your current npm package is using npm, yarn, or pnpm. It then spawns the correct one with the correct arguments. The arguments to narn itself are exactly the same as if you're using yarn. The command will be converted to npm or pnpm's syntax if the current package is managed by npm / pnpm.

Installation

npm i -g narn

yarn global add narn

pnpm i -g narn

Extras

If you run narn upgrade-interactive on a project managed by npm, you'll need to globally install ncu.

If you run narn publish on a project managed by npm, you'll need to globally install np.

Usage

# To install from package.json
narn # or narn install

# To add new package
narn add react

# To remove a package
narn remove react

# Add a dev dependency
narn add --dev webpack
narn add -D webpack

# Run a script from the package.json
narn test
narn build

# Publish with interactive UI
narn publish

# Upgrade dependencies with interactive ui
narn upgrade-interactive
narn upgrade-interactive --latest

# Install global library. All global libs are installed with yarn (since the most important thing is just that you consistently use the same package manager for global libs)
narn global add @vue/cli

# yarn create single-spa is similar to npm init single-spa
narn create single-spa

# View the installed versions of narn and yarn/npm
narn -v
narn --version

# global commands are supported too
narnx global add http-server
narnx global remove http-server

# Run npx / pnpx
narnx create-single-spa

For more usage, see the Yarn CLI docs - narn's cli is meant to behave exactly the same.

Default Package Manager

To set the default package manager that's used in projects that don't have a yarn.lock, pnpm-lock.yaml, or package-lock.json, set the NARN_DEFAULT_PM environment variable. You can also add this to your bashrc (or equivalent) to ensure the variable is always there.

export NARN_DEFAULT_PM=pnpm
narn

Publish behavior

By default, narn uses np on npm and pnpm projects. However, np doesn't support pnpm. Because of that, it might be desireable to turn off np as the handler for npm publish. To disable np, set the following environment variable:

export NARN_PUBLISH=passthrough
narn publish

narn's People

Contributors

joeldenning avatar dependabot[bot] avatar rabbitzzc 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.