1.0.4 • Published 1 year ago
@runnerpro/frontend v1.0.4
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.jsonin the root directory with the following contents:{ "extension": ["ts"], "spec": "./**/*.spec.ts", "require": "ts-node/register" } - Create a
testsfolder - Create an
index.spec.tsfile in thetestsfolder - Write unit tests in the
index.spec.tsfile to test the code inindex.ts - Add a
"test"property in thepackage.jsonfile and give it a value of"mocha" - Run
npm testin your terminal from the root folder of the project