TypeDoc generated docs in here
Collection of small utils to deal with JS promises.
yarn add @eturino/small-utils
or npm install @eturino/small-utils
.
Similar to a forEach
, but waits for the Promise of the first element to resolve before starting to run the next one.
import { forEachInSequence } from "@eturino/small-utils";
await forEachInSequence(["a", "b"], async (key) => {
await doSomeAsyncStuff(key);
}); // => void
// doSomeAsyncStuff("a") gets called first, and doSomeAsyncStuff("b") gets called only when the first one finished.
Similar to a map
, but waits for the Promise of the first element to resolve before starting to run the next one. It is the same as forEachInSequence
but returning the results.
import { mapInSequence } from "@eturino/small-utils";
await mapInSequence(["a", "b"], async (key) => {
return doSomeAsyncStuff(key);
}); // => ["res-for-a", "res-for-b"]
// doSomeAsyncStuff("a") gets called first, and doSomeAsyncStuff("b") gets called only when the first one finished.
See documentation for development
See The Typescript-Starter docs.
For commits, you should use commitizen
yarn global add commitizen
#commit your changes:
git cz
As typescript-starter docs state:
This project is tooled for conventional changelog to make managing releases easier. See the standard-version documentation for more information on the workflow, or CHANGELOG.md
for an example.
# bump package.json version, update CHANGELOG.md, git tag the release
yarn run version
You may find a tool like wip
helpful for managing work in progress before you're ready to create a meaningful commit.
Once you are ready to create the first version, run the following (note that reset
is destructive and will remove all files not in the git repo from the directory).
# Reset the repo to the latest commit and build everything
yarn run reset && yarn run test && yarn run doc:html
# Then version it with standard-version options. e.g.:
# don't bump package.json version
yarn run version -- --first-release
# Other popular options include:
# PGP sign it:
# $ yarn run version -- --sign
# alpha release:
# $ yarn run version -- --prerelease alpha
And after that, remember to publish the docs.
And finally push the new tags to github and publish the package to npm.
# Push to git
git push --follow-tags origin master
# Publish to NPM (allowing public access, required if the package name is namespaced like `@somewhere/some-lib`)
yarn publish --access public
yarn run doc:html && yarn run doc:publish
This will generate the docs and publish them in github pages.
There is a single yarn command for preparing a new release. See One-step publish preparation script in TypeScript-Starter
# Prepare a standard release
yarn prepare-release
# Push to git
git push --follow-tags origin master
# Publish to NPM (allowing public access, required if the package name is namespaced like `@somewhere/some-lib`)
yarn publish --access public