@ndriadev/futurable 2.2.0 → 2.2.1
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.
- package/README.md +12 -3
- package/package.json +8 -3
- package/scripts/copy-resources.js +18 -0
- package/scripts/server.js +16 -0
package/README.md
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
<h1 align="center">
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<br>
|
|
3
|
+
<a href="https://futurable.ndria.dev/">
|
|
4
|
+
<img src="/Futurable.png" alt="logo">
|
|
5
|
+
</a>
|
|
6
|
+
<br>
|
|
7
|
+
Futurable
|
|
8
|
+
<br>
|
|
9
|
+
</h1>
|
|
10
|
+
|
|
2
11
|
<h3 align="center">Javascript's Promise and Fetch API with super powers!</h3>
|
|
3
12
|
|
|
4
13
|
<div align="center">
|
|
@@ -611,11 +620,11 @@ Extension of static method _withResolvers_ with support of _cancel_ function and
|
|
|
611
620
|
*Example*
|
|
612
621
|
```javascript
|
|
613
622
|
//...code
|
|
614
|
-
const {
|
|
623
|
+
const {promise, resolve, reject} = Futurable.withResolvers();
|
|
615
624
|
|
|
616
625
|
//...code
|
|
617
626
|
|
|
618
|
-
const result = await
|
|
627
|
+
const result = await promise;
|
|
619
628
|
|
|
620
629
|
//...code
|
|
621
630
|
resolve("resolved");
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@ndriadev/futurable",
|
|
3
3
|
"description": "Extension Javascript's Promise API with more functionalities",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "2.2.
|
|
5
|
+
"version": "2.2.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist/",
|
|
@@ -32,11 +32,15 @@
|
|
|
32
32
|
"eslint-config-prettier": "^9.1.0",
|
|
33
33
|
"eslint-plugin-import": "^2.29.1",
|
|
34
34
|
"eslint-plugin-prettier": "^5.1.3",
|
|
35
|
+
"express": "^4.19.2",
|
|
35
36
|
"jest": "^29.7.0",
|
|
36
37
|
"prettier": "^3.2.5",
|
|
37
38
|
"ts-jest": "^29.1.2",
|
|
38
39
|
"ts-node": "^10.9.2",
|
|
39
40
|
"typedoc": "^0.25.7",
|
|
41
|
+
"typedoc-material-theme": "^1.0.2",
|
|
42
|
+
"typedoc-plugin-extras": "^3.0.0",
|
|
43
|
+
"typedoc-plugin-keywords": "^1.6.0",
|
|
40
44
|
"typescript": "^5.3.3",
|
|
41
45
|
"vite": "^5.0.12",
|
|
42
46
|
"vite-plugin-dts": "^3.7.2",
|
|
@@ -81,10 +85,11 @@
|
|
|
81
85
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
82
86
|
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
|
|
83
87
|
"lint:fix": "eslint --fix 'src/**/*.{jsx,ts,tsx}'",
|
|
84
|
-
"docs": "typedoc
|
|
88
|
+
"docs": "typedoc --options typedoc.config.cjs && node scripts/copy-resources.js",
|
|
85
89
|
"release:patch": "pnpm version patch",
|
|
86
90
|
"release:minor": "pnpm version minor",
|
|
87
91
|
"release:major": "pnpm version major",
|
|
88
|
-
"postversion": "pnpm run docs && git add . && git commit -m '[FIX] docs' && git push && git push origin --tags && pnpm publish --access public"
|
|
92
|
+
"postversion": "pnpm run docs && git add . && git commit -m '[FIX] docs' && git push && git push origin --tags && pnpm publish --access public",
|
|
93
|
+
"preview": "pnpm run docs && node scripts/server.js"
|
|
89
94
|
}
|
|
90
95
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readFile, readdir, writeFile } from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
const __dirname = new URL('.', import.meta.url).pathname;
|
|
5
|
+
|
|
6
|
+
async function copy() {
|
|
7
|
+
try {
|
|
8
|
+
const dir = await readdir(path.join(__dirname, "..", "resources", "images"));
|
|
9
|
+
for (const file of dir) {
|
|
10
|
+
const asset = await readFile(path.join(__dirname, "..", "resources", "images", file));
|
|
11
|
+
await writeFile(path.join(__dirname, "..", "docs", file), asset);
|
|
12
|
+
}
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.error(error);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
copy();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
const __dirname = new URL('.', import.meta.url).pathname;
|
|
5
|
+
|
|
6
|
+
const app = express();
|
|
7
|
+
|
|
8
|
+
app.use(express.static(path.join((__dirname, "..", "docs"))));
|
|
9
|
+
|
|
10
|
+
app.get('/', (req, res) => {
|
|
11
|
+
return res.sendFile(path.join(__dirname, '..', 'docs', 'index.html'))
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
app.listen(4173, () => {
|
|
15
|
+
console.log("run");
|
|
16
|
+
});
|