Skip to content

Commit

Permalink
Support npm@7 (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruyadorno authored May 15, 2020
1 parent a4643be commit 2075830
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';

const packageJson = process.env.npm_package_json;
const userAgent = process.env.npm_config_user_agent;
const isYarn = Boolean(userAgent && userAgent.startsWith('yarn'));
const isNpm = Boolean(userAgent && userAgent.startsWith('npm'));
const isNpm7 = Boolean(packageJson && packageJson.endsWith('package.json'));

module.exports.isNpmOrYarn = isNpm || isYarn;
module.exports.isNpm = isNpm;
module.exports.isNpmOrYarn = isNpm || isNpm7 || isYarn;
module.exports.isNpm = isNpm || isNpm7;
module.exports.isYarn = isYarn;

0 comments on commit 2075830

Please sign in to comment.