Skip to content

Commit

Permalink
internal: Make resolutions cleaner for possible pnp usage (#3330)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker authored Dec 28, 2024
1 parent 19d4669 commit 1112651
Show file tree
Hide file tree
Showing 32 changed files with 253 additions and 124 deletions.
17 changes: 12 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ jobs:
command: |
if [ "<< parameters.react-version >>" == "^17.0.0" ]; then
yarn up react@<< parameters.react-version >> react-dom@<< parameters.react-version >> react-test-renderer@<< parameters.react-version >> @react-navigation/native@^6.0.0 @react-navigation/native-stack@^6.0.0 react-native-screens@^3.0.0 @testing-library/react@^12.0.0
yarn add --dev @testing-library/react-hooks
yarn workspace @data-client/test add --dev @testing-library/react-hooks
elif [ "<< parameters.react-version >>" == "^18" ]; then
yarn up react@<< parameters.react-version >> react-dom@<< parameters.react-version >> react-test-renderer@<< parameters.react-version >>
yarn workspace @data-client/test add --dev @testing-library/react-hooks
fi
- run:
name: Running Jest
Expand All @@ -127,7 +128,7 @@ jobs:
./codecov < ./lcov.info || true;
fi
else
yarn test:ci --maxWorkers=4 --selectProjects Node ReactDOM --testPathPattern packages/react packages/use-enhanced-reducer packages/img
yarn test:ci --maxWorkers=4 --selectProjects ReactDOM --testPathPattern packages/react packages/use-enhanced-reducer packages/img
fi
node_matrix:
Expand All @@ -143,10 +144,16 @@ jobs:
- run:
command: |
node --version
- run:
name: Install testing packages compatible with Node
command: |
yarn workspace @data-client/react add --dev @testing-library/react-hooks
yarn workspace @data-client/test add --dev @testing-library/react-hooks
yarn up react@18 react-dom@18 react-test-renderer@18
- run:
# we must use npm because yarn 4 isn't compatible with legacy node versions
command: |
ANANSI_JEST_TYPECHECK=false npm test --ci --maxWorkers=2 --selectProjects Node
ANANSI_JEST_TYPECHECK=false yarn test --ci --maxWorkers=2 --selectProjects Node
setup-esmodule-types:
executor: node
Expand Down Expand Up @@ -224,7 +231,7 @@ jobs:
- run:
command: |
cd examples/todo-app
npm run build:browser -- --env readable
yarn run build:browser --env readable
- run:
command: |
cd examples/normalizr-relationships
Expand All @@ -244,7 +251,7 @@ workflows:
- node_matrix:
matrix:
parameters:
node-version: ["14.21", "16.19", "18.18", "20.12.2"]
node-version: ["18.18", "20.12.2"]
requires:
- setup
- lint:
Expand Down
2 changes: 1 addition & 1 deletion examples/coin-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@types/react": "*",
"@types/react-dom": "*",
"react-refresh": "*",
"typescript": "5.7",
"typescript": "5.7.2",
"webpack": "*",
"webpack-cli": "*"
},
Expand Down
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,21 @@ const projects = [
displayName: 'ReactNative',
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.native\\.(j|t)sx?$',
testEnvironment:
'<rootDir>/node_modules/react-native/jest/react-native-env.js',
require.resolve('react-native/jest/react-native-env.js'),
transformIgnorePatterns: [
'node_modules\\/(?!(((jest-)?react-native)|@react-native(-community)?|react-navigation))', //from RN preset
'<rootDir>/.*__tests__/[^/]+\\.(web|node)\\.(j|t)sx?$',
'<rootDir>/scripts',
],
setupFiles: [
'<rootDir>/node_modules/react-native/jest/setup.js', //from RN preset
require.resolve('react-native/jest/setup.js'), //from RN preset
'<rootDir>/scripts/testSetupNative.js',
],
transform: {
//'^.+\\.js$': '<rootDir>/node_modules/react-native/jest/preprocessor.js', //setup.js needs to be transformed, but preprocessor screws everything else up
...baseConfig.transform,
'^.+\\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$':
'<rootDir>/node_modules/react-native/jest/assetFileTransformer.js', //from RN preset
require.resolve('react-native/jest/assetFileTransformer.js'), //from RN preset
},
haste: {
//from RN preset
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"examples/benchmark",
"examples/normalizr-*",
"examples/coin-app",
"website"
"website",
"scripts/rollup-plugins"
],
"scripts": {
"changeset:version": "run changeset version && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install",
Expand All @@ -24,7 +25,7 @@
"ci:build:esmodule": "yarn workspaces foreach -WptivR --from @data-client/react --from @data-client/rest --from @data-client/graphql run build:lib && yarn workspace @data-client/normalizr run build:js:node && yarn workspace @data-client/endpoint run build:js:node",
"build:copy:ambient": "mkdirp ./packages/endpoint/lib && copyfiles --flat ./packages/endpoint/src/schema.d.ts ./packages/endpoint/lib/ && copyfiles --flat ./packages/endpoint/src/endpoint.d.ts ./packages/endpoint/lib/ && mkdirp ./packages/rest/lib && copyfiles --flat ./packages/rest/src/RestEndpoint.d.ts ./packages/rest/lib && copyfiles --flat ./packages/rest/src/next/RestEndpoint.d.ts ./packages/rest/lib/next && mkdirp ./packages/react/lib && copyfiles --flat ./packages/react/src/server/redux/redux.d.ts ./packages/react/lib/server/redux",
"copy:websitetypes": "./scripts/copywebsitetypes.sh",
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest",
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules run jest",
"test:ci": "ANANSI_JEST_TYPECHECK=false yarn test --ci",
"test:coverage": "ANANSI_JEST_TYPECHECK=false yarn test --coverage",
"prepare": "yarn build:copy:ambient && tsc --build",
Expand Down Expand Up @@ -110,7 +111,7 @@
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^7.0.2",
"ts-node": "10.9.2",
"typescript": "5.7",
"typescript": "5.7.2",
"whatwg-fetch": "3.0.0"
},
"resolutions": {
Expand Down
5 changes: 4 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
},
"devDependencies": {
"@anansi/browserslist-config": "^1.4.2",
"@types/node": "^22.0.0"
"@data-client/endpoint": "workspace:*",
"@types/jest": "^29.5.14",
"@types/node": "^22.0.0",
"rollup-plugins": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
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 { babel, commonjs, filesize, json, resolve, replace, terser, typeConfig, typeConfigNext } from 'rollup-plugins';

import pkg from './package.json' with { type: 'json' };

import pkg from './package.json';
import { typeConfig, typeConfigNext } from '../../scripts/rollup-utils';

const dependencies = Object.keys(pkg.dependencies)
//.concat(Object.keys(pkg.peerDependencies))
Expand Down
8 changes: 7 additions & 1 deletion packages/endpoint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@
},
"devDependencies": {
"@anansi/browserslist-config": "^1.4.2",
"@data-client/core": "workspace:*",
"@data-client/normalizr": "workspace:*",
"@js-temporal/polyfill": "^0.4.4",
"@types/node": "^22.0.0"
"@types/jest": "^29.5.14",
"@types/node": "^22.0.0",
"immutable": "4.2.2",
"nock": "13.3.1",
"rollup-plugins": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import dts from 'rollup-plugin-dts';
import filesize from 'rollup-plugin-filesize';
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 { babel, dts, commonjs, filesize, json, resolve, replace, terser } from 'rollup-plugins';

import pkg from './package.json';
import pkg from './package.json' with { type: 'json' };

const dependencies = Object.keys(pkg.dependencies).filter(
dep => !['@babel/runtime'].includes(dep),
Expand Down
5 changes: 4 additions & 1 deletion packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
},
"devDependencies": {
"@anansi/browserslist-config": "^1.4.2",
"@types/node": "^22.0.0"
"@types/jest": "^29.5.14",
"@types/node": "^22.0.0",
"nock": "13.3.1",
"rollup-plugins": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
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 { babel, commonjs, filesize, json, resolve, replace, terser, typeConfig, typeConfigNext } from 'rollup-plugins';

import pkg from './package.json';
import { typeConfig } from '../../scripts/rollup-utils';
import pkg from './package.json' with { type: 'json' };

const dependencies = Object.keys(pkg.dependencies).filter(
dep => !['@babel/runtime'].includes(dep),
Expand Down
5 changes: 4 additions & 1 deletion packages/img/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@
"devDependencies": {
"@anansi/browserslist-config": "^1.4.2",
"@data-client/react": "workspace:*",
"@testing-library/react": "^16.1.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.0.0",
"@types/react": "19.0.2",
"react": "19.0.0"
"react": "^19.0.0",
"rollup-plugins": "workspace:*"
}
}
10 changes: 2 additions & 8 deletions packages/img/rollup.config.js → packages/img/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
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 { babel, commonjs, filesize, json, resolve, replace, terser } from 'rollup-plugins';

import pkg from './package.json';
import pkg from './package.json' with { type: 'json' };

const dependencies = Object.keys(pkg.dependencies)
.concat(Object.keys(pkg.peerDependencies))
Expand Down
6 changes: 5 additions & 1 deletion packages/normalizr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@
},
"devDependencies": {
"@anansi/browserslist-config": "^1.4.2",
"@data-client/endpoint": "workspace:*",
"@js-temporal/polyfill": "^0.4.4",
"@types/jest": "^29.5.14",
"@types/node": "^22.0.0",
"immutable": "4.2.2"
"immutable": "4.2.2",
"rollup-plugins": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import dts from 'rollup-plugin-dts';
import filesize from 'rollup-plugin-filesize';
import resolve from 'rollup-plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import { babel, commonjs, filesize, dts, resolve, terser } from 'rollup-plugins';

const name = 'normalizr';

Expand Down
19 changes: 18 additions & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,29 @@
},
"devDependencies": {
"@anansi/browserslist-config": "^1.4.2",
"@data-client/rest": "workspace:*",
"@data-client/test": "workspace:*",
"@jest/globals": "^29.7.0",
"@js-temporal/polyfill": "^0.4.4",
"@react-navigation/native": "^7.0.0",
"@react-navigation/native-stack": "^7.2.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.1.0",
"@testing-library/react-native": "^12.9.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.0.0",
"@types/qs": "^6",
"@types/react": "19.0.2",
"@types/react-dom": "*",
"jest-mock": "^29.7.0",
"nock": "13.3.1",
"qs": "^6.13.1",
"react": "19.0.0",
"react-native": "^0.76.0"
"react-dom": "^19.0.0",
"react-native": "0.76.5",
"react-native-safe-area-context": "^5.0.0",
"react-native-screens": "^4.1.0",
"react-test-renderer": "^19.0.0",
"rollup-plugins": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import babel from 'rollup-plugin-babel';
import banner from 'rollup-plugin-banner2';
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
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 { babel, banner, commonjs, filesize, json, resolve, replace, terser, typeConfig, typeConfigNext } from 'rollup-plugins';

import pkg from './package.json';
import { typeConfig, typeConfigNext } from '../../scripts/rollup-utils';
import pkg from './package.json' with { type: 'json' };

const dependencies = Object.keys(pkg.dependencies)
.concat(Object.keys(pkg.peerDependencies))
Expand Down
7 changes: 6 additions & 1 deletion packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@
},
"devDependencies": {
"@anansi/browserslist-config": "^1.4.2",
"@types/node": "^22.0.0"
"@data-client/react": "workspace:*",
"@data-client/test": "workspace:*",
"@types/jest": "^29.5.14",
"@types/node": "^22.0.0",
"nock": "13.3.1",
"rollup-plugins": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
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 { babel, commonjs, filesize, json, resolve, replace, terser, typeConfig, typeConfigNext } from 'rollup-plugins';

import pkg from './package.json';
import { typeConfig, typeConfigNext } from '../../scripts/rollup-utils';
import pkg from './package.json' with { type: 'json' };

const dependencies = Object.keys(pkg.dependencies).filter(
dep => !['@babel/runtime'].includes(dep),
Expand Down
3 changes: 2 additions & 1 deletion packages/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"next": "^15.0.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"redux": "^5.0.0"
"redux": "^5.0.0",
"rollup-plugins": "workspace:*"
}
}
11 changes: 2 additions & 9 deletions packages/ssr/rollup.config.js → packages/ssr/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import babel from 'rollup-plugin-babel';
import banner from 'rollup-plugin-banner2';
import commonjs from 'rollup-plugin-commonjs';
import filesize from 'rollup-plugin-filesize';
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 { babel, banner, commonjs, filesize, json, resolve, replace, terser } from 'rollup-plugins';

import pkg from './package.json';
import pkg from './package.json' with { type: 'json' };

const dependencies = Object.keys(pkg.dependencies)
.concat(Object.keys(pkg.peerDependencies))
Expand Down
5 changes: 4 additions & 1 deletion packages/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@
"@types/react-test-renderer": "19.0.0",
"jest": "^29.5.0",
"react": "19.0.0",
"react-dom": "19.0.0"
"react-dom": "19.0.0",
"react-native": "*",
"react-test-renderer": "*",
"rollup-plugins": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import babel from 'rollup-plugin-babel';
import banner from 'rollup-plugin-banner2';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import {babel, banner, commonjs, resolve} from 'rollup-plugins';

import pkg from './package.json';
import pkg from './package.json' with { type: 'json' };

const dependencies = Object.keys(pkg.dependencies)
.concat(Object.keys(pkg.peerDependencies))
Expand Down
5 changes: 4 additions & 1 deletion packages/use-enhanced-reducer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@
},
"devDependencies": {
"@anansi/browserslist-config": "^1.4.2",
"@types/jest": "^29.5.14",
"@types/node": "^22.0.0",
"@types/react": "19.0.2"
"@types/react": "19.0.2",
"react": "^19.0.0",
"rollup-plugins": "workspace:*"
}
}
Loading

0 comments on commit 1112651

Please sign in to comment.