Skip to content

Commit a7b512c

Browse files
author
Sven Fehler
authored
Merge pull request #26 from Sv443-Network/version/1.14.1
Hotfix for `filesystem.exists()`
2 parents 10cbca6 + a9752e1 commit a7b512c

File tree

7 files changed

+31
-19
lines changed

7 files changed

+31
-19
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ Although it is intended for the Sv443 Network's own projects, feel free to use t
88

99
<br>
1010

11-
## [Click here to go to the documentation](./docs.md#readme)
11+
<div align="center" style="text-align:center;">
12+
13+
## >> [Documentation](./docs.md#readme) <<
14+
#### [Changelog](./changelog.md#readme)[Discord](https://dc.sv443.net)
15+
16+
</div>
1217

1318
<br><br>
1419

SvCoreLib.d.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
55
66
>> If you came here looking for the source code, you're in the wrong file!
7-
>> See the file `SvCoreLib.js` instead, it acts as a relay to all of SCLs features.
7+
>> See the file `SvCoreLib.js` instead, it acts as a proxy to all of SCLs features.
88
>> From there, you can follow the require()'s.
99
10-
>> This file is responsible for the In-IDE documentation (usually seen by pressing CTRL+Space or hovering over stuff)
10+
>> This file is responsible for the In-IDE documentation and explicit types (usually seen by pressing CTRL+Space or hovering over stuff)
1111
*/
1212

1313

@@ -47,7 +47,9 @@ declare type PromiseState = "initialized" | "pending" | "fulfilled" | "rejected"
4747
*
4848
* ---
4949
*
50-
* **[Documentation](https://github.com/Sv443/SvCoreLib/blob/master/docs.md#readme) • [GitHub Repo](https://github.com/Sv443-Network/SvCoreLib) • [Discord](https://dc.sv443.net)**
50+
* **[Documentation](https://github.com/Sv443-Network/SvCoreLib/blob/master/docs.md#readme) • [GitHub Repo](https://github.com/Sv443-Network/SvCoreLib) • [Discord](https://dc.sv443.net)**
51+
*
52+
* [Changelog](https://github.com/Sv443-Network/SvCoreLib/blob/master/changelog.md#readme)
5153
*
5254
* ---
5355
*
@@ -537,7 +539,7 @@ declare module "svcorelib" {
537539

538540
/**
539541
* 🔹 This function checks if a file exists at the given path.
540-
* (Reimplementation of [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) based on `fs.access()`) 🔹
542+
* (Reimplementation of the deprecated [`fs.exists()`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback) based on `fs.access()`) 🔹
541543
* @param path The path to the file - Gets passed through [`path.resolve()`](https://nodejs.org/api/path.html#path_path_resolve_paths)
542544
* @returns Returned Promise always resolves to a boolean (and never rejects) - true, if the file exists, false if not
543545
* @throws Throws a TypeError if the `path` argument is not a string or couldn't be resolved to a valid path

SvCoreLib.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module.exports = Object.freeze({
4545
downloadFile: require("./src/functions/filesystem/downloadFile"),
4646
ensureDirs: require("./src/functions/filesystem/ensureDirs"),
4747
ensureDirsSync: require("./src/functions/filesystem/ensureDirsSync"),
48+
exists: require("./src/functions/filesystem/exists"),
4849
},
4950
sql: {
5051
sendQuery: require("./src/functions/sql/sendQuery"),

changelog.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## SvCoreLib - Changelog
2-
### Latest version: [1.14.0](#1140)
2+
### Latest version: [1.14.1](#1141)
33

44
<br><br>
55

@@ -33,6 +33,7 @@
3333
- [1.13.0](#1130)
3434
- [1.13.1](#1131)
3535
- [1.14.0](#1140)
36+
- [1.14.1](#1141)
3637

3738
</details>
3839

@@ -42,6 +43,13 @@
4243

4344
<br><br>
4445

46+
## 1.14.1
47+
48+
- Fixes
49+
- `filesystem.exists()` can now actually be used 🤦 ([issue #25](https://github.com/Sv443-Network/SvCoreLib/issues/25))
50+
51+
<br><br>
52+
4553
## 1.14.0
4654

4755
- Additions

docs.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,24 +2379,24 @@ Also, all of these classes inherit from [JavaScript's `Error` class.](https://de
23792379
> > **<details><summary>Example Code - Click to view</summary>**
23802380
> >
23812381
> > ```js
2382-
> > const scl = require("svcorelib");
2382+
> > const { filesystem, Errors } = require("svcorelib");
23832383
> > const fs = require("fs");
23842384
> > const { resolve } = require("path");
23852385
> >
23862386
> >
23872387
> > /** @throws InvalidPathError if the provided path doesn't exist */
2388-
> > function pathExists(path)
2388+
> > async function throwIfNotExists(path)
23892389
> > {
23902390
> > path = resolve(path);
23912391
> >
2392-
> > if(!fs.existsSync(path))
2393-
> > throw new scl.Errors.InvalidPathError(`Path "${path}" doesn't exist.`);
2392+
> > if(!(await filesystem.exists(path)))
2393+
> > throw new Errors.InvalidPathError(`Path "${path}" doesn't exist.`);
23942394
> >
23952395
> > return;
23962396
> > }
23972397
> >
2398-
> > pathExists("./src/"); // no error is thrown
2399-
> > pathExists("./path/that/doesnt/exist"); // error is thrown here
2398+
> > throwIfNotExists("./src/"); // no error is thrown
2399+
> > throwIfNotExists("./path/that/doesnt/exist"); // error is thrown here
24002400
> > ```
24012401
> >
24022402
> > </details>

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@sv443-network/svcorelib",
3-
"version": "1.14.0",
2+
"name": "svcorelib",
3+
"version": "1.14.1",
44
"description": "Core Library used in almost all of my (Sv443's) projects. Feel free to use it if you want to, it contains some very nice features.",
55
"main": "SvCoreLib.js",
66
"scripts": {
@@ -60,9 +60,5 @@
6060
"@types/node": "^14.6.0",
6161
"eslint": "^7.22.0",
6262
"snyk": "^1.592.0"
63-
},
64-
"publishConfig": {
65-
"cache": "~/.npm",
66-
"registry": "https://registry.npmjs.com"
6763
}
6864
}

0 commit comments

Comments
 (0)