ifiokjr / get-installer

Get the installer used (pnpm, yarn or npm), for a particular root directory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get-installer

All Contributors

GitHub Actions Build Status Version Weekly Downloads Typed Codebase MIT License semantic-release


Get the type of the installer that is used at the directory provided whether npm, yarn or pnpm. Open to PR's for other options.


Table of Contents


Usage

get-installer is designed to be used inside your node project.


Setup

First, install the plugin and it's peer dependencies:

npm install --save get-installer

or

yarn add get-installer

Code Example

The following will return the type of installer that is active at the given directory.

import { getInstallerSync } from 'get-installer';

const installer = getInstallerSync('/path/to/project');

The async method can also be used.

import { getInstaller } from 'get-installer';

const installer = await getInstaller('/path/to/project');

API

InstallerType

import { InstallerType } from 'get-installer';

The currently supported installers are 'yarn', 'npm' and 'pnpm'.

getInstaller

import { getInstaller } from 'get-installer';

Returns

Returns a promise resolving to the InstallerType. Defaults to 'npm' if it can't properly be resolved.

getInstallerSync

import { getInstallerSync } from 'get-installer';

Returns

Returns the InstallerType. Defaults to 'npm' if it can't properly be resolved.


Contributing

Dive into the codebase with Gitpod.

Open in Gitpod


Versioning

This project uses SemVer for versioning. For the versions available, see the tags on this repository.


License

This project is licensed under the MIT License - see the LICENSE file for details

Contributors


Ifiok Jr.

đź’»

About

Get the installer used (pnpm, yarn or npm), for a particular root directory

License:MIT License


Languages

Language:TypeScript 100.0%