From 06bcf498ceb4a7b7664c445a1500397f19c1a8a8 Mon Sep 17 00:00:00 2001 From: Sean Fong Date: Wed, 25 Sep 2024 21:10:44 +0930 Subject: [PATCH] Change GitHub actions for jest tests to use node 17 to support structuredClone() --- .github/workflows/build_test_lint.yml | 6 +++--- CONTRIBUTING.md | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_test_lint.yml b/.github/workflows/build_test_lint.yml index 38bb6a43d..827c91a0a 100644 --- a/.github/workflows/build_test_lint.yml +++ b/.github/workflows/build_test_lint.yml @@ -35,14 +35,14 @@ jobs: run: cd apps/demo-renderer-app && npm run build jest-test: - name: Jest Tests + name: Jest Tests (only runs on node 18) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Use Node.js 16.x + - name: Use Node.js 18.x uses: actions/setup-node@v4 with: - node-version: 16 + node-version: 18 cache: npm - name: Install dependencies run: npm ci diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 19d94f61d..2a132dee3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,9 +30,9 @@ If possible, it is recommended to merge the `main` branch into your branch first ## Development dependencies -You will need the following software to build the solution: +You will need the following software to build the solution and run the tests: -* Node.js 16.x or 18.x +* Node.js 18.x or later versions To build and install locally, run in the root folder: ``` @@ -45,6 +45,16 @@ The easiest way to test your changes is to use Storybook, which can be run via: npm run storybook ``` +## Vite-specific caveats +The `vite.config.ts` file in the `@aehrc/smart-forms-renderer` package contains a `resolve: { preserveSymlinks: true }` config, when used alongside `optimizeDeps` and `build.commonjsOptions` allows Vite to use CommonJS modules in the package properly. + +This config is essential for the package to properly build in deployments, but it breaks `tsc --watch` by ignoring changes. +To work around this, comment out the config during development and uncomment it (or just don't add it to git) before pushing changes. +``` +... +// resolve: { preserveSymlinks: true } +... +``` ### Coding conventions