While it is recommended to use Visual Studio Code when developing OptimizeIt, feel free to use any IDE of your choice.
For Visual Studio Code, there exists a extensions.json file with extensions recommendations, that you should be prompted to install if you don't already have them!
Create a .env file, and provide your api key, i.e.:
GROQ_API_KEY=YOUR_API_KEY_HERE
Install dependencies:
npm installBuild:
npm run buildLink:
npm linkyou can then use it as such:
optimizeit examples/main.cppFor testing, OptimizeIt uses Jest.
Below are all of the test scripts that exist, some can be very useful during development!
This script runs all the tests:
npm run testThis script runs all the unit tests:
npm run test:unitThis script runs a singular test file:
npm run test:file testfilename.test.tsThis script watches for any source code changes, and runs all tests when you save a file:
npm run test:watchThis script calculates the coverage of the tests against the source code, and generates a coverage folder that contains a detailed reports to what is and what isn't covered by the tests:
npm run test:coverageFor your IDE, please install the following extensions:
- ESLint
- Prettier - Code formatter
For formatting, OptimizeIt uses both Prettier .prettierrc file for config, to run manually:
npm run prettierOr you can set your IDE to format with prettier on save, which is more optimal for a development environment.
To enable this in Visual Studio Code, simply go to Preferences, then search for Format on save, make sure that is ticked on.
For other IDEs, please check the official documentation.
For linting, OptimizeIt uses both Eslint and Oxc with a pre-defined eslint.config.mjs file for config, to run manually:
npm run lintThis will run both Eslint and Oxc.
Both Husky and lint-staged packages are being used to lint and format on pre-commits.
If any error happens, your IDE will inform you and display logs.
The following config in package.json tells husky what to do on pre-commits:
{
"lint-staged": {
"*.{js,ts,json}": ["prettier --write", "eslint --fix", "npx oxlint --fix"]
}
}This library provides convenient and easy access to the Groq REST API from server-side TypeScript or JavaScript which allows using their LLM's for chat completion
A markdown parser which converts markdown into HTML -- this was used for generating html pages after comparison. Marked is built for speed and super light-weight!
Prettier is a code formatted which enforces consistent style by parsing the code and re-printing it with the rules set in .prettierrc file.
Eslint is used to identify issues in and evaluate the code.
Jest is used to thoroughly test and mock small pieces of OptimizeIt.