Skip to content
/ unnpm Public

🧩 Universal npm package manager for programmatic use

License

Notifications You must be signed in to change notification settings

briojs/unnpm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧩 unnpm

Stands for universal npm

npm version npm downloads bundle size license

Install

# npm
npm install -D unnpm

# yarn
yarn add -D unnpm

# pnpm
pnpm install -D unnpm

# bun
bun install -D unnpm

Detecting package manager

import { detectPackageManager } from "unnpm";

const pm = detectPackageManager();

First unnpm will check if there is packageManager field in your package.json. Then it will scan for lock files and pm specific files. If it fails, it will default to npm.

If there are multiple package managers detected, it throws an error, unless strict option is set to false.

ParserOptions

  • strict - boolean, default true
  • cwd - string, default process.cwd()
  • ignorePackageManagerField - boolean, default false
  • ignoreExtraFiles - boolean, default false

To use options in other function, you can use detectOptions field in the function options

import { installDependencies } from "unnpm";

await installDependencies({
  detectOptions: { strict: false },
});

Installing dependencies

import { installDependencies } from "unnpm";

await installDependencies({ options });

Adding and removing dependencies

import { addDependency, removeDependency } from "unnpm";

await addDependency("typescript@5.4.5", { options });

await removeDependency("typescript", { options });

Published under the MIT license. Made by @malezjaa and community 💛

About

🧩 Universal npm package manager for programmatic use

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages