@form8ion/core
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -1,5 +0,6 @@ | ||
import {fileExists} from './lib/index.cjs'; | ||
import {directoryExists, fileExists} from './lib/index.cjs'; | ||
(async () => { | ||
await fileExists('path/to/some/expected/file'); | ||
await directoryExists('path/to/some/expected/directory'); | ||
})(); |
@@ -32,2 +32,12 @@ 'use strict'; | ||
async function directoryExists (path) { | ||
const stats = await exists(path); | ||
if (stats) { | ||
return stats.isDirectory(); | ||
} | ||
return stats; | ||
} | ||
const questionNames = { | ||
@@ -97,2 +107,3 @@ PROJECT_NAME: 'projectName', | ||
exports.directoryExists = directoryExists; | ||
exports.fileExists = fileExists; | ||
@@ -99,0 +110,0 @@ exports.questionNames = questionNames; |
@@ -24,2 +24,12 @@ import { promises } from 'fs'; | ||
async function directoryExists (path) { | ||
const stats = await exists(path); | ||
if (stats) { | ||
return stats.isDirectory(); | ||
} | ||
return stats; | ||
} | ||
const questionNames = { | ||
@@ -89,3 +99,3 @@ PROJECT_NAME: 'projectName', | ||
export { fileExists, questionNames, questionsForBaseDetails }; | ||
export { directoryExists, fileExists, questionNames, questionsForBaseDetails }; | ||
//# sourceMappingURL=index.es.js.map |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"files": [ | ||
@@ -50,3 +50,3 @@ "example.js", | ||
"@babel/register": "7.12.10", | ||
"@form8ion/babel-preset": "1.6.40", | ||
"@form8ion/babel-preset": "1.6.41", | ||
"@form8ion/commitlint-config": "1.0.14", | ||
@@ -65,3 +65,3 @@ "@form8ion/eslint-config": "1.7.2", | ||
"gherkin-lint": "4.1.3", | ||
"husky": "5.0.4", | ||
"husky": "5.0.6", | ||
"lockfile-lint": "4.3.7", | ||
@@ -77,5 +77,5 @@ "mocha": "8.2.1", | ||
"rimraf": "3.0.2", | ||
"rollup": "2.34.2", | ||
"rollup": "2.35.1", | ||
"rollup-plugin-auto-external": "2.0.0", | ||
"sinon": "9.2.1" | ||
"sinon": "9.2.2" | ||
}, | ||
@@ -82,0 +82,0 @@ "dependencies": { |
@@ -17,2 +17,5 @@ # core | ||
* [Example](#example) | ||
* [API](#api) | ||
* [`fileExists`](#fileexists) | ||
* [`directoryExists`](#directoryexists) | ||
* [Contributing](#contributing) | ||
@@ -41,6 +44,7 @@ * [Dependencies](#dependencies) | ||
```javascript | ||
import {fileExists} from '@form8ion/core'; | ||
import {directoryExists, fileExists} from '@form8ion/core'; | ||
(async () => { | ||
await fileExists('path/to/some/expected/file'); | ||
await directoryExists('path/to/some/expected/directory'); | ||
})(); | ||
@@ -56,2 +60,7 @@ ``` | ||
#### `directoryExists` | ||
wrapper around [`fs.promises.stat()`](https://nodejs.org/api/fs.html#fs_fspromises_stat_path_options) | ||
to determine whether a directory exists at a given path. | ||
## Contributing | ||
@@ -58,0 +67,0 @@ |
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
29074
186
127