@webreflection/utils 0.0.0 → 0.1.0
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/.github/dependabot.yml +13 -0
- package/.github/workflows/node.js.yml +31 -0
- package/README.md +15 -0
- package/package.json +25 -3
- package/test/with-resolvers.js +11 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Keep GitHub Actions up to date with GitHub's Dependabot...
|
|
2
|
+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
|
|
3
|
+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
|
|
4
|
+
version: 2
|
|
5
|
+
updates:
|
|
6
|
+
- package-ecosystem: github-actions
|
|
7
|
+
directory: /
|
|
8
|
+
groups:
|
|
9
|
+
github-actions:
|
|
10
|
+
patterns:
|
|
11
|
+
- "*" # Group all Actions updates into a single larger pull request
|
|
12
|
+
schedule:
|
|
13
|
+
interval: weekly
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: build
|
|
5
|
+
|
|
6
|
+
on: [push, pull_request]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [22]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: ${{ matrix.node-version }}
|
|
23
|
+
cache: 'npm'
|
|
24
|
+
- run: npm ci
|
|
25
|
+
- run: npm run build --if-present
|
|
26
|
+
- run: npm run test
|
|
27
|
+
- run: npm run coverage --if-present
|
|
28
|
+
- name: Coveralls
|
|
29
|
+
uses: coverallsapp/github-action@master
|
|
30
|
+
with:
|
|
31
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @webreflection/utils
|
|
2
|
+
|
|
3
|
+
[](https://coveralls.io/github/WebReflection/utils?branch=main)
|
|
4
|
+
|
|
5
|
+
<sup>**Social Media Photo by [benjamin lehman](https://unsplash.com/@abject) on [Unsplash](https://unsplash.com/)**</sup>
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
A [collection](./src/) of utility functions.
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
// example: self bound Promise.withResolvers()
|
|
12
|
+
import withResolvers from 'https://esm.run/@webreflection/utils/with-resolvers';
|
|
13
|
+
|
|
14
|
+
const { promise, resolve, reject } = withResolvers();
|
|
15
|
+
```
|
package/package.json
CHANGED
|
@@ -1,13 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webreflection/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./with-resolvers": "./src/with-resolvers.js",
|
|
7
7
|
"./package.json": "./package.json"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
9
|
+
"tests": [
|
|
10
|
+
"with-resolvers"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"coverage": "mkdir -p ./coverage; c8 report --reporter=text-lcov > ./coverage/lcov.info",
|
|
14
|
+
"test": "c8 node -e 'let q=Promise.resolve();for(const t of require(`./package.json`).tests)q=q.then(()=>import(`./test/${t}.js`));'"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"shared",
|
|
18
|
+
"utility",
|
|
19
|
+
"utils"
|
|
20
|
+
],
|
|
10
21
|
"author": "Andrea Giammarchi",
|
|
11
22
|
"license": "MIT",
|
|
12
|
-
"description": "A collection of utility functions"
|
|
23
|
+
"description": "A collection of utility functions",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/WebReflection/utils.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/WebReflection/utils/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/WebReflection/utils#readme",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"c8": "^10.1.3"
|
|
34
|
+
}
|
|
13
35
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import withResolvers from '../src/with-resolvers.js';
|
|
2
|
+
|
|
3
|
+
const { promise, resolve, reject } = withResolvers();
|
|
4
|
+
|
|
5
|
+
console.assert(typeof reject === 'function');
|
|
6
|
+
console.assert(typeof resolve === 'function');
|
|
7
|
+
console.assert(promise instanceof Promise);
|
|
8
|
+
|
|
9
|
+
resolve('OK');
|
|
10
|
+
|
|
11
|
+
console.log(await promise);
|