is-installed-globally
Advanced tools
Comparing version 0.4.0 to 1.0.0
@@ -6,3 +6,3 @@ /** | ||
``` | ||
import isInstalledGlobally = require('is-installed-globally'); | ||
import isInstalledGlobally from 'is-installed-globally'; | ||
@@ -20,2 +20,2 @@ // With `npm install your-package` | ||
export = isInstalledGlobally; | ||
export default isInstalledGlobally; |
19
index.js
@@ -1,11 +0,14 @@ | ||
'use strict'; | ||
const fs = require('fs'); | ||
const globalDirs = require('global-dirs'); | ||
const isPathInside = require('is-path-inside'); | ||
import fs from 'node:fs'; | ||
import path from 'node:path'; | ||
import {fileURLToPath} from 'node:url'; | ||
import globalDirectory from 'global-directory'; | ||
import isPathInside from 'is-path-inside'; | ||
module.exports = (() => { | ||
const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
const isInstalledGlobally = (() => { | ||
try { | ||
return ( | ||
isPathInside(__dirname, globalDirs.yarn.packages) || | ||
isPathInside(__dirname, fs.realpathSync(globalDirs.npm.packages)) | ||
isPathInside(__dirname, globalDirectory.yarn.packages) | ||
|| isPathInside(__dirname, fs.realpathSync(globalDirectory.npm.packages)) | ||
); | ||
@@ -16,1 +19,3 @@ } catch { | ||
})(); | ||
export default isInstalledGlobally; |
{ | ||
"name": "is-installed-globally", | ||
"version": "0.4.0", | ||
"version": "1.0.0", | ||
"description": "Check if your package was installed globally", | ||
@@ -13,4 +13,10 @@ "license": "MIT", | ||
}, | ||
"type": "module", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=18" | ||
}, | ||
@@ -43,14 +49,14 @@ "scripts": { | ||
"dependencies": { | ||
"global-dirs": "^3.0.0", | ||
"is-path-inside": "^3.0.2" | ||
"global-directory": "^4.0.1", | ||
"is-path-inside": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"cpy": "^8.1.1", | ||
"del": "^6.0.0", | ||
"execa": "^5.0.0", | ||
"make-dir": "^3.1.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.37.1" | ||
"ava": "^5.3.1", | ||
"cpy": "^8", | ||
"del": "^7.1.0", | ||
"execa": "^8.0.1", | ||
"make-dir": "^4.0.0", | ||
"tsd": "^0.29.0", | ||
"xo": "^0.56.0" | ||
} | ||
} |
@@ -9,5 +9,5 @@ # is-installed-globally | ||
```sh | ||
npm install is-installed-globally | ||
``` | ||
$ npm install is-installed-globally | ||
``` | ||
@@ -17,3 +17,3 @@ ## Usage | ||
```js | ||
const isInstalledGlobally = require('is-installed-globally'); | ||
import isInstalledGlobally from 'is-installed-globally'; | ||
@@ -33,2 +33,2 @@ // With `npm install your-package` | ||
- [resolve-global](https://github.com/sindresorhus/resolve-global) - Resolve the path of a globally installed module | ||
- [global-dirs](https://github.com/sindresorhus/global-dirs) - Get the directory of globally installed packages and binaries | ||
- [global-directory](https://github.com/sindresorhus/global-directory) - Get the directory of globally installed packages and binaries |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3904
32
1
1
Yes
+ Addedglobal-directory@^4.0.1
+ Addedglobal-directory@4.0.1(transitive)
+ Addedini@4.1.1(transitive)
+ Addedis-path-inside@4.0.0(transitive)
- Removedglobal-dirs@^3.0.0
- Removedglobal-dirs@3.0.1(transitive)
- Removedini@2.0.0(transitive)
- Removedis-path-inside@3.0.3(transitive)
Updatedis-path-inside@^4.0.0