detect-package-manager
Advanced tools
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() |
{ | ||
"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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5323
43
72