Socket
Socket
Sign inDemoInstall

detect-package-manager

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-package-manager - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

10

index.js

@@ -21,2 +21,6 @@ const path = require('path')

function getTypeofLockFile(cwd = '.') {
if (cache.has('typeofLockFile')) {
return Promise.resolve(cache.get('typeofLockFile'))
}
return Promise.all([

@@ -26,3 +30,5 @@ pathExists(path.resolve(cwd, 'yarn.lock')),

]).then(([isYarn, isNpm]) => {
return isYarn ? 'yarn' : isNpm ? 'npm' : null
const value = isYarn ? 'yarn' : isNpm ? 'npm' : null
cache.set('typeofLockFile', value)
return value
})

@@ -47,1 +53,3 @@ }

}
module.exports.clearCache = () => cache.clear()

2

package.json
{
"name": "detect-package-manager",
"version": "1.0.1",
"version": "1.1.0",
"description": "Detect which package manager you're using (yarn or npm)",

@@ -5,0 +5,0 @@ "repository": {

@@ -8,4 +8,5 @@

1. When there's `yarn.lock` or `package-lock.json` in current working directory, it will skip other opeations and directly resolves `yarn` or `npm`
2. When there's no lockfile was found, it checks if `yarn` command is install. If so it resolves `yarn` otherwise `npm`
1. When there's `yarn.lock` or `package-lock.json` in current working directory, it will skip other operations and directly resolves `yarn` or `npm`
2. When there's no lockfile was found, it checks if `yarn` command exists. If so it resolves `yarn` otherwise `npm`
3. Results are cached

@@ -53,2 +54,6 @@ ## Install

### detectPackageManager.clearCache()
Clear cache.
## Contributing

@@ -55,0 +60,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc