Skip to content

sheinsight/snm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

77212c1 · Sep 12, 2024
Jul 29, 2024
Jul 25, 2024
Apr 19, 2024
Aug 6, 2024
Jul 29, 2024
Mar 29, 2024
May 17, 2024
Jul 25, 2024
Feb 21, 2024
Jun 4, 2024
Jul 24, 2024
Jul 23, 2024
Jun 24, 2024
Jul 29, 2024
Jun 7, 2024

Repository files navigation

SNM

🤔 What is SNM ?

snm = corepack + fnm + ni .

  • 📦 Node、Npm、Pnpm、Yarn Version Manager
  • 💡 Use the right package manager
  • ✅ Verify if package manager meets the 'packageManager' configuration
  • 🌟 CodeWhisperer ( Fig ) Friendly

⚙️ How to install

curl -fsSL https://raw.githubusercontent.com/sheinsight/snm/main/install.sh | bash

Parameters

--install-dir

Custom installation directory, default is ~/.snm.

Example:

curl -fsSL https://raw.githubusercontent.com/sheinsight/snm/main/install.sh | bash -s -- --install-dir "./.snm"

--skip-shell

Skip automatic configuration of shell environment variables .

If you install directory to /bin directory, you may not need to configure shell environment variables.

Example:

curl -fsSL https://raw.githubusercontent.com/sheinsight/snm/main/install.sh | bash -s -- --skip-shell

--force-install

Forcing the use of shell scripts for installation

Example:

curl -fsSL https://raw.githubusercontent.com/sheinsight/snm/main/install.sh | bash -s -- --force-install

--version

Specify the installation version

Example:

curl -fsSL https://raw.githubusercontent.com/sheinsight/snm/main/install.sh | bash -s -- --version "0.0.1-27"

Of course, you can combine multiple parameters. Example:

curl -fsSL https://raw.githubusercontent.com/sheinsight/snm/main/install.sh | bash -s -- --install-dir "./.fnm" --skip-shell --version "0.0.1-27"

Environment Variables

Local directory configuration

name default description
SNM_BASE_DIR ~/.snm Installation directory
SNM_NODE_BIN_DIR ~/.snm/bin Node binary directory
SNM_DOWNLOAD_DIR ~/.snm/download Download directory
SNM_NODE_MODULES_DIR ~/.snm/node_modules Node modules directory

Remote resource configuration

name default description
SNM_NPM_REGISTRY_HOST https://registry.npmjs.org Npm host
SNM_YARN_REGISTRY_HOST_KEY https://registry.yarnpkg.com Yarn registry , Used by less 2.0.0
SNM_YARN_REPO_HOST_KEY https://repo.yarnpkg.com Yarn registry , Used by greater 2.0.0
SNM_NODEJS_DIST_URL_KEY https://nodejs.org/dist Nodejs Host
SNM_NODEJS_GITHUB_RESOURCE_HOST_KEY https://raw.githubusercontent.com Github resource host

Function configuration

name default description
SNM_STRICT false strict mode
SNM_NODE_INSTALL_STRATEGY ask Install Strategy , Optional ask|panic|auto
SNM_PACKAGE_MANAGER_INSTALL_STRATEGY ask Install Strategy , Optional ask|panic|auto

Todo List

Node Manager

  • snm node list
  • snm node list-remote
  • snm node install 20.11.1
  • snm node uninstall 20.11.1
  • snm node default 20.11.1
  • snm node env

Npm Manager

  • snm npm list
  • snm npm list-remote
  • snm npm install 7.5.6
  • snm npm uninstall 7.5.6
  • snm npm default 7.5.6

Pnpm Manager

  • snm pnpm list
  • snm pnpm list-remote
  • snm pnpm install 6.7.5
  • snm pnpm uninstall 6.7.5
  • snm pnpm default 6.7.5

Yarn Manager

  • snm yarn list
  • snm yarn list-remote
  • snm yarn install 1.22.10
  • snm yarn uninstall 1.22.10
  • snm yarn default 1.22.10

CodeWhisperer

  • snm fig-spec

Use the right package manager

  • snm install
  • snm ci
  • snm add
  • snm delete
  • snm run
  • snm dlx
  • snm exec

Self Developed

  • snm query

  • snm bump

  • snm outdated

  • snm update

  • snm dedupe

  • corepack auto download

  • check valid package manager

  • execute package manager command

Run test

use cargo-nextest to run tests

for Mac:

curl -LsSf https://get.nexte.st/latest/mac | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin

# Without --test-threads=1, test will fail
cargo nextest run --test-threads=1