Skip to content

iNViTiON/Advent-of-Code-2022

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeQL unit-test

What is it?

https://adventofcode.com/2022 in TypeScript with RxJS

How to execute

Recommend to run using NodeJS 18+ with corepack.
Recommend to run using Volta. Just run with dev script for develop. The script will watch, re-build, and re-run everytime the file change.

# corepack enable # moving to Volta
yarn install
yarn dev {dayNum} {part} {input: 'ex' | 'in'}

e.g. dev with day 1 part 1 sample

yarn dev 1 1 ex

How to run test

Running specific test

yarn test {dayNum} {part|testname}

Running all test

yarn  test-all

Note

  • Fix Yarn version inside package.json.
    • But not store Yarn release inside repository.
    • Recommended to enable NodeJS corepack.
    • Moving to Volta instead of corepack to fix both Yarn and Node.js.
  • Using Yarn PnP but not Zero-Installs like Advent-of-Code 2021 since we need native binary from SWC and esbuild
  • Yarn PnP install still fast. But I add post-install script to update sdks and now it a bit slow.
  • Using Volta at work, so I decide to use it here too.
  • Not using TS to compile or run anythings here. Just keeping the package to maintain VS Code integration with Yarn PnP via Yarn SDKS.
  • First time try using SWC swc to build instead of TypeScript tsc.
  • First time try using esbuild to build instead of TypeScript tsc.
  • First time bundle output using esbuild.
  • First time minify output using esbuild.
  • First time try using tsx to run, both for app and test.
  • First time try using Node.js native test runner.
  • This year I decide to goes with many new tools, e.g. SWC or native NodeJS watch or native ESM, I just can't figure out how to combine all those tool into one command that still work with Yarn PnP. So I just separate build and serve commands then combine it with concurrently.
  • After day 3, try moving from SWC to esbuild with added of bundling. SWC script command still available by append -swc.
  • dev script build before invoke concurrently, to prevent dev fail to serve since the app never build and the file didn't exist.

No Nodemon ?