2.0.1 • Published 5 years ago
@ruas/ppwrapper v2.0.1
ppwrapper
Stay safe. Use a wrapper for your Programmable Promise.
Installation
Install the package with npm i @ruas/ppwrapper
or yarn add @ruas/ppwrapper
Quick start
const f = () => fetch('https://randomuser.me/api/')
let [ state, re ] = ppwrapper<PersonApi, typeof f>(f)
If you'd like to perform the request on render, pass the function to useEffect
:
useEffect(() => {
re()
}, [re])
Documentation
Check the wiki for documentation and examples: https://gitlab.com/rotterdam-university/ppwrapper/-/wikis/v2/Request
Developing locally
- Clone the package with
git clone git@gitlab.com:rotterdam-university/ppwrapper.git
- Install the dependencies with
yarn
- Link the package with
yarn link
- Go to
ppwrapper-docs
or any project where you want to use the wrapper and doyarn link @ruas/ppwrapper
- Run
yarn start
to compile the package everytime you save a file
Publishing to NPM
Before you publish the package, make sure you've logged in with yarn login
. You only have to do this once.
- Update the version in
package.json
following semver (Cheatsheet). Do this in thedevelop
branch. - It speaks for itself that the
develop
branch has to be tested and confirmed that the package works as expected. - Push only the version bump in the
package.json
to the remotedevelop
branch with as descripton:
Bumped version to vX.X.X
The X.X.X
should correspond with the version in the package.json
.
At this point, you can make a merge request on Gitlab from develop
→ master
. Once it's approved by another developer, you can continue.
- Pull the changes on the master branch on you local machine.
- Create a tag on the
master
branch with the same version as in thepackage.json
with:git tag -a <VERSION>
- The message should be a short description of what's included since the last tag:
Added:
• x
Fixed:
• x
- Build the project with
yarn build
- Pushed the tag to Gitlab with:
git push --tags
- Publish the package with:
yarn publish --access public
. Hit enter when yarn asks:question New version: