Skip to content

Commit

Permalink
Post-release (0.2.0) dependency updates & related (getodk#163)
Browse files Browse the repository at this point in the history
* Bump Node version matrix

Manually verified on 22.4.1 (in case `tree-sitter` et al have issues):

- clean install
- monorepo-wide build and test

* Bump Yarn to v1 latest

Manually verified again (in case `tree-sitter` et al have issues):

- clean install
- monorepo-wide build and test

* Dependency updates

Includes (automated via codemod) update to `turbo.json`, which was necessary to validate build & test. Note that this was a semver major update. Seems to have gone smoothly (after rolling back the dep update and re-updating with the codemod). The release notes hype an improved CLI experience, but I don’t think we’ll benefit from it unless/until we embrace Turborepo more fully (i.e. moving more of the task orchestration from package scripts into turbo.json).

- - -

After install in dev environments, you’ll likely need to run `yarn playwright install` to update the browsers used by Playwright (both directly, and in VItest browser mode)

- - -

For the most part, this is just latest of everything that has updates, except:

- Vue, which we have currently pinned to the version in central-frontend. That should really be updated: IIRC it hadn’t been for 10mo when we last did updates, and it’s now one of our two most error-prone/manual intervention driving deps. If not careful, lockfile-only updates can cause build failures in `@getodk/web-forms`!

- Primevue, which I expect we’ll want to update separately with dedicated effort to address its semver-major changes.

- Sass, which only has a patch release, but it introduces some [deprecation warnings](https://sass-lang.com/documentation/breaking-changes/mixed-decls/). We should definitely heed these warnings! But as far as I could tell, they’re out of our control (all coming from Primevue styles). We’ll likely want to update Sass and Primevue together when ready.

- To further reduce error-prone/manual intervention of the other (tree-sitter &co), more of its *implied peer dependencies* have been pinned to exact versions (or done so consistently across root/sub-packages). This includes `nan` and `node-gyp`. Hopefully this will reduce the risk of weird succeed-then-fail installs as I’ve seen in previous passes on this set of updates.

- - -

One dependency was removed from xforms-engine which was missed when we broke out the ui-solid package.

- - -

The most significant semver major update I saw was Vitest &co. From reading their release notes, this doesn’t seem like a risky update. There will be some adjustments in a a later commit.

- - -

Not everything follows semver! We continue to pin `typescript` with ~ (accounting for the fact that TS x.y updates are typically where breaking changes are introduced).

* Fix: Adapt Node runtime detection to account for Vitest browser mode changes

* Vitest config updates…

1. In browser mode, Vitest now captures screenshots of failing tests by default. First of all, this is not useful for us, for the vast majority of our browser testing scenarios (if any!). Second of all, it apparently does this even for **expected failures**! We override this default across all packages.
2. In addressing (1), it became clear that some of the Vitest config types are not available (if importing `defineConfig` from 'vite') or cause conflicts with plugins (if importing `defineConfig` from 'vitest/config’). As a stopgap to unblock this set of dependency updates, a shared type for the `test` field is introduced, and `satisfies VitestTestConfig` is used to allow the TS language server to infer the config’s types. This was helpful for discovering the `screenshotFailures` option, as well as prompting the next change…
3. For the most part, we’ve removed `transformMode` configs as Vite-/Vitest-related tooling stabilized earlier in Web Forms exploratory development. The cases where the config remained were no longer consistent with the updated Vitest config types. I first updated them to match the new types, but then I discovered that the options are no longer necessary in any cases that remained. So they’ve been removed completely.

* Format update

Thanks Prettier 🙃

* Add no-op `test` script to `scripts` package

This package was originally going to be removed on this branch. It had never been used, and its presence made it a much bigger hassle to validate dependency updates and other project-wide changes. Despite mentioning plans to remove the package a couple days ago, removing it now will be in conflict with getodk#162.

In the interest of unblocking many substantial improvements downstream, some of which have been in limbo for a couple weeks, I’ve reverted the removal. Instead, adding this script provides a small quality of life improvement for future project-wide improvements by eliminating impediments to running all tests across all packages that actually have tests (`yarn workspaces run test` fails unless every workspace has a `test` script).
  • Loading branch information
eyelidlessness authored Jul 12, 2024
1 parent 19b31f5 commit 8348215
Show file tree
Hide file tree
Showing 23 changed files with 1,465 additions and 1,672 deletions.
72 changes: 36 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:

strategy:
matrix:
node-version: ['18.20.3', '20.13.1', '22.2.0']
node-version: ['18.20.4', '20.15.1', '22.4.1']

steps:
- uses: 'actions/checkout@v4'

- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
yarn-version: '1.22.22'

- uses: 'actions/cache@v4'
id: cache-install
Expand Down Expand Up @@ -82,15 +82,15 @@ jobs:

strategy:
matrix:
node-version: ['22.2.0']
node-version: ['22.4.1']

steps:
- uses: 'actions/checkout@v4'

- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
yarn-version: '1.22.22'

- uses: 'actions/cache@v4'
id: cache-install
Expand Down Expand Up @@ -128,16 +128,16 @@ jobs:
strategy:
matrix:
target: ['Node']
node-version: ['18.20.3', '20.13.1', '22.2.0']
node-version: ['18.20.4', '20.15.1', '22.4.1']
include:
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: chromium
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: firefox
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: webkit

steps:
Expand All @@ -146,7 +146,7 @@ jobs:
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
yarn-version: '1.22.22'

- uses: 'actions/cache@v4'
id: cache-install
Expand Down Expand Up @@ -192,16 +192,16 @@ jobs:
strategy:
matrix:
target: ['Node']
node-version: ['18.20.3', '20.13.1', '22.2.0']
node-version: ['18.20.4', '20.15.1', '22.4.1']
include:
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: chromium
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: firefox
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: webkit

steps:
Expand All @@ -210,7 +210,7 @@ jobs:
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
yarn-version: '1.22.22'

- uses: 'actions/cache@v4'
id: cache-install
Expand Down Expand Up @@ -256,16 +256,16 @@ jobs:
strategy:
matrix:
target: ['Node']
node-version: ['18.20.3', '20.13.1', '22.2.0']
node-version: ['18.20.4', '20.15.1', '22.4.1']
include:
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: chromium
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: firefox
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: webkit

steps:
Expand All @@ -274,7 +274,7 @@ jobs:
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
yarn-version: '1.22.22'

- uses: 'actions/cache@v4'
id: cache-install
Expand Down Expand Up @@ -320,16 +320,16 @@ jobs:
strategy:
matrix:
target: ['Node']
node-version: ['18.20.3', '20.13.1', '22.2.0']
node-version: ['18.20.4', '20.15.1', '22.4.1']
include:
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: chromium
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: firefox
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: webkit

steps:
Expand All @@ -338,7 +338,7 @@ jobs:
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
yarn-version: '1.22.22'

- uses: 'actions/cache@v4'
id: cache-install
Expand Down Expand Up @@ -389,15 +389,15 @@ jobs:

strategy:
matrix:
node-version: ['18.20.3', '20.13.1', '22.2.0']
node-version: ['18.20.4', '20.15.1', '22.4.1']

steps:
- uses: 'actions/checkout@v4'

- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
yarn-version: '1.22.22'

- uses: 'actions/cache@v4'
id: cache-install
Expand Down Expand Up @@ -433,16 +433,16 @@ jobs:
strategy:
matrix:
target: ['Node']
node-version: ['18.20.3', '20.13.1', '22.2.0']
node-version: ['18.20.4', '20.15.1', '22.4.1']
include:
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: chromium
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: firefox
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: webkit

steps:
Expand All @@ -451,7 +451,7 @@ jobs:
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
yarn-version: '1.22.22'

- uses: 'actions/cache@v4'
id: cache-install
Expand Down Expand Up @@ -497,16 +497,16 @@ jobs:
strategy:
matrix:
target: ['Node']
node-version: ['18.20.3', '20.13.1', '22.2.0']
node-version: ['18.20.4', '20.15.1', '22.4.1']
include:
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: chromium
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: firefox
- target: 'Web'
node-version: '22.2.0'
node-version: '22.4.1'
browser: webkit

steps:
Expand All @@ -515,7 +515,7 @@ jobs:
- uses: 'volta-cli/action@v4'
with:
node-version: '${{ matrix.node-version }}'
yarn-version: '1.22.19'
yarn-version: '1.22.22'

- uses: 'actions/cache@v4'
id: cache-install
Expand Down
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
"type": "module",
"version": "0.1.0",
"engines": {
"node": "^18.20.3 || ^20.13.1 || ^22.2.0",
"yarn": "1.22.19"
"node": "^18.20.4 || ^20.15.1 || ^22.4.1",
"yarn": "1.22.22"
},
"volta": {
"node": "22.2.0",
"yarn": "1.22.19"
"node": "22.4.1",
"yarn": "1.22.22"
},
"packageManager": "[email protected]",
"workspaces": [
"packages/*",
"scripts"
Expand All @@ -31,36 +32,36 @@
},
"dependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.3",
"@eslint/js": "^9.3.0",
"@changesets/cli": "^2.27.7",
"@eslint/js": "^9.6.0",
"@eslint/eslintrc": "^3.1.0",
"@tsconfig/node20": "^20.1.2",
"@tsconfig/node20": "^20.1.4",
"@types/eslint__js": "^8.42.3",
"@types/eslint": "^8.56.10",
"@types/eslint-config-prettier": "^6.11.3",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"@typescript-eslint/parser": "^7.10.0",
"@types/jsdom": "^21.1.7",
"@types/node": "^20.14.10",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.16.0",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/tsconfig": "^0.5.1",
"eslint": "^9.3.0",
"eslint": "^9.6.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^48.2.6",
"eslint-plugin-jsdoc": "^48.7.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-vue": "^9.26.0",
"nan": "^2.19.0",
"node-gyp": "^10.1.0",
"npm-run-all2": "^6.2.0",
"eslint-plugin-vue": "^9.27.0",
"nan": "2.20.0",
"node-gyp": "10.2.0",
"npm-run-all2": "^6.2.2",
"only-allow": "^1.2.1",
"organize-imports-cli": "^0.10.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.7",
"turbo": "^1.13.3",
"typescript": "~5.4.5",
"typescript-eslint": "^7.10.0",
"prettier": "^3.3.2",
"rimraf": "^5.0.9",
"turbo": "^2.0.6",
"typescript": "~5.5.3",
"typescript-eslint": "^7.16.0",
"vue": "3.3.4",
"vue-tsc": "^2.0.19"
},
Expand Down
12 changes: 6 additions & 6 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"README.md"
],
"engines": {
"node": "^18.20.3 || ^20.13.1 || ^22.2.0",
"yarn": "1.22.19"
"node": "^18.20.4 || ^20.15.1 || ^22.4.1",
"yarn": "1.22.22"
},
"scripts": {
"test": "npm-run-all --print-name --print-label test-node:* test-browser:*",
Expand All @@ -51,9 +51,9 @@
"test:types": "tsc --project ./tsconfig.json --emitDeclarationOnly false --noEmit"
},
"devDependencies": {
"@vitest/browser": "^1.6.0",
"jsdom": "^24.0.0",
"vite": "^5.2.11",
"vitest": "^1.6.0"
"@vitest/browser": "^2.0.2",
"jsdom": "^24.1.0",
"vite": "^5.3.3",
"vitest": "^2.0.2"
}
}
19 changes: 19 additions & 0 deletions packages/common/src/env/detection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Specifies detection of Node runtime environment.
*/
// This is a heuristic which, unfortunately, may need to evolve as tooling
// packages are updated (hence it now being shared across packages). Details of
// its evolution will be noted as they're added or modified.
// prettier-ignore
export const IS_NODE_RUNTIME =
// Previously we only checked that this global object is defined...
typeof process === 'object' && process !== null &&

