-
Notifications
You must be signed in to change notification settings - Fork 5
feat!: implement with unjs template #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nozomuikuta
wants to merge
6
commits into
main
Choose a base branch
from
feat/apply-unjs-template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e5f869a
feat!: implement with unjs template
nozomuikuta 37215f5
fix: fix argument type
nozomuikuta 6706b9c
chore: apply the latest template
nozomuikuta 4b84802
chore: add contributor
nozomuikuta 06da74a
chore: remove redundant line breaks
nozomuikuta eeca1ee
fix: add `coverage` directory to `.eslintignore`
nozomuikuta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
charset = utf-8 | ||
|
||
[*.js] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[{package.json,*.yml,*.cjson}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
coverage | ||
dist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": ["eslint-config-unjs"], | ||
"rules": {} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: corepack enable | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: "pnpm" | ||
- run: pnpm install | ||
- run: pnpm lint | ||
- run: pnpm build | ||
- run: pnpm vitest --coverage | ||
- uses: codecov/codecov-action@v3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules | ||
coverage | ||
dist | ||
types | ||
.vscode | ||
.DS_Store | ||
.eslintcache | ||
*.log* | ||
*.conf* | ||
*.env* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
The MIT License (MIT) | ||
MIT License | ||
|
||
Copyright (c) 2017 Pooya Parsa <[email protected]> | ||
Copyright (c) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,72 @@ | ||
# items-promise | ||
Bare minimum async methods using promises. (Inspired by [items](https://www.npmjs.com/package/items)) | ||
|
||
```bash | ||
>_ yarn add items-promise | ||
``` | ||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![Github Actions][github-actions-src]][github-actions-href] | ||
[![Codecov][codecov-src]][codecov-href] | ||
|
||
> Bare minimum async methods using promises. (Inspired by [items](https://www.npmjs.com/package/items)) | ||
|
||
## Usage | ||
|
||
OR using NPM | ||
Install package: | ||
|
||
```bash | ||
>_ npm install items-promise | ||
```sh | ||
# npm | ||
npm install items-promise | ||
|
||
# yarn | ||
yarn add items-promise | ||
|
||
# pnpm | ||
pnpm install items-promise | ||
``` | ||
|
||
Import: | ||
|
||
```js | ||
const { serial, parallel } = require('items-promise') | ||
// OR | ||
import { serial, parallel } from 'items-promise' | ||
// ESM | ||
import { serial, parallel } from "items-promise" | ||
|
||
// CommonJS | ||
const { serial, parallel } = require("items-promise") | ||
``` | ||
|
||
# Usage | ||
`tasks` should be always an array and `fn` should be a function witch returns a **Promise** object. | ||
`tasks` should be always an array and `fn` should be a function which returns a `Promise`. | ||
|
||
## serial(tasks, fn) | ||
### serial(tasks, fn) | ||
|
||
Run tasks one by one by calling `fn(task, previous)` in a promise chain. | ||
|
||
Return value is of type `Promise<*>` which resolves to the **last** fn result. | ||
Return value is of type `Promise<*>` which resolves to the **last** `fn` result. | ||
|
||
## parallel(tasks, fn) | ||
### parallel(tasks, fn) | ||
|
||
Run all tasks in parallel by calling `fn(tasks)` and await using `Promise.all`. | ||
|
||
Return value is of type `Promise<*[]>` which resolves to results of **all** fns in an array. | ||
Return value is of type `Promise<*[]>` which resolves to results of **all** `fn`s in the array. | ||
|
||
## Development | ||
|
||
- Clone this repository | ||
- Install latest LTS version of [Node.js](https://nodejs.org/en/) | ||
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` | ||
- Install dependencies using `pnpm install` | ||
- Run interactive tests using `pnpm dev` | ||
|
||
## License | ||
|
||
Made with 💛 | ||
|
||
Published under [MIT License](./LICENSE). | ||
|
||
# License | ||
Released under The MIT [LICENSE](./LICENSE) | ||
<!-- Badges --> | ||
|
||
Copyright (c) 2017 Pooya Parsa | ||
[npm-version-src]: https://img.shields.io/npm/v/items-promise?style=flat-square | ||
[npm-version-href]: https://npmjs.com/package/items-promise | ||
[npm-downloads-src]: https://img.shields.io/npm/dm/items-promise?style=flat-square | ||
[npm-downloads-href]: https://npmjs.com/package/items-promise | ||
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/items-promise/ci/main?style=flat-square | ||
[github-actions-href]: https://github.com/unjs/items-promise/actions?query=workflow%3Aci | ||
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/items-promise/main?style=flat-square | ||
[codecov-href]: https://codecov.io/gh/unjs/items-promise |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,45 @@ | |
"name": "items-promise", | ||
"version": "1.0.0", | ||
"description": "Bare minimum async methods using promises", | ||
"main": "lib/index.js", | ||
"repository": "https://github.com/pi0/items-promise", | ||
"author": "Pooya Parsa <[email protected]>", | ||
"license": "MIT" | ||
"contributors": [ | ||
"Nozomu Ikuta <[email protected]>" | ||
], | ||
"repository": "unjs/items-promise", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "unbuild", | ||
"dev": "vitest dev", | ||
"lint": "eslint --cache --ext .ts,.js,.mjs,.cjs . && prettier -c src test", | ||
"lint:fix": "eslint --cache --ext .ts,.js,.mjs,.cjs . --fix && prettier -c src test -w", | ||
"prepack": "pnpm run build", | ||
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags", | ||
"test": "pnpm lint && vitest run --coverage" | ||
}, | ||
"devDependencies": { | ||
"@vitest/coverage-c8": "^0.27.2", | ||
"changelogen": "^0.4.1", | ||
"eslint": "^8.23.0", | ||
"eslint-config-unjs": "^0.1.0", | ||
"prettier": "^2.8.3", | ||
"typescript": "^4.8.2", | ||
"unbuild": "^1.1.1", | ||
"vitest": "^0.27.2" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, only if you are fine.