You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 4 година
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # is-npm [![Build Status](https://travis-ci.org/sindresorhus/is-npm.svg?branch=master)](https://travis-ci.org/sindresorhus/is-npm)
  2. > Check if your code is running as an [npm](https://docs.npmjs.com/misc/scripts) or [yarn](https://yarnpkg.com/lang/en/docs/cli/run/) script
  3. ## Install
  4. ```
  5. $ npm install is-npm
  6. ```
  7. ## Usage
  8. ```js
  9. const {isNpmOrYarn, isNpm, isYarn} = require('is-npm');
  10. console.table({isNpmOrYarn, isNpm, isYarn});
  11. ```
  12. ```sh
  13. $ node foo.js
  14. # ┌─────────────┬────────┐
  15. # │ (index) │ Values │
  16. # ├─────────────┼────────┤
  17. # │ isNpmOrYarn │ false │
  18. # │ isNpm │ false │
  19. # │ isYarn │ false │
  20. # └─────────────┴────────┘
  21. $ npm run foo
  22. # ┌─────────────┬────────┐
  23. # │ (index) │ Values │
  24. # ├─────────────┼────────┤
  25. # │ isNpmOrYarn │ true │
  26. # │ isNpm │ true │
  27. # │ isYarn │ false │
  28. # └─────────────┴────────┘
  29. $ yarn run foo
  30. # ┌─────────────┬────────┐
  31. # │ (index) │ Values │
  32. # ├─────────────┼────────┤
  33. # │ isNpmOrYarn │ true │
  34. # │ isNpm │ false │
  35. # │ isYarn │ true │
  36. # └─────────────┴────────┘
  37. ```
  38. ---
  39. <div align="center">
  40. <b>
  41. <a href="https://tidelift.com/subscription/pkg/npm-is-npm?utm_source=npm-is-npm&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
  42. </b>
  43. <br>
  44. <sub>
  45. Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
  46. </sub>
  47. </div>