Skip to content

Commit c33dd81

Browse files
committed
internal: Use yarn pnp
1 parent a06cf20 commit c33dd81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1209
-300
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@data-client/react': patch
3+
---
4+
5+
Fix pnp compatibility by import change

.circleci/config.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ jobs:
3939
npm pkg set 'workspaces[]'='examples/normalizr-relationships'
4040
- restore_cache:
4141
keys:
42-
- v14-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}-{{ checksum "examples/todo-app/package.json" }}
42+
- v15-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}-{{ checksum "examples/todo-app/package.json" }}
4343
# fallback to using the latest cache if no exact match is found
44-
- v14-dependencies-
44+
- v15-dependencies-
4545
- run:
4646
name: yarn install
4747
command: |
@@ -50,7 +50,7 @@ jobs:
5050
paths:
5151
- .yarn/cache
5252
- .yarn/install-state.gz
53-
key: v14-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}-{{ checksum "examples/todo-app/package.json" }}
53+
key: v15-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}-{{ checksum "examples/todo-app/package.json" }}
5454
- run: yarn run ci:build:types
5555
- run: yarn run ci:build-test-lib
5656
- persist_to_workspace:
@@ -62,10 +62,11 @@ jobs:
6262
- project/examples/todo-app
6363
- project/examples/github-app
6464
- project/examples/normalizr-relationships
65-
- project/node_modules
6665
- project/packages
6766
- project/scripts
6867
- project/.yarnrc.yml
68+
- project/.pnp.cjs
69+
- project/.pnp.loader.mjs
6970
- project/babel.config.js
7071
- project/eslint.config.mjs
7172
- project/jest.config.js
@@ -109,7 +110,8 @@ jobs:
109110
command: |
110111
if [ "<< parameters.react-version >>" == "^17.0.0" ]; then
111112
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
112-
yarn add --dev @testing-library/react-hooks
113+
yarn workspace @data-client/react add --dev @testing-library/react-hooks
114+
yarn workspace @data-client/test add --dev @testing-library/react-hooks
113115
elif [ "<< parameters.react-version >>" == "^18" ]; then
114116
yarn up react@<< parameters.react-version >> react-dom@<< parameters.react-version >> react-test-renderer@<< parameters.react-version >>
115117
fi
@@ -128,7 +130,7 @@ jobs:
128130
./codecov < ./lcov.info || true;
129131
fi
130132
else
131-
yarn test:ci --maxWorkers=4 --selectProjects Node ReactDOM --testPathPattern packages/react packages/use-enhanced-reducer packages/img
133+
yarn test:ci --maxWorkers=4 --selectProjects ReactDOM --testPathPattern packages/react packages/use-enhanced-reducer packages/img
132134
fi
133135
134136
node_matrix:
@@ -144,10 +146,16 @@ jobs:
144146
- run:
145147
command: |
146148
node --version
149+
- run:
150+
name: Install testing packages compatible with Node
151+
command: |
152+
yarn workspace @data-client/react add --dev @testing-library/react-hooks
153+
yarn workspace @data-client/test add --dev @testing-library/react-hooks
154+
yarn up react@18 react-dom@18 react-test-renderer@18
147155
- run:
148156
# we must use npm because yarn 4 isn't compatible with legacy node versions
149157
command: |
150-
ANANSI_JEST_TYPECHECK=false npm test --ci --maxWorkers=2 --selectProjects Node
158+
ANANSI_JEST_TYPECHECK=false yarn test --ci --maxWorkers=2 --selectProjects Node
151159
152160
setup-esmodule-types:
153161
executor: node
@@ -225,7 +233,7 @@ jobs:
225233
- run:
226234
command: |
227235
cd examples/todo-app
228-
npm run build:browser -- --env readable
236+
yarn run build:browser --env readable
229237
- run:
230238
command: |
231239
cd examples/normalizr-relationships
@@ -245,7 +253,7 @@ workflows:
245253
- node_matrix:
246254
matrix:
247255
parameters:
248-
node-version: ["14.21", "16.19", "18.18", "20.12.2"]
256+
node-version: ["18.18", "20.12.2"]
249257
requires:
250258
- setup
251259
- lint:

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"recommendations": [
33
"dbaeumer.vscode-eslint",
4-
"esbenp.prettier-vscode"
4+
"esbenp.prettier-vscode",
5+
"arcanis.vscode-zipfs"
56
]
67
}

