@asyncapi/generator 1.9.10 → 1.9.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/utils.js +11 -1
  2. package/package.json +1 -1
package/lib/utils.js CHANGED
@@ -18,9 +18,19 @@ utils.readlink = util.promisify(fs.readlink);
18
18
  utils.readFile = util.promisify(fs.readFile);
19
19
  utils.writeFile = util.promisify(fs.writeFile);
20
20
  utils.copyFile = util.promisify(fs.copyFile);
21
- utils.exists = util.promisify(fs.exists);
22
21
  utils.readDir = util.promisify(fs.readdir);
23
22
 
23
+ utils.exists = async (path) => {
24
+ try {
25
+ await fs.promises.stat(path, fs.constants.F_OK);
26
+ return true;
27
+ } catch (error) {
28
+ // File does not exist.
29
+ log.debug(`File ${path} couldn't be found. Error: ${error.message}`);
30
+ return false;
31
+ }
32
+ };
33
+
24
34
  /**
25
35
  * Checks if a string is a filesystem path.
26
36
  * @private
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asyncapi/generator",
3
- "version": "1.9.10",
3
+ "version": "1.9.11",
4
4
  "description": "The AsyncAPI generator. It can generate documentation, code, anything!",
5
5
  "main": "./lib/generator.js",
6
6
  "bin": {