bizops-frontend-utils
Common front end utility functions shared across Business Operations Repositories. See the following Proposal document outling the reasoning behind this library.
Installing
Using npm: npm i -D @postmates/bizops-frontend-utils
Using yarn: yarn add --dev @postmates/bizops-frontend-utils
Utilizing Library
View the UTILS.md
file for information on available utility functions and examples of how to use them
Adding new utility functions
To add utility functions to this library, please follow the instructions below
Getting Started
- Install nvm to your local machine.
- Run
nvm use
to install supported node version. - Run
npm install
.
Guide to writing utility functions
- Add utility functions inside of the
src/
directory - Include tests in the
tests
directory. Ensure that the utility function is 90% coveraged, per repository requirements. - Ensure that all new file(s) are linted by running,
npm run lint
- Document the purpose of the utility and provide an explanation under the
UTILS.md
file
Ensuring tests work in external world
When publishing a new package, it can be hard to determine whether or not it will work wither other npm packages. To simulate an external package,
a deploy_tests
folder was created that simulates an external project using the published version. Please add tests in this folder to ensure
that every library function will work as expected. To run tests in this folder, run $npm run test:deployed:package
Publishing utility functions
- Log in to npm via
npm login
in your terminal - Increase the version of the application by going into the
package.json
file, and incrementing the version of the app. - Type
npm publish
- More information can be found in this publishing to npm link.
- npm registry for
bizops-front-utils
found in the private postmates registry.