In order to run this project you will need:
- Node.js
- Typescript > 3.7
npm install -g typescript
- JavaScript and TypeScript Nightly Visual Studio Code extension installed.
- https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-next
- To make sure you are using the latest version of typescript:
- Open a TypeScript file in VS Code.
- In the VS Code command palette (press F1), run the TypeScript: Select TypeScript version command.
- Make sure you have Use VS Code's version selected
You must create a file called .env with the API keys in that format in order to run the module correctly.
GoogleCustomSearchAPIKey_00=AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxx
GoogleCustomSearchEngineId_EN_00=xxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxx
GoogleCustomSearchEngineId_IT_00=xxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxx
GoogleCustomSearchEngineId_EN_KIDS=xxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxx
GoogleCustomSearchEngineId_IT_KIDS=xxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxx
npm i # install dependencies
npm start # start the server in watch modenpm i # install dependencies
npm start # start the server in watch mode
npm start:d # start the server in watch mode and attach the debugger
npm run build # compiles src/*.ts in dist/*.js
npm run watch # automatically compiles ts when the file is saved
npm run webpack # start webpack in watch mode (compiles the UI)
npm t # run unit tests
npm t -- filename # run a specific test file
npm tun test:d # run tests and attach the debugger
npm run test:watch # run tests in watch mode (TDD)
npm run lint # run linter
npm run lint:fix # run linter with --fix option
npm run docs # generate the documentation in /docsWe are using ESLint as linter together with a plugin to make it work properly with TypeScript. The list of our rules can be found in eslintrc.js. Whenever we use a rule specified in typescript-eslint-plugin we need to disable the original ESLint rule and override it with the one provided by the plugin.
Useful links: - Available ESLint rules - Available TypeScript rules
- assets contains example json that we use for testing purposes.
- client contains the UI for testing purposes and a visualization tool for debugging.
- docs contains the documentation of each class, automatically generated by TypeScript using the JSdoc.
- src
- models contains the TypeScript classes and interfaced used for the exchanged objects.
- parser parses url and extracts page content, divides it into sections and extracts keywords using the rake approach.
- search builds the queries and performs searches on Google Search.
- wiki
- adaptation.ts abstracts communication with the adaptation modules.
- app.ts is the server with the main flow.
- declarations.ts contains declarations for non-typescript libraries.
- environment.ts parses the .env file.
- index.ts starts the server.
- logger.ts is used to log on file.
- utils.ts contains utility functions.
- tests divided in unit and integration tests.
/.envcontains the environment variables.- config.json contains variables and settings used in our app.
- *-cache contains the cached Google Search results, since we have a limited number of queries each day.
- The other files are the configurations for Node.js, TypeScript, ESlint, git, etc.