Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

feat: compile ts incrementally - #685

Merged
ojeytonwilliams merged 40 commits into
freeCodeCamp:mainfrom
ojeytonwilliams:feat/compile-ts
Aug 19, 2021
Merged

ojeytonwilliams merged 40 commits into
freeCodeCamp:mainfrom
ojeytonwilliams:feat/compile-ts

Conversation

@ojeytonwilliams

@ojeytonwilliams ojeytonwilliams commented Aug 10, 2021 •

Copy link
Copy Markdown
Contributor

This supersedes #684 because I realised that in order to test the docker build in CI, the tests needed to be much faster.

What this does

In a nutshell, it replaces ts-node with node. Instead of compiling TypeScript on the fly and on each call to npm run db:reset it compiles it once and only re-compiles when a source file has changed. This makes the dev experience (and tests) a lot snappier. db:reset is roughly 10 times quicker now, for instance.

Also, this makes the production environment a little quicker, too, since we can compile the TS before starting the server. In principle ts-node can do this, too, but I'd rather cut out the intermediary and just use js directly.

Docker changes

The dev experience should be unchanged, but now we have a production-like version, and Cypress tests to run against it. It would be nice to check the dev-mode in CI, but it's painfully slow to the point that Cypress would need a much larger timeout to pass. As such, it just tests the production-like version. The main difference between that and dev-mode is that dev-mode uses local volumes and npm run dev so that code changes are watched.

Reorganisation

The changes in #684 are included.

@gitpod-io

gitpod-io Bot commented Aug 10, 2021

Copy link
Copy Markdown

Since the root dependencies aren't getting into the docker image anymore
this adds concurrently to the server
Also makes the server's volume mirror the clients (i.e. it's just the
server dir, not root)
@ojeytonwilliams
ojeytonwilliams marked this pull request as ready for review August 11, 2021 09:24
Comment thread CONTRIBUTING.md Resolved
typeorm needs to be called from the server directory, but this can be
achieved by cd'ing into server rather than using npm scripts that call
npm scripts
Running the tests inside Docker seems redundant - if we make a mistake
in the Docker config, the e2e tests will flag that up.
@ojeytonwilliams
ojeytonwilliams merged commit dae64fe into freeCodeCamp:main Aug 19, 2021
@ojeytonwilliams
ojeytonwilliams deleted the feat/compile-ts branch August 19, 2021 08:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants