@runnerpro/frontend
v1.0.4
Published
A collection of common frontend functions
Downloads
43
Maintainers
Readme
modern-npm-package
An npm packages for common frontend logic between client and dashboard app.
Get Started
- Run
npm install @runnerpro/frontend
Functions
b64toBlob
Transform base64 file to blob data for sending file
- Param: file in base64
- Return: blob data file
fileToB64
Transform File (from input type file) to base 64 for inserting value in src
- Param: file from input type file
- Return: promise with base 64 file
Deploy new version
- Create a folder with the name of functionality and index.ts inside. Write the function and export it.
- In main index.ts (the one inside src), import and export it
- Change the version number of the package (using this convenction)
- Run
npm login
- Run
npm run publish
Testing
- Install developer dependencies using the following command in your terminal
npm i -D mocha @types/mocha chai @types/chai ts-node
- Create a new file
.mocharc.json
in the root directory with the following contents:{ "extension": ["ts"], "spec": "./**/*.spec.ts", "require": "ts-node/register" }
- Create a
tests
folder - Create an
index.spec.ts
file in thetests
folder - Write unit tests in the
index.spec.ts
file to test the code inindex.ts
- Add a
"test"
property in thepackage.json
file and give it a value of"mocha"
- Run
npm test
in your terminal from the root folder of the project