Get the type of the installer that is used at the directory provided whether
npm
,yarn
orpnpm
. Open to PR's for other options.
get-installer
is designed to be used inside your node project.
First, install the plugin and it's peer dependencies:
npm install --save get-installer
or
yarn add get-installer
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');
import { InstallerType } from 'get-installer';
The currently supported installers are 'yarn'
, 'npm'
and 'pnpm'
.
import { getInstaller } from 'get-installer';
Returns a promise resolving to the InstallerType
. Defaults to 'npm'
if it can't properly be resolved.
import { getInstallerSync } from 'get-installer';
Returns the InstallerType
. Defaults to 'npm'
if it can't properly be resolved.
Dive into the codebase with Gitpod.
This project uses SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MIT License - see the LICENSE file for details
Ifiok Jr. đź’» |