diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6c6232cb4..d76ea042e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,7 +46,7 @@ jobs: run: | yarn upgrade typescript@5.0 yarn --frozen-lockfile - yarn type-validate + yarn validate:types validate-legacy-node: runs-on: ubuntu-latest steps: diff --git a/_SETUP.md b/_SETUP.md index 77c688c85..d6da24761 100644 --- a/_SETUP.md +++ b/_SETUP.md @@ -57,20 +57,26 @@ yarn test:unit --watch yarn test:update-snapshots ``` +### To run benchmarks + +```bash +yarn benchmark +``` + ### To run code formatter (prettier) run ```bash -yarn pretty-lint-fix +yarn fmt ``` ### To run all linters use This performs linting on: -- eslint (code-lint script) -- schema + dependencies (jest-lint script) -- types (type-lint script) -- format + generated files (special-lint script) +- eslint (lint:code script) +- dependencies (lint:yarn script) +- types (lint:types script) +- schema + format + generated files (lint:special script) ```bash yarn lint diff --git a/package.json b/package.json index 0f6321c05..80359be56 100644 --- a/package.json +++ b/package.json @@ -144,34 +144,34 @@ "types.d.ts" ], "scripts": { + "prepare": "husky", "setup": "node ./setup/setup.js", - "jest": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage", + "prelint": "yarn setup", + "lint": "yarn lint:code && yarn lint:special && yarn lint:types && yarn lint:types-test && yarn lint:types-module-test && yarn lint:yarn && yarn fmt:check && yarn lint:spellcheck", + "lint:code": "node node_modules/eslint/bin/eslint.js --cache .", + "lint:special": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals", + "lint:types": "tsc", + "lint:types-test": "tsc -p tsconfig.types.test.json", + "lint:types-module-test": "tsc -p tsconfig.module.test.json", + "lint:yarn": "yarn-deduplicate --fail --list -s highest yarn.lock", + "lint:spellcheck": "cspell --cache --no-must-find-files --quiet \"**/*.*\"", + "report:types": "rimraf coverage && yarn cover:types && yarn cover:report && open-cli coverage/lcov-report/index.html", + "validate:types": "tsc -p tsconfig.validation.json", + "fmt": "yarn fmt:base --log-level warn --write", + "fmt:check": "yarn fmt:base --check", + "fmt:base": "node node_modules/prettier/bin/prettier.cjs --cache --ignore-unknown .", + "fix": "yarn fix:code && fix:yarn && fix:special && yarn fmt", + "fix:code": "yarn lint:code --fix", + "fix:yarn": "yarn-deduplicate -s highest yarn.lock", + "fix:special": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write", + "build:examples": "cd examples && node buildAll.js", + "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation --hash-seed=1 --random-seed=1 --no-opt --predictable --predictable-gc-schedule --interpreted-frames-native-stack --allow-natives-syntax --expose-gc --no-concurrent-sweeping ./test/BenchmarkTestCases.benchmark.mjs", + "pretest": "yarn lint", "test": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage", - "test:update-snapshots": "yarn jest -u", + "test:update-snapshots": "yarn test -u", "test:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"/test/*.{basictest,longtest,test}.js\"", "test:basic": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"/test/*.basictest.js\"", "test:unit": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\"", - "build:examples": "cd examples && node buildAll.js", - "type-report": "rimraf coverage && yarn cover:types && yarn cover:report && open-cli coverage/lcov-report/index.html", - "pretest": "yarn lint", - "prelint": "yarn setup", - "lint": "yarn code-lint && yarn special-lint && yarn type-lint && yarn typings-test && yarn module-typings-test && yarn yarn-lint && yarn pretty-lint && yarn spellcheck", - "code-lint": "node node_modules/eslint/bin/eslint.js --cache .", - "type-lint": "tsc", - "type-validate": "tsc -p tsconfig.validation.json", - "typings-test": "tsc -p tsconfig.types.test.json", - "module-typings-test": "tsc -p tsconfig.module.test.json", - "spellcheck": "cspell --cache --no-must-find-files --quiet \"**/*.*\"", - "special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals", - "special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write", - "fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix", - "prepare": "husky", - "pretty-lint-base": "node node_modules/prettier/bin/prettier.cjs --cache --ignore-unknown .", - "pretty-lint-fix": "yarn pretty-lint-base --log-level warn --write", - "pretty-lint": "yarn pretty-lint-base --check", - "yarn-lint": "yarn-deduplicate --fail --list -s highest yarn.lock", - "yarn-lint-fix": "yarn-deduplicate -s highest yarn.lock", - "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation --hash-seed=1 --random-seed=1 --no-opt --predictable --predictable-gc-schedule --interpreted-frames-native-stack --allow-natives-syntax --expose-gc --no-concurrent-sweeping ./test/BenchmarkTestCases.benchmark.mjs", "cover": "yarn cover:all && yarn cover:report", "cover:clean": "rimraf .nyc_output coverage", "cover:all": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --logHeapUsage --coverage",