mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
Merge pull request #3122 from jspsych/update-config-package
Update `@jspsych/config` dependencies
This commit is contained in:
commit
76fca2712f
5
.changeset/blue-donuts-relate.md
Normal file
5
.changeset/blue-donuts-relate.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jspsych/config": patch
|
||||
---
|
||||
|
||||
Remove erroneous browser builds from the rollup configuration returned by `makeNodeRollupConfig()`
|
9
.changeset/lovely-cobras-give.md
Normal file
9
.changeset/lovely-cobras-give.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
"@jspsych/config": major
|
||||
---
|
||||
|
||||
Upgrade build tools to their latest versions. This doesn't introduce breaking changes to the artifacts built using `@jspsych/config`, but it requires some minor changes to projects using `@jspsych/config`:
|
||||
|
||||
- The minimum required Node.js version is now 18.0.0
|
||||
- Jest has been upgraded from v28 to v29 and ts-jest has been replaced with the more performant Sucrase Jest plugin to avoid significant memory leaks. As a consequence, Jest does no longer type-check code. If you are facing any issues, please check Jest's [upgrade guide](https://jestjs.io/docs/upgrading-to-jest29) for instructions on updating your tests.
|
||||
- TypeScript has been upgraded from version 4 to version 5. This is very unlikely to break anything in your code though.
|
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
@ -9,26 +9,23 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node: [14, 16]
|
||||
node: [18, 20]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js ${{ matrix.node }}
|
||||
uses: actions/setup-node@v2
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: npm
|
||||
|
||||
- name: Install npm@v7
|
||||
run: npm install -g npm@7
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
# Running this after `npm ci` because `npm ci` removes `node_modules`:
|
||||
- name: Download Turborepo cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules/.cache/turbo
|
||||
key: ${{ runner.os }}-node-${{ matrix.node }}-turbo-${{ hashFiles('node_modules/.cache/turbo') }}
|
||||
@ -38,14 +35,7 @@ jobs:
|
||||
- name: Build packages
|
||||
run: npm run build
|
||||
|
||||
# TODO setup linting
|
||||
# - name: Lint
|
||||
# run: npm run lint
|
||||
|
||||
- name: Run tests
|
||||
run: npm run test -- --ci --coverage --maxWorkers=2
|
||||
env:
|
||||
NODE_OPTIONS: "--max-old-space-size=4096" # Increase heap size for jest
|
||||
# TODO setup codecov or coveralls
|
||||
# - name: Upload coverage to Codecov
|
||||
# uses: codecov/codecov-action@v1
|
||||
|
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
@ -16,24 +16,24 @@ jobs:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js 16
|
||||
uses: actions/setup-node@v2
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Download Turborepo cache
|
||||
uses: actions/cache@v2
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules/.cache/turbo
|
||||
key: ${{ runner.os }}-node-16-turbo-${{ hashFiles('node_modules/.cache/turbo') }}
|
||||
key: ${{ runner.os }}-node-20-turbo-${{ hashFiles('node_modules/.cache/turbo') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-16-turbo-
|
||||
${{ runner.os }}-node-20-turbo-
|
||||
|
||||
- name: Run tests
|
||||
run: npm run test -- --ci --maxWorkers=2
|
||||
|
21516
package-lock.json
generated
21516
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -20,21 +20,21 @@
|
||||
"docs:serve": "poetry install && poetry run mike serve"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
"node": ">=18.0.0",
|
||||
"npm": ">=9.0.0"
|
||||
},
|
||||
"packageManager": "npm@8.3.1",
|
||||
"devDependencies": {
|
||||
"@changesets/changelog-github": "^0.4.4",
|
||||
"@changesets/cli": "^2.22.0",
|
||||
"alias-hq": "github:bjoluc/alias-hq#tsconfig-parsing-quickfix",
|
||||
"husky": "^8.0.1",
|
||||
"import-sort-style-module": "^6.0.0",
|
||||
"jest": "*",
|
||||
"lint-staged": "^12.4.1",
|
||||
"prettier": "^2.6.2",
|
||||
"prettier-plugin-import-sort": "^0.0.7",
|
||||
"turbo": "^1.2.9",
|
||||
"jest": "*",
|
||||
"ts-jest": "*"
|
||||
"turbo": "^1.2.9"
|
||||
},
|
||||
"prettier": {
|
||||
"printWidth": 100
|
||||
|
@ -1,21 +1,13 @@
|
||||
const ts = require("typescript");
|
||||
const { pathsToModuleNameMapper } = require("ts-jest");
|
||||
const hq = require("alias-hq");
|
||||
|
||||
/** @type { (dirname: string) => import('@jest/types').Config.InitialOptions } */
|
||||
module.exports.makePackageConfig = (dirname) => {
|
||||
const packageJson = require(dirname + "/package.json");
|
||||
const packageBaseName = packageJson.name.replace("@jspsych/", "");
|
||||
|
||||
// based on https://github.com/formium/tsdx/blob/462af2d002987f985695b98400e0344b8f2754b7/src/createRollupConfig.ts#L51-L57
|
||||
const tsCompilerOptions = ts.parseJsonConfigFileContent(
|
||||
ts.readConfigFile(dirname + "/tsconfig.json", ts.sys.readFile).config,
|
||||
ts.sys,
|
||||
dirname
|
||||
).options;
|
||||
|
||||
return {
|
||||
preset: "ts-jest",
|
||||
moduleNameMapper: pathsToModuleNameMapper(tsCompilerOptions.paths, { prefix: "<rootDir>/" }),
|
||||
transform: { "\\.(js|jsx|ts|tsx)$": "@sucrase/jest-plugin" },
|
||||
moduleNameMapper: hq.load(dirname + "/tsconfig.json").get("jest"),
|
||||
testEnvironment: "jsdom",
|
||||
testEnvironmentOptions: {
|
||||
fetchExternalResources: true,
|
||||
|
@ -25,7 +25,7 @@
|
||||
"./tsconfig.contrib.json": "./tsconfig.contrib.json"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -39,33 +39,35 @@
|
||||
},
|
||||
"homepage": "https://www.jspsych.org/latest/developers/configuration",
|
||||
"dependencies": {
|
||||
"@babel/cli": "7.17.10",
|
||||
"@babel/core": "7.17.10",
|
||||
"@babel/preset-env": "7.17.10",
|
||||
"@rollup/plugin-babel": "5.3.1",
|
||||
"@rollup/plugin-commonjs": "22.0.0",
|
||||
"@rollup/plugin-json": "4.1.0",
|
||||
"@rollup/plugin-node-resolve": "13.3.0",
|
||||
"@rollup/plugin-replace": "4.0.0",
|
||||
"@types/gulp": "4.0.9",
|
||||
"@types/jest": "27.5.1",
|
||||
"@babel/cli": "7.23.0",
|
||||
"@babel/core": "7.23.3",
|
||||
"@babel/preset-env": "7.23.3",
|
||||
"@rollup/plugin-babel": "6.0.4",
|
||||
"@rollup/plugin-commonjs": "25.0.7",
|
||||
"@rollup/plugin-json": "6.0.1",
|
||||
"@rollup/plugin-node-resolve": "15.2.3",
|
||||
"@rollup/plugin-replace": "5.0.5",
|
||||
"@rollup/plugin-terser": "0.4.4",
|
||||
"@sucrase/jest-plugin": "3.0.0",
|
||||
"@types/gulp": "4.0.17",
|
||||
"@types/jest": "29.5.8",
|
||||
"alias-hq": "6.2.3",
|
||||
"babel-preset-minify": "0.5.2",
|
||||
"canvas": "2.11.2",
|
||||
"canvas": "^2.11.2",
|
||||
"gulp": "4.0.2",
|
||||
"gulp-cli": "2.3.0",
|
||||
"gulp-file": "^0.4.0",
|
||||
"gulp-rename": "2.0.0",
|
||||
"gulp-replace": "1.1.3",
|
||||
"gulp-zip": "5.1.0",
|
||||
"jest": "28.1.0",
|
||||
"jest-environment-jsdom": "28.1.0",
|
||||
"gulp-replace": "1.1.4",
|
||||
"gulp-zip": "6.0.0",
|
||||
"jest": "29.7.0",
|
||||
"jest-environment-jsdom": "29.7.0",
|
||||
"merge-stream": "2.0.0",
|
||||
"regenerator-runtime": "0.13.9",
|
||||
"rollup": "2.73.0",
|
||||
"rollup-plugin-terser": "7.0.2",
|
||||
"rollup-plugin-typescript2": "0.31.2",
|
||||
"ts-jest": "28.0.2",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "^4.6.4"
|
||||
"regenerator-runtime": "0.14.0",
|
||||
"rollup": "4.3.0",
|
||||
"rollup-plugin-typescript2": "0.36.0",
|
||||
"sucrase": "3.34.0",
|
||||
"tslib": "2.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ import commonjs from "@rollup/plugin-commonjs";
|
||||
import json from "@rollup/plugin-json";
|
||||
import resolve from "@rollup/plugin-node-resolve";
|
||||
import replace from "@rollup/plugin-replace";
|
||||
import terser from "@rollup/plugin-terser";
|
||||
import { defineConfig } from "rollup";
|
||||
import { terser } from "rollup-plugin-terser";
|
||||
import typescript from "rollup-plugin-typescript2";
|
||||
import ts from "typescript";
|
||||
|
||||
@ -148,5 +148,5 @@ export const makeCoreRollupConfig = () =>
|
||||
export const makeNodeRollupConfig = () =>
|
||||
makeConfig({
|
||||
globalOptions: { external: ["jspsych"] },
|
||||
nodeOnly: true,
|
||||
isNodeOnlyBuild: true,
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
import htmlKeyboardResponse from "@jspsych/plugin-html-keyboard-response";
|
||||
import { pressKey, startTimeline } from "@jspsych/test-utils";
|
||||
|
||||
jest.useFakeTimers("modern");
|
||||
jest.useFakeTimers();
|
||||
|
||||
describe("minimum_valid_rt parameter", () => {
|
||||
test("has a default value of 0", async () => {
|
||||
|
@ -14,7 +14,7 @@ describe("survey-html-form plugin", () => {
|
||||
]);
|
||||
|
||||
expect(
|
||||
displayElement.querySelectorAll('#jspsych-survey-html-form input:not([type="submit"]').length
|
||||
displayElement.querySelectorAll('#jspsych-survey-html-form input:not([type="submit"])').length
|
||||
).toBe(3);
|
||||
|
||||
// Provide some test input
|
||||
|
@ -62,7 +62,7 @@ describe("survey-likert plugin simulation", () => {
|
||||
|
||||
await expectFinished();
|
||||
|
||||
const surveyData = getData().values()[0].response;
|
||||
const surveyData = getData().values()[0].response as Record<string, number>;
|
||||
const all_valid = Object.entries(surveyData).every((x) => {
|
||||
return x[1] <= 4 && x[1] >= 0;
|
||||
});
|
||||
@ -94,7 +94,7 @@ describe("survey-likert plugin simulation", () => {
|
||||
|
||||
await expectFinished();
|
||||
|
||||
const surveyData = getData().values()[0].response;
|
||||
const surveyData = getData().values()[0].response as Record<string, number>;
|
||||
const all_valid = Object.entries(surveyData).every((x) => {
|
||||
return x[1] <= 4 && x[1] >= 0;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user