This runbook provides detailed instructions for managing the build, testing, and deployment processes of the Guardly project. Guardly provides security helper methods for front-end development.
Ensure you have the following installed on your machine:
- Node.js (version 14 or higher)
- npm (version 6 or higher)
The following npm scripts are available for managing the Guardly project:
Compiles the TypeScript files into JavaScript.
npm run build
This command uses the TypeScript compiler (tsc
) to compile index.ts
to dist/index.js
.
Watches for changes in TypeScript files and recompiles them automatically.
npm run watch
This is useful during development to ensure your changes are immediately compiled.
Runs the compiled JavaScript file.
npm start
This command runs the dist/index.js
file using Node.js.
Runs the tests using Jest.
npm test
This command executes the test suite to ensure all functions work as expected.
Minifies the compiled JavaScript file.
npm run minify
This command uses uglify-js
to minify dist/index.js
and outputs dist/index.min.js
.
Combines the build
and minify
scripts to compile and minify the code.
npm run dist
-
Building the Project:
- To compile the TypeScript files into JavaScript, run:
npm run build
- To compile the TypeScript files into JavaScript, run:
-
Watching for Changes:
- During development, use:
npm run watch
- During development, use:
-
Running the Project:
- To execute the compiled JavaScript file, run:
npm start
- To execute the compiled JavaScript file, run:
-
Running Tests:
- To run the test suite, use:
npm test
- To run the test suite, use:
-
Minifying the Code:
- To minify the compiled JavaScript, run:
npm run minify
- To minify the compiled JavaScript, run:
-
Building and Minifying for Distribution:
- To perform both build and minify steps, run:
npm run dist
- To perform both build and minify steps, run:
By following this runbook, you can efficiently manage the build, testing, and deployment processes for the Guardly project.