Commit Graph

15 Commits

Author SHA1 Message Date
Oliver Eyton-Williams
5f59b2b8c7 feat(api): validate environment variables before use (#49613)
* feat(api): validate environment variables before use

This is similar in concept to ensure-env, but a little simpler since
there is no need to put the data in a file before the api can consume
it.

* refactor: combine the two env files
2023-03-07 10:03:46 -08:00
Oliver Eyton-Williams
113036dad6 feat: depromisify fastify-jwt-authz (#49550) 2023-03-06 16:25:40 +05:30
renovate[bot]
933b909111 fix(deps): update dependency fastify to v4.14.0 2023-03-05 10:44:01 +00:00
renovate[bot]
72321ad76b fix(deps): update dependency nodemon to v2.0.21 2023-03-04 17:30:13 +00:00
Oliver Eyton-Williams
d7848ae01a feat: migrate to pnpm for better workspace DX (#49293)
* feat: npm -> pnpm 

This resolves the issues with the gatsby client (gatsby-plugin-pnpm
deals with the fact that gatsby is relying on its own dependencies
being de-duped)
and challenge-editor (which doesn't seem to want to automatically install
codemirror and needed its own eslint config)

* fix: correct mocha path for curriculum tests

* fix: use select workspace with -F not -w

* fix: reorganise packages and restrict hoisting

pnpm works best if the workspaces keep their own dependencies, since
dependencies are not flattened and then what node resolves from a
require is predictable.

@types seem to be a special case and more care is required to prevent
them getting smushed together in the root (hence the .npmrc)

* fix: add types for tools + root

* fix: decouple challenge-auditor from client

* fix: add ui-components types

* fix(client): use the latest types for react 16

* fix: prettify

* fix: prettierignore pnpm-lock

* fix: relax hoisting

Turns out pnpm works just fine with types. I don't know what was going
wrong before, but there are no-longer any type conflicts.

* fix: add @redux-saga/core to fix eslint issue

It seems to only be redux-saga that import/named can't cope with, so it
is probably okay to work around this one.

* chore: add chai to tools/scripts/build

* fix: add store to root for cypress

* fix: allow cypress to download binaries

If we want to keep preventing cypress from downloading binaries, we can
figure out a workaround, but I'm allowing it to ease the transition to
pnpm.

My guess about why this is happening is that npm triggers Cypress's
postinstall script, but pnpm does not (because pnpm install only
installs if necessary, perferring to link)

* chore: re-enable pre/post scripts

* fix: update build scripts for client

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>

* chore: update engines to use pnpm


* fix: enable choice of (super)block for tests

Only 'nix machines for now.

* chore: pin pnpm to version 7

* chore: remove last npms

Except web + curriculum-server. I'll update them when I start work on
them again.

* fix: lockfile check to catch any package-locks

* fix(action): install pnpm for upcoming tests

* chore: add nodemon to new api

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
2023-03-02 18:17:44 +00:00
Oliver Eyton-Williams
66438c271f fix: add more explicit return types (#49567) 2023-03-02 17:26:40 +00:00
renovate[bot]
e0975e21e5 fix(deps): update dependency fastify to v4.13.0 2023-02-26 07:19:37 +00:00
renovate[bot]
b36bf511d5 fix(deps): update dependency @fastify/mongodb to v6.2.0 (#49512)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-02-25 17:49:32 +02:00
renovate[bot]
ab2b6907d2 fix(deps): update dependency fastify to v4.10.2 [security] 2023-02-24 22:43:58 +00:00
Mrugesh Mohapatra
7199f033fb feat(next-api): basic authentication setup (#49378)
* feat(next-api): add fastify-auth0-verify plugin

* feat(next-api): add fastify-jwt-authz plugin

* feat(next-api): accept privacy endpoint with scopes support

* fix(next-api): ignore eslint and ts errors

They will be fixed in a future PR when the package with errors has been updated

Co-authored-by: Niraj Nandish <nirajnandish@icloud.com>
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2023-02-24 17:26:40 +05:30
Oliver Eyton-Williams
1c9004046b refactor: clean up errors + unused code (#49473)
* refactor: use await/done to mollify eslint

* refactor: clean up unused code

It's also more of an express pattern. Fastify routes should be
registered as plugins.
2023-02-24 17:25:56 +05:30
Oliver Eyton-Williams
f35ab4d0ba refactor: clean up types and tsconfig (#49360) 2023-02-24 17:25:53 +05:30
Shaun Hamilton
37ed23ef38 feat(api): add node:test (#48437) 2023-02-24 17:25:22 +05:30
Shaun Hamilton
f7644bec68 feat(api): example middleware (#48434)
* feat(api): add middleware example

* feat(api): add `@fastify/middie`, reorder for alphabetness

* [skip-ci] [skip ci]
2023-02-24 17:25:21 +05:30
Shaun Hamilton
6d46f61fe9 refactor(api): shiny new api (#48432) 2023-02-24 17:23:15 +05:30