diff --git a/.eslintrc.yml b/.eslintrc.yml index b53eaa9..638954d 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -15,15 +15,19 @@ overrides: - extends: .eslintrc.jest.yml files: - '**/__tests__/**' + - '**/*.spec.cjs' - '**/*.spec.mjs' - '**/*.spec.js' - '**/*.spec.jsx' + - '**/*.spec.cts' - '**/*.spec.mts' - '**/*.spec.ts' - '**/*.spec.tsx' + - '**/*.test.cjs' - '**/*.test.mjs' - '**/*.test.js' - '**/*.test.jsx' + - '**/*.test.cts' - '**/*.test.mts' - '**/*.test.ts' - '**/*.test.tsx' @@ -38,6 +42,3 @@ rules: no-empty: - error - allowEmptyCatch: true -settings: - react: - version: 17.0.2 diff --git a/package.json b/package.json index 92f463e..cebf413 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,10 @@ "build": "npm run build --if-present --workspaces", "bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix && npm run bump:packages && npm run bump:eslintrc", "bump:auditfix": "npm audit fix || exit 0", - "bump:dev": "if [ `cat package.json | jq -r '(.devDependencies // {}) | length'` -ne 0 ]; then npm install $(cat package.json | jq -r '(.pinDependencies // {}) as $p | ((.devDependencies // {}) | keys) | map(. + \"@\" + ($p[.] // [\"latest\"])[0]) | .[]'); fi", + "bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .devDependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", "bump:eslintrc": "if [ -f node_modules/react/package.json ]; then docker run -e VERSION=$(cat node_modules/react/package.json | jq -r '.version') -i --rm mikefarah/yq '.settings.react.version = strenv(VERSION)' < ./.eslintrc.react.yml | tee /tmp/output.tmp && mv /tmp/output.tmp ./.eslintrc.react.yml; fi", "bump:packages": "npm run bump --if-present --workspaces", - "bump:prod": "if [ `cat package.json | jq -r '(.dependencies // {}) | length'` -ne 0 ]; then npm install $(cat package.json | jq -r '(.pinDependencies // {}) as $p | ((.dependencies // {}) | keys) | map(. + \"@\" + ($p[.] // [\"latest\"])[0]) | .[]'); fi", + "bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .dependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", "postscaffold": "npm run postscaffold:eslint:react && npm run postscaffold --if-present --workspaces", "postscaffold:eslint:react": "npm run bump:eslintrc", "precommit": "npm run precommit --if-present --workspaces", diff --git a/packages/integration-test/package.json b/packages/integration-test/package.json index cdf652a..2179c47 100644 --- a/packages/integration-test/package.json +++ b/packages/integration-test/package.json @@ -6,11 +6,9 @@ "scripts": { "bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix", "bump:auditfix": "npm audit fix || exit 0", - "bump:dev": "if [ `cat package.json | jq -r '(.devDependencies // {}) | length'` -ne 0 ]; then npm install $(cat package.json | jq -r '(.pinDependencies // {}) as $p | ((.devDependencies // {}) | keys) | map(. + \"@\" + ($p[.] // [\"latest\"])[0]) | .[]'); fi", - "bump:prod": "if [ `cat package.json | jq -r '(.dependencies // {}) | length'` -ne 0 ]; then npm install $(cat package.json | jq -r '(.pinDependencies // {}) as $p | ((.dependencies // {}) | keys) | map(. + \"@\" + ($p[.] // [\"latest\"])[0]) | .[]'); fi", - "postbump": "cat package.json | jq '. + (.dependencies = (((.dependencies // {}) + (.localPeerDependencies // {})) | to_entries | sort_by(.key) | from_entries)) | (.devDependencies = (((.devDependencies // {}) + (.localPeerDevDependencies // {})) | to_entries | sort_by(.key) | from_entries))' > package-temp.json && mv package-temp.json package.json", - "prebump": "cat package.json | jq '(((.localPeerDependencies // {}) | keys | map([\"dependencies\", .])) + ((.localPeerDevDependencies // {}) | keys | map([\"devDependencies\", .]))) as $localPeerPaths | delpaths($localPeerPaths)' > package-temp.json && mv package-temp.json package.json", - "precommit": "eslint --ext .js,.cjs,.mjs ./", + "bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .devDependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", + "bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .dependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", + "precommit": "eslint --ext .js,.cjs,.mjs,.ts,.cts,.mts ./", "test": "jest" }, "author": "William Wong (https://github.com/compulim)", diff --git a/packages/pages/package.json b/packages/pages/package.json index 4edf5a9..a679194 100644 --- a/packages/pages/package.json +++ b/packages/pages/package.json @@ -6,10 +6,8 @@ "build": "esbuild --bundle --entry-names=[name]/[ext]/main --minify --outdir=./public/static/ --sourcemap app=./src/app/index.tsx", "bump": "npm run bump:prod && npm run bump:dev && npm run bump:auditfix", "bump:auditfix": "npm audit fix || exit 0", - "bump:dev": "if [ `cat package.json | jq -r '(.devDependencies // {}) | length'` -ne 0 ]; then npm install $(cat package.json | jq -r '(.pinDependencies // {}) as $p | ((.devDependencies // {}) | keys) | map(. + \"@\" + ($p[.] // [\"latest\"])[0]) | .[]'); fi", - "bump:prod": "if [ `cat package.json | jq -r '(.dependencies // {}) | length'` -ne 0 ]; then npm install $(cat package.json | jq -r '(.pinDependencies // {}) as $p | ((.dependencies // {}) | keys) | map(. + \"@\" + ($p[.] // [\"latest\"])[0]) | .[]'); fi", - "postbump": "cat package.json | jq '. + (.dependencies = (((.dependencies // {}) + (.localPeerDependencies // {})) | to_entries | sort_by(.key) | from_entries)) | (.devDependencies = (((.devDependencies // {}) + (.localPeerDevDependencies // {})) | to_entries | sort_by(.key) | from_entries))' > package-temp.json && mv package-temp.json package.json", - "prebump": "cat package.json | jq '(((.localPeerDependencies // {}) | keys | map([\"dependencies\", .])) + ((.localPeerDevDependencies // {}) | keys | map([\"devDependencies\", .]))) as $localPeerPaths | delpaths($localPeerPaths)' > package-temp.json && mv package-temp.json package.json", + "bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .devDependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", + "bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .dependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", "precommit": "npm run precommit:typescript", "precommit:typescript": "tsc --project ./src/tsconfig.json", "reinstall": "rm -r node_modules package-lock.json && npm install", diff --git a/packages/react-chain-of-responsibility/jest.config.json b/packages/react-chain-of-responsibility/jest.config.json index b599729..9b78821 100644 --- a/packages/react-chain-of-responsibility/jest.config.json +++ b/packages/react-chain-of-responsibility/jest.config.json @@ -1,5 +1,5 @@ { - "testPathIgnorePatterns": ["/lib/", "/node_modules/", "/__types__/", "\\.pnp\\.[^\\/]+$"], + "testPathIgnorePatterns": ["/__tests__/__setup__/", "/lib/", "/node_modules/", "/__types__/", "\\.pnp\\.[^\\/]+$"], "transform": { "\\.[jt]sx?$": [ "babel-jest", diff --git a/packages/react-chain-of-responsibility/package.json b/packages/react-chain-of-responsibility/package.json index efe9637..bb1fbd1 100644 --- a/packages/react-chain-of-responsibility/package.json +++ b/packages/react-chain-of-responsibility/package.json @@ -50,11 +50,9 @@ "bump:babel": "npm run bump:babel:commonjs && npm run bump:babel:esmodules", "bump:babel:commonjs": "cat babel.commonjs.config.json | jq --arg CORE_JS_VERSION `[ -f node_modules/@babel/runtime-corejs3/package.json ] && cat node_modules/@babel/runtime-corejs3/package.json | jq -r .version || cat ../../node_modules/@babel/runtime-corejs3/package.json | jq -r .version` '(.plugins[] | select(.[0] == \"@babel/plugin-transform-runtime\"))[1].version = $CORE_JS_VERSION' | prettier --parser json > babel.commonjs.config.json.tmp && mv babel.commonjs.config.json.tmp babel.commonjs.config.json", "bump:babel:esmodules": "cat babel.esmodules.config.json | jq --arg CORE_JS_VERSION `[ -f node_modules/@babel/runtime-corejs3/package.json ] && cat node_modules/@babel/runtime-corejs3/package.json | jq -r .version || cat ../../node_modules/@babel/runtime-corejs3/package.json | jq -r .version` '(.plugins[] | select(.[0] == \"@babel/plugin-transform-runtime\"))[1].version = $CORE_JS_VERSION' | prettier --parser json > babel.esmodules.config.json.tmp && mv babel.esmodules.config.json.tmp babel.esmodules.config.json", - "bump:dev": "if [ `cat package.json | jq -r '(.devDependencies // {}) | length'` -ne 0 ]; then npm install $(cat package.json | jq -r '(.pinDependencies // {}) as $p | ((.devDependencies // {}) | keys) | map(. + \"@\" + ($p[.] // [\"latest\"])[0]) | .[]'); fi", - "bump:prod": "if [ `cat package.json | jq -r '(.dependencies // {}) | length'` -ne 0 ]; then npm install $(cat package.json | jq -r '(.pinDependencies // {}) as $p | ((.dependencies // {}) | keys) | map(. + \"@\" + ($p[.] // [\"latest\"])[0]) | .[]'); fi", - "postbump": "cat package.json | jq '. + (.dependencies = (((.dependencies // {}) + (.localPeerDependencies // {})) | to_entries | sort_by(.key) | from_entries)) | (.devDependencies = (((.devDependencies // {}) + (.localPeerDevDependencies // {})) | to_entries | sort_by(.key) | from_entries))' > package-temp.json && mv package-temp.json package.json", + "bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .devDependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", + "bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '.localPeerDependencies // {} as $L | .dependencies // {} | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@latest\") | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true", "postscaffold": "npm run bump:babel", - "prebump": "cat package.json | jq '(((.localPeerDependencies // {}) | keys | map([\"dependencies\", .])) + ((.localPeerDevDependencies // {}) | keys | map([\"devDependencies\", .]))) as $localPeerPaths | delpaths($localPeerPaths)' > package-temp.json && mv package-temp.json package.json", "precommit": "npm run precommit:eslint && npm run precommit:typescript:production && npm run precommit:typescript:test", "precommit:eslint": "eslint ./src/", "precommit:typescript:production": "tsc --noEmit --project ./src/tsconfig.precommit.production.json",