global-cache-dir
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -1,26 +0,20 @@ | ||
"use strict";var _fs=require("fs"); | ||
import{promises as fs}from"fs"; | ||
var _cachedir=_interopRequireDefault(require("cachedir")); | ||
var _pathExists=_interopRequireDefault(require("path-exists"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}} | ||
import getCacheDir from"cachedir"; | ||
import pathExists from"path-exists"; | ||
const globalCacheDir=async function(name){ | ||
const cacheDir=(0,_cachedir.default)(name); | ||
export default async function globalCacheDir(name){ | ||
const cacheDir=getCacheDir(name); | ||
await createCacheDir(cacheDir); | ||
return cacheDir; | ||
}; | ||
} | ||
const createCacheDir=async function(cacheDir){ | ||
if(await(0,_pathExists.default)(cacheDir)){ | ||
if(await pathExists(cacheDir)){ | ||
return; | ||
} | ||
await _fs.promises.mkdir(cacheDir,{recursive:true}); | ||
await fs.mkdir(cacheDir,{recursive:true}); | ||
}; | ||
module.exports=globalCacheDir; | ||
//# sourceMappingURL=main.js.map |
{ | ||
"name": "global-cache-dir", | ||
"version": "2.0.0", | ||
"main": "build/src/main.js", | ||
"version": "3.0.0", | ||
"type": "module", | ||
"exports": "./build/src/main.js", | ||
"files": [ | ||
"build/src", | ||
"examples", | ||
"!~" | ||
"build/src/**/*.{js,ts,map,json,sh,md}", | ||
"examples/**/*.{js,ts,map,json,sh,md}" | ||
], | ||
@@ -13,7 +13,2 @@ "scripts": { | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-push": "gulp check --full" | ||
} | ||
}, | ||
"description": "Get the global cache directory", | ||
@@ -58,11 +53,8 @@ "keywords": [ | ||
"devDependencies": { | ||
"@ehmicky/dev-tasks": "^0.31.0", | ||
"ava": "^2.4.0", | ||
"gulp": "^4.0.2", | ||
"husky": "^3.1.0", | ||
"test-each": "^2.0.0" | ||
"@ehmicky/dev-tasks": "^1.0.33", | ||
"test-each": "^3.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=10.17.0" | ||
"node": ">=12.20.0" | ||
} | ||
} |
[![Codecov](https://img.shields.io/codecov/c/github/ehmicky/global-cache-dir.svg?label=tested&logo=codecov)](https://codecov.io/gh/ehmicky/global-cache-dir) | ||
[![Travis](https://img.shields.io/badge/cross-platform-4cc61e.svg?logo=travis)](https://travis-ci.org/ehmicky/global-cache-dir) | ||
[![Build](https://github.com/ehmicky/global-cache-dir/workflows/Build/badge.svg)](https://github.com/ehmicky/global-cache-dir/actions) | ||
[![Node](https://img.shields.io/node/v/global-cache-dir.svg?logo=node.js)](https://www.npmjs.com/package/global-cache-dir) | ||
[![Gitter](https://img.shields.io/gitter/room/ehmicky/global-cache-dir.svg?logo=gitter)](https://gitter.im/ehmicky/global-cache-dir) | ||
[![Twitter](https://img.shields.io/badge/%E2%80%8B-twitter-4cc61e.svg?logo=twitter)](https://twitter.com/intent/follow?screen_name=ehmicky) | ||
@@ -20,3 +19,3 @@ [![Medium](https://img.shields.io/badge/%E2%80%8B-medium-4cc61e.svg?logo=medium)](https://medium.com/@ehmicky) | ||
```js | ||
const globalCacheDir = require('global-cache-dir') | ||
import globalCacheDir from 'global-cache-dir' | ||
@@ -36,2 +35,6 @@ const cacheDir = await globalCacheDir('myapp') | ||
This package is an ES module and must be loaded using | ||
[an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c), | ||
not `require()`. | ||
# Usage | ||
@@ -55,8 +58,4 @@ | ||
If you found a bug or would like a new feature, _don't hesitate_ to | ||
[submit an issue on GitHub](../../issues). | ||
For any question, _don't hesitate_ to [submit an issue on GitHub](../../issues). | ||
For other questions, feel free to | ||
[chat with us on Gitter](https://gitter.im/ehmicky/global-cache-dir). | ||
Everyone is welcome regardless of personal background. We enforce a | ||
@@ -63,0 +62,0 @@ [Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
2
Yes
17153
5
14
80