.vscode/settings.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"eslint.nodePath": "node_modules",
2+
"eslint.nodePath": ".yarn/sdks",
33
"typescript.format.enable": true,
44
"typescript.validate.enable": true,
55
"[javascript]": {
@@ -18,7 +18,7 @@
1818
"typescriptreact"
1919
],
2020
"eslint.format.enable": true,
21-
"typescript.tsdk": "node_modules/typescript/lib",
21+
"typescript.tsdk": ".yarn/sdks/typescript/lib",
2222
"editor.defaultFormatter": "esbenp.prettier-vscode",
2323
"editor.codeActionsOnSave": {
2424
"source.fixAll.eslint": "explicit"
@@ -52,11 +52,15 @@
5252
"**/versioned_docs": true,
5353
"**/*_versioned_docs": true,
5454
"**/v8.log": true,
55-
"website/src/components/Playground/editor-types": true
55+
"website/src/components/Playground/editor-types": true,
56+
"**/.yarn": true,
57+
"**/.pnp.*": true
5658
},
5759
"files.readonlyExclude": {
5860
"**/.next": true,
5961
"**/v8.log": true,
6062
"website/src/components/Playground/editor-types": true
6163
},
64+
"prettier.prettierPath": ".yarn/sdks/prettier/index.cjs",
65+
"typescript.enablePromptUseWorkspaceTsdk": true
6266
}

.yarn/sdks/eslint/bin/eslint.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, register} = require(`module`);
5+
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
7+
8+
const relPnpApiPath = "../../../../.pnp.cjs";
9+
10+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
12+
const absRequire = createRequire(absPnpApiPath);
13+
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require eslint/bin/eslint.js
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
31+
// Defer to the real eslint/bin/eslint.js your application uses
32+
module.exports = wrapWithUserWrapper(absRequire(`eslint/bin/eslint.js`));

.yarn/sdks/eslint/package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "eslint",
3+
"version": "9.17.0-sdk",
4+
"main": "./lib/api.js",
5+
"type": "commonjs",
6+
"bin": {
7+
"eslint": "./bin/eslint.js"
8+
},
9+
"exports": {
10+
".": {
11+
"types": "./lib/types/index.d.ts",
12+
"default": "./lib/api.js"
13+
},
14+
"./package.json": "./package.json",
15+
"./use-at-your-own-risk": {
16+
"types": "./lib/types/use-at-your-own-risk.d.ts",
17+
"default": "./lib/unsupported-api.js"
18+
},
19+
"./rules": {
20+
"types": "./lib/types/rules/index.d.ts"
21+
},
22+
"./universal": {
23+
"types": "./lib/types/universal.d.ts",
24+
"default": "./lib/universal.js"
25+
}
26+
}
27+
}

.yarn/sdks/integrations.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is automatically generated by @yarnpkg/sdks.
2+
# Manual changes might be lost!
3+
4+
integrations:
5+
- vscode
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, register} = require(`module`);
5+
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
7+
8+
const relPnpApiPath = "../../../../.pnp.cjs";
9+
10+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
12+
const absRequire = createRequire(absPnpApiPath);
13+
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require prettier/bin/prettier.cjs
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
31+
// Defer to the real prettier/bin/prettier.cjs your application uses
32+
module.exports = wrapWithUserWrapper(absRequire(`prettier/bin/prettier.cjs`));

.yarn/sdks/prettier/index.cjs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, register} = require(`module`);
5+
const {resolve} = require(`path`);
6+
const {pathToFileURL} = require(`url`);
7+
8+
const relPnpApiPath = "../../../.pnp.cjs";
9+
10+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
11+
const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`);
12+
const absRequire = createRequire(absPnpApiPath);
13+
14+
const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`);
15+
const isPnpLoaderEnabled = existsSync(absPnpLoaderPath);
16+
17+
if (existsSync(absPnpApiPath)) {
18+
if (!process.versions.pnp) {
19+
// Setup the environment to be able to require prettier
20+
require(absPnpApiPath).setup();
21+
if (isPnpLoaderEnabled && register) {
22+
register(pathToFileURL(absPnpLoaderPath));
23+
}
24+
}
25+
}
26+
27+
const wrapWithUserWrapper = existsSync(absUserWrapperPath)
28+
? exports => absRequire(absUserWrapperPath)(exports)
29+
: exports => exports;
30+
31+
// Defer to the real prettier your application uses
32+
module.exports = wrapWithUserWrapper(absRequire(`prettier`));

.yarn/sdks/prettier/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "prettier",
3+
"version": "3.4.2-sdk",
4+
"main": "./index.cjs",
5+
"type": "commonjs",
6+
"bin": "./bin/prettier.cjs"
7+
}

0 commit comments

Comments
 (0)