// ... we have added this heuristic to adapt to a change in Vitest's browser
// mode, which began poulating `process.env` (via Vite's `define` config) with
// some conditions apparently used to mollify `testing-library`. It isn't
// exactly clear why any `testing-library` packages are installed by Vitest
// itself (though it appears there is some guidance to use it and/or its
// framework-specific variants for certain browser testing scenarios since
// @vitest/browser v2).
typeof (process as Partial<NodeJS.Process>).versions?.node === 'string';
3 changes: 3 additions & 0 deletions packages/common/types/vitest-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type { UserConfig } from 'vitest/config';

export type VitestTestConfig = NonNullable<UserConfig['test']>;
5 changes: 3 additions & 2 deletions packages/common/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// TODO: much of this may be a good candidate for sharing from this internal package!

import type { CollectionValues } from '@getodk/common/types/collections/CollectionValues.ts';
import type { VitestTestConfig } from '@getodk/common/types/vitest-config.ts';
import { defineConfig } from 'vite';

export default defineConfig(() => {
Expand Down Expand Up @@ -48,6 +49,7 @@ export default defineConfig(() => {
name: BROWSER_NAME!,
provider: 'playwright',
headless: true,
screenshotFailures: false,
},

deps: {
Expand All @@ -64,10 +66,9 @@ export default defineConfig(() => {
},
environment: TEST_ENVIRONMENT,
globals: false,
transformMode: { web: [/\.[jt]sx?$/] },

exclude: ['e2e/**/*'],
reporters: process.env.GITHUB_ACTIONS ? ['default', 'github-actions'] : 'default',
},
} satisfies VitestTestConfig,
};
});
Loading

0 comments on commit 8348215

Please sign in to comment.