• Stars
    star
    4,527
  • Rank 9,032 (Top 0.2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ’ก Use the right package manager

ni

npm i in a yarn project, again? F**k!

ni - use the right package manager


npm i -g @antfu/ni

npm ยท yarn ยท pnpm ยท bun


ni - install

ni

# npm install
# yarn install
# pnpm install
# bun install
ni vite

# npm i vite
# yarn add vite
# pnpm add vite
# bun add vite
ni @types/node -D

# npm i @types/node -D
# yarn add @types/node -D
# pnpm add -D @types/node
# bun add -d @types/node
ni --frozen

# npm ci
# yarn install --frozen-lockfile (Yarn 1)
# yarn install --immutable (Yarn Berry)
# pnpm install --frozen-lockfile
# bun install --no-save
ni -g eslint

# npm i -g eslint
# yarn global add eslint (Yarn 1)
# pnpm add -g eslint
# bun add -g eslint

# this uses default agent, regardless your current working directory

nr - run

nr dev --port=3000

# npm run dev -- --port=3000
# yarn run dev --port=3000
# pnpm run dev --port=3000
# bun run dev --port=3000
nr

# interactively select the script to run
# supports https://www.npmjs.com/package/npm-scripts-info convention
nr -

# rerun the last command

nlx - download & execute

nlx vitest

# npx vitest
# yarn dlx vitest
# pnpm dlx vitest
# bunx vitest

nu - upgrade

nu

# (not available for bun)
# npm upgrade
# yarn upgrade (Yarn 1)
# yarn up (Yarn Berry)
# pnpm update
nu -i

# (not available for npm & bun)
# yarn upgrade-interactive (Yarn 1)
# yarn up -i (Yarn Berry)
# pnpm update -i

nun - uninstall

nun webpack

# npm uninstall webpack
# yarn remove webpack
# pnpm remove webpack
# bun remove webpack
nun -g silent

# npm uninstall -g silent
# yarn global remove silent
# pnpm remove -g silent
# bun remove -g silent

nci - clean install

nci

# npm ci
# yarn install --frozen-lockfile
# pnpm install --frozen-lockfile
# bun install --no-save

if the corresponding node manager is not present, this command will install it globally along the way.


na - agent alias

na

# npm
# yarn
# pnpm
# bun
na run foo

# npm run foo
# yarn run foo
# pnpm run foo
# bun run foo

Change Directory

ni -C packages/foo vite
nr -C playground dev

Config

; ~/.nirc

; fallback when no lock found
defaultAgent=npm # default "prompt"

; for global installs
globalAgent=npm
# ~/.bashrc

# custom configuration file path
export NI_CONFIG_FILE="$HOME/.config/ni/nirc"

How?

ni assumes that you work with lockfiles (and you should)

Before it runs, it will detect your yarn.lock / pnpm-lock.yaml / package-lock.json / bun.lockb to know current package manager (or packageManager field in your packages.json if specified), and runs the corresponding commands.

Trouble shooting

Conflicts with PowerShell

PowerShell comes with a built-in alias ni for the New-Item cmdlet. To remove the alias in your current PowerShell session in favor of this package, use the following command:

'Remove-Item Alias:ni -Force -ErrorAction Ignore'

If you want to persist the changes, you can add them to your PowerShell profile. The profile path is accessible within the $profile variable. The ps1 profile file can normally be found at

  • PowerShell 5 (Windows PowerShell): C:\Users\USERNAME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
  • PowerShell 7: C:\Users\USERNAME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
  • VSCode: C:\Users\USERNAME\Documents\PowerShell\Microsoft.VSCode_profile.ps1

You can use the following script to remove the alias at shell start by adding the above command to your profile:

if (-not (Test-Path $profile)) {
  New-Item -ItemType File -Path (Split-Path $profile) -Force -Name (Split-Path $profile -Leaf)
}

$profileEntry = 'Remove-Item Alias:ni -Force -ErrorAction Ignore'
$profileContent = Get-Content $profile
if ($profileContent -notcontains $profileEntry) {
  $profileEntry | Out-File $profile -Append -Force
}

nx and nix is no longer available

We renamed nx/nix to nlx to avoid conflicts with the other existing tools - nx and nix. You can always alias them back on your shell configuration file (.zshrc, .bashrc, etc).

alias nx="nlx"
# or
alias nix="nlx"

More Repositories

1

vitesse

๐Ÿ• Opinionated Vite + Vue Starter Template
TypeScript
8,522
star
2

icones

โšก๏ธ Icon Explorer with Instant searching, powered by Iconify
Vue
4,525
star
3

unplugin-vue-components

๐Ÿ“ฒ On-demand components auto importing for Vue
TypeScript
3,011
star
4

unocss

The instant on-demand atomic CSS engine.
TypeScript
2,990
star
5

unplugin-icons

๐Ÿคน Access thousands of icons as components on-demand universally.
TypeScript
2,793
star
6

vitesse-webext

โšก๏ธ WebExtension Vite Starter Template
TypeScript
2,581
star
7

unplugin-auto-import

Auto import APIs on-demand for Vite, Webpack and Rollup
TypeScript
2,307
star
8

vscode-file-nesting-config

Config of File Nesting for VS Code
JavaScript
2,132
star
9

vue-starport

๐Ÿ›ฐ Shared component across routes with animations
TypeScript
1,744
star
10

vscode-settings

My VS Code settings and extensions
1,739
star
11

eslint-config

Anthony's ESLint config presets
JavaScript
1,605
star
12

vitesse-nuxt3

Vitesse for Nuxt 3 ๐Ÿ”๐Ÿ’šโšก๏ธ
TypeScript
1,510
star
13

shikiji

A syntax highlighter based on TextMate grammars. ESM rewrite of shiki, with more features and capabilities.
TypeScript
1,483
star
14

reactivue

๐Ÿ™Š Use Vue Composition API in React components
TypeScript
1,352
star
15

taze

๐Ÿฅฆ A modern cli tool that keeps your deps fresh
TypeScript
1,233
star
16

vite-ssg

Static site generation for Vue 3 on Vite
TypeScript
1,198
star
17

handle

A Chinese Hanzi variation of Wordle - ๆฑ‰ๅญ— Wordle
TypeScript
1,194
star
18

case-police

๐Ÿšจ Make the case correct, PLEASE!
TypeScript
1,098
star
19

vite-plugin-inspect

Inspect the intermediate state of Vite plugins
Vue
1,009
star
20

qrcode-toolkit

Anthony's QR Code Toolkit for AI generated QR Codes
Vue
1,008
star
21

use

Things I am using
946
star
22

vitesse-lite

โ›บ๏ธ Lightweight version of Vitesse
TypeScript
901
star
23

drauu

Headless SVG-based drawboard in browser.
TypeScript
817
star
24

broz

A simple, frameless browser for screenshots
JavaScript
745
star
25

iroiro

Beautiful Colors Lookup in CLI
TypeScript
735
star
26

retypewriter

Replay the steps of your changes at ease.
TypeScript
715
star
27

live-draw

A tool allows you to draw on screen real-time.
C#
640
star
28

changelogithub

Generate changelog for GitHub
TypeScript
613
star
29

sd-webui-qrcode-toolkit

Anthony's QR Toolkit for Stable Diffusion WebUI
JavaScript
604
star
30

vscode-smart-clicks

Smart selection with double clicks for VS Code.
TypeScript
601
star
31

vite-plugin-md

Markdown with Vue for Vite
TypeScript
580
star
32

unplugin-vue2-script-setup

๐Ÿ’ก Bring `<script setup>` to Vue 2.
TypeScript
567
star
33

eslint-flat-config-viewer

A visual tool to help you view and understand your ESLint Flat config.
Vue
557
star
34

sponsorkit

๐Ÿ’– Toolkit for generating sponsors images ๐Ÿ˜„
TypeScript
550
star
35

unconfig

A universal solution for loading configurations.
TypeScript
524
star
36

utils

Collection of common JavaScript / TypeScript utils
TypeScript
493
star
37

100

My 100-day project of exploring design, compform, and new things.
Vue
491
star
38

v-lazy-show

Compile-time directive to lazy initialize v-show for Vue
TypeScript
480
star
39

antfu.me

My personal website
Markdown
463
star
40

vue-reuse-template

Define and reuse Vue template inside the component scope.
TypeScript
440
star
41

raycast-multi-translate

A Raycast extension that translates text to multiple languages at once
TypeScript
431
star
42

vite-node

Vite as Node.js runtime
JavaScript
428
star
43

vscode-browse-lite

๐Ÿš€ An embedded browser in VS Code
TypeScript
425
star
44

vscode-vite

One step faster for Vite in VS Code โšก๏ธ
TypeScript
404
star
45

vscode-theme-vitesse

๐Ÿ• Vitesse theme for VS Code
TypeScript
395
star
46

starter-ts

Starter template for TypeScript library
TypeScript
386
star
47

vue-template-promise

Template as Promise in Vue
TypeScript
376
star
48

vue-global-api

Use Vue Composition API globally
TypeScript
331
star
49

vue-router-better-scroller

Enhanced scroll behavior for Vue Router
TypeScript
321
star
50

starter-vscode

Starter template for VS Code Extension
TypeScript
299
star
51

vscode-iconify

๐Ÿ™‚ Iconify IntelliSense for VS Code
TypeScript
294
star
52

1990-script

Make your GitHub history back to 1990
Shell
293
star
53

p

Toolkit for managing multiple promises
TypeScript
284
star
54

qr-scanner-wechat

QR Code scanner in JS with Open CV and WeChat's Algorithm
JavaScript
281
star
55

wenyan-lang-vscode

ๆ–‡่จ€ Wenyan Lang for VS Code
TypeScript
277
star
56

fsxx

File system in zx style
JavaScript
262
star
57

birpc

Message-based two-way remote procedure call.
TypeScript
245
star
58

pnpm-patch-i

A better and interactive pnpm patch
TypeScript
243
star
59

vue-minesweeper

A tiny minesweeper clone in Vue 3
TypeScript
242
star
60

contribute

Contribution guide for my projects
231
star
61

purge-icons

๐ŸŽ Bundles icons on demand
TypeScript
229
star
62

dotfiles

My dotfiles
Shell
227
star
63

vscode-open-in-github-button

Add a button to go to the GitHub on the status bar.
TypeScript
223
star
64

github-doorcat

๐Ÿ˜ผ Supercharges GitHub navbar for fast navigation [WIP]
TypeScript
214
star
65

vscode-goto-alias

Go to Definition following alias redirections.
TypeScript
211
star
66

nuxt-server-fn

Server functions in client for Nuxt 3
TypeScript
194
star
67

refined-github-notifications

UserScript that enhances the GitHub Notifications
JavaScript
194
star
68

prism-theme-vars

A customizable Prism.js theme using CSS variables
CSS
178
star
69

what-time

What time works for you?
Vue
177
star
70

esbuild-node-loader

Transpile TypeScript to ESM with Node.js loader.
JavaScript
176
star
71

vitesse-nuxt-bridge

๐Ÿ• Vitesse experience for Nuxt 2 and Vue 2
Vue
174
star
72

talks

Slides & code for my talks
Vue
170
star
73

userscript-clean-twitter

Bring back the peace on Twitter
JavaScript
170
star
74

fs-spy

Monitoring fs accessing for Node process
TypeScript
166
star
75

magic-string-stack

magic-string with the capability of committing changes.
TypeScript
165
star
76

vite-plugin-glob

The design experiment for import.meta.glob from Vite.
TypeScript
164
star
77

vscode-icons-carbon

Carbon Visual Studio Code product icon theme
TypeScript
157
star
78

vite-plugin-optimize-persist

Persist dynamically analyzed dependencies optimization
TypeScript
155
star
79

diff-match-patch-es

ESM and TypeScript rewrite of Google's diff-match-patch for JavaScript
TypeScript
150
star
80

v-dollar

jQuery-like Vue Reactivity API
TypeScript
146
star
81

eslint-ts-patch

Support loading eslint.config.mjs and eslint.config.ts as flat config files for ESLint.
JavaScript
146
star
82

eslint-typegen

Generate types from ESLint rule schemas, with auto-completion and type-checking for rule options.
TypeScript
144
star
83

.github

The default community health files for all my repos on GitHub
143
star
84

p5i

p5.js, but with more friendly instance mode APIs
TypeScript
133
star
85

markdown-it-github-alerts

Support GitHub-style alerts for markdown-it
TypeScript
132
star
86

magic-string-extra

Extended magic-string with extra utilities
TypeScript
131
star
87

export-size

Analysis bundle cost for each export of a package
TypeScript
130
star
88

local-pkg

Get information on local packages.
TypeScript
126
star
89

vite-plugin-restart

Custom files/globs to restart Vite server
TypeScript
124
star
90

pkg-exports

Get exports of an local npm package.
TypeScript
116
star
91

install-pkg

Install package programmatically.
TypeScript
114
star
92

deploy-check

WIP, Prevent runtime errors earlier in CI
TypeScript
113
star
93

qr-verify

A CLI to verify scannable QR Code in batch
TypeScript
106
star
94

issue-up

Mirror issues to the upstream repos
TypeScript
104
star
95

unplugin-starter

Starter template for unplugin
TypeScript
100
star
96

windicss-runtime-dom

๐Ÿช„ Enables Windi CSS for any site with one-line code without any build tools
TypeScript
100
star
97

rex

๐Ÿ“‘ Transform texts with RegExp like a Pro.
Vue
98
star
98

vscode-auto-npx

Auto resolving local Node.js binaries in VS Code terminal.
TypeScript
96
star
99

vite-plugin-remote-assets

Bundles your assets from remote urls with your app
TypeScript
94
star
100

markdown-it-mdc

MDC (Markdown Components) syntax for markdown-it.
TypeScript
92
star