GithubHelp home page GithubHelp logo

azu / ni.zsh Goto Github PK

View Code? Open in Web Editor NEW
94.0 2.0 6.0 242 KB

Alternative `ni` written in zsh: npm/yarn/pnpm/bun with the same command

License: MIT License

Shell 100.00%
bun node npm pnpm shell-script yarn security

ni.zsh's Introduction

Alternative ni written in zsh

ni - use the right package manager

You can run npm/yarn/pnpm/bun with same command!

Installation

Using Zinit

zinit load azu/ni.zsh

Using Antigen

antigen bundle azu/ni.zsh@main

Using sheldon

[plugins.ni]
github = "azu/ni.zsh"

Manually

curl https://raw.githubusercontent.com/azu/ni.zsh/main/ni.zsh > ni.zsh
source ni.zsh

⚠️ Troubleshooting: command not found: compdef

ni.zsh requires compdef command. If you got command not found: compdef error, you need to enable compinit in your .zshrc.

# .zshrc
# load compdef
autoload -Uz compinit && compinit
# load ni.zsh
source /path/to/ni.zsh

Supported Package Manager

Requirements

  • zsh
    • require to enable autoload -Uz compinit && compinit
  • jq
  • npm-check if you want to use npm + ni upgrade-interactive

Usage

ni                      -- install current package.json
ni add <pkg>            -- add package
ni remove <pkg>         -- remove package
ni run <script>         -- run scripts
ni test                 -- run test script
ni upgrade [<pkg>]      -- upgrade packages
ni upgrade-interactive  -- upgrade package interactively
ni exec <command>       -- execute command
ni dlx <pkg>            -- download package and execute command

Command Table

ni npm yarn yarn-berry pnpm bun
ni npm install yarn install yarn install pnpm install bun install
ni add <pkg> npm install yarn add yarn add pnpm add bun add
ni remove <pkg> npm uninstall yarn remove yarn remove pnpm remove bun remove
ni run <script> npm run yarn run yarn run pnpm run bun run
ni test npm run test yarn run test yarn run test pnpm run test bun run test
ni upgrade npm upgrade yarn upgrade yarn up pnpm update bun update
ni upgrade-interactive npm-check^1 yarn up --interactive "*" yarn upgrade-interactive pnpm update -i
ni exec <command> npm exec --no yarn <command> yarn exec pnpm exec bunx
ni dlx <pkg> npx npx yarn dlx pnpm dlx bunx

Notes

  • Installing devDependencies: ni add --dev <pkg>
  • Additional arguments for ni run: ni run dev --port 8080
  • Update specific package: ni upgrade <pkg>

Auto Complete

ni <TAB>

Experimental

Supply chain risk detections

You can integrate https://socket.dev/ to detect supply chain attacks.

Socket.dev Integration

Aug-26-2023.09-51-59_optimized.mp4

If NI_SOCKETDEV_TOKEN is set, ni add will check the package is safe or not before installing.

export NI_SOCKETDEV_TOKEN="<socket-token>"

How to get socket.dev token?

  1. Go to https://socket.dev/
  2. Sign up
  3. Create a project
  4. Visit https://socket.dev/dashboard/org/gh/{user}/settings/api-tokens
  5. Copy token

License

MIT © azu

ni.zsh's People

Contributors

azu avatar himanoa avatar mimikun avatar mono0x avatar naporin0624 avatar odanado avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ni.zsh's Issues

zsh compdef need compinit

Need these setup to run

autoload -Uz compinit
compinit

Error without compinit

~/.local/share/sheldon/repos/github.com/azu/ni.zsh/ni.zsh:510: command not found: compdef

ni exec

ni exec textlint

# npm exec textlint or npx textlint
# yarn dlx textlint
# pnpm dlx textlint
# bunx textlint

With arguments

ni exec textlint --help

# npm exec textlint -- --help
# or npx textlint
# yarn dlx textlint -- --help
# pnpm dlx textlint -- --help
# bunx textlint -- --help

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.