Vector search for Guardian articles
- Install
miseif you don't have it - Run
mise installto install toolchain from.tool-versions - Run
npm installto install node dependencies
mise and the .tool-versions toolchain will be installed automatically when the container is created.
You need to run ./scripts/setup.sh, it will:
- install the tools from
.tool-versions. - install the dependencies.
- start the local OpenSearch.
- create the indices and mappings.
- seed the local indices.
We use npm workspaces to manage multiple packages within the repo, and we share Guardian standard tsconfig, eslint and prettier configs across all packages.
You can run commands across all packages from the project root, e.g.:
npm run format:fixwill re-format code across all packages to match Guardian prettier style.
- Add its directory to the root
package.jsonworkspaces list. - Give it a
package.jsonwith"private": true(unless it will be published),"type": "module"and package-specific dependencies. - Extend the root TypeScript configuration and include only the package's sources (see the example below).
- Add
"typecheck": "tsc --noEmit"and a package-appropriate native Node test script. Optional local lint/format scripts can invoke the shared tools. - Do not duplicate ESLint/Prettier configuration or shared tooling dependencies. Packages that require a different runtime or a bundler should override the relevant settings explicitly.
Example package tsconfig.json:
{
"extends": "../tsconfig.json",
"include": ["src/**/*.ts"]
}.vscode/extensions.json should tell VSCode to prompt you to install our recommended extensions for linting & formatting.
.vscode/settings.json.default contains our recommended settings. As per Guardian recommendations, we do not force these settings on you by committing settings.json, but if you want smooth autolinting & autoformatting, we recommend you copy these to .vscode/settings.json.