Skip to content

Commit 1801b0a

Browse files
committed
build(package-manager): migrate from yarn 1.22.22 to pnpm 10.11.0
1 parent d09886d commit 1801b0a

File tree

8 files changed

+5463
-4218
lines changed

8 files changed

+5463
-4218
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,30 @@ jobs:
88
ci:
99
name: Continuous integration
1010
runs-on: ubuntu-latest
11+
1112
steps:
1213
- name: Checkout
1314
uses: actions/checkout@v4
15+
16+
- name: Setup pnpm
17+
uses: pnpm/action-setup@v4
18+
with:
19+
run_install: false
20+
1421
- name: Setup Node
1522
uses: actions/setup-node@v4
1623
with:
17-
node-version: 'current'
24+
node-version: 22
25+
cache: "pnpm"
26+
1827
- name: Install dependencies
19-
run: yarn install
20-
- name: Check build
21-
run: yarn build
22-
- name: Check coding standards
23-
run: yarn lint
28+
run: pnpm install --frozen-lockfile
29+
30+
- name: Build
31+
run: pnpm build
32+
33+
- name: Lint
34+
run: pnpm lint
35+
2436
- name: Run tests
25-
run: yarn test
37+
run: pnpm test

.github/workflows/release.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch: ~
55
push:
66
tags:
7-
- 'v*'
7+
- "v*"
88

99
jobs:
1010
release:
@@ -13,20 +13,31 @@ jobs:
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v4
16+
17+
- name: Setup pnpm
18+
uses: pnpm/action-setup@v4
19+
with:
20+
run_install: false
21+
1622
- name: Setup Node
1723
uses: actions/setup-node@v4
1824
with:
19-
node-version: 'current'
20-
registry-url: https://registry.npmjs.org
25+
node-version: 22
26+
cache: "pnpm"
27+
2128
- name: Install dependencies
22-
run: yarn install
23-
- name: Check build
24-
run: yarn build
25-
- name: Check coding standards
26-
run: yarn lint
29+
run: pnpm install --frozen-lockfile
30+
31+
- name: Build
32+
run: pnpm build
33+
34+
- name: Lint
35+
run: pnpm lint
36+
2737
- name: Run tests
28-
run: yarn test
38+
run: pnpm test
39+
2940
- name: Publish to npm
30-
run: npm publish
41+
run: pnpm publish
3142
env:
3243
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/lib/
22
/node_modules/
3-
/yarn-error.log

README.md

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,57 +20,74 @@ Using [NPM](https://www.npmjs.com/):
2020

2121
npm install @api-platform/api-doc-parser
2222

23+
Using [Pnpm](https://pnpm.io/):
24+
25+
pnpm add @api-platform/api-doc-parser
26+
2327
If you plan to use the library with Node, you also need a polyfill for the `fetch` function:
2428

2529
yarn add isomorphic-fetch
2630

2731
## Usage
2832

2933
**Hydra**
34+
3035
```javascript
31-
import { parseHydraDocumentation } from '@api-platform/api-doc-parser';
36+
import { parseHydraDocumentation } from "@api-platform/api-doc-parser";
3237

33-
parseHydraDocumentation('https://demo.api-platform.com').then(({api}) => console.log(api));
38+
parseHydraDocumentation("https://demo.api-platform.com").then(({ api }) =>
39+
console.log(api),
40+
);
3441
```
3542

3643
**OpenAPI v2 (formerly known as Swagger)**
44+
3745
```javascript
38-
import { parseSwaggerDocumentation } from '@api-platform/api-doc-parser';
46+
import { parseSwaggerDocumentation } from "@api-platform/api-doc-parser";
3947

40-
parseSwaggerDocumentation('https://demo.api-platform.com/docs.json').then(({api}) => console.log(api));
48+
parseSwaggerDocumentation("https://demo.api-platform.com/docs.json").then(
49+
({ api }) => console.log(api),
50+
);
4151
```
4252

4353
**OpenAPI v3**
54+
4455
```javascript
45-
import { parseOpenApi3Documentation } from '@api-platform/api-doc-parser';
56+
import { parseOpenApi3Documentation } from "@api-platform/api-doc-parser";
4657

47-
parseOpenApi3Documentation('https://demo.api-platform.com/docs.json?spec_version=3').then(({api}) => console.log(api));
58+
parseOpenApi3Documentation(
59+
"https://demo.api-platform.com/docs.json?spec_version=3",
60+
).then(({ api }) => console.log(api));
4861
```
4962

5063
**GraphQL**
64+
5165
```javascript
52-
import { parseGraphQl } from '@api-platform/api-doc-parser';
66+
import { parseGraphQl } from "@api-platform/api-doc-parser";
5367

54-
parseGraphQl('https://demo.api-platform.com/graphql').then(({api}) => console.log(api));
68+
parseGraphQl("https://demo.api-platform.com/graphql").then(({ api }) =>
69+
console.log(api),
70+
);
5571
```
5672

5773
## OpenAPI Support
5874

5975
In order to support OpenAPI, the library makes some assumptions about how the documentation relates to a corresponding ressource:
76+
6077
- The path to get (`GET`) or edit (`PUT`) one resource looks like `/books/{id}` (regular expression used: `^[^{}]+/{[^{}]+}/?$`).
61-
Note that `books` may be a singular noun (`book`).
62-
If there is no path like this, the library skips the resource.
78+
Note that `books` may be a singular noun (`book`).
79+
If there is no path like this, the library skips the resource.
6380
- The corresponding path schema is retrieved for `get` either in the [`response` / `200` / `content` / `application/json`] path section or in the `components` section of the documentation.
64-
If retrieved from the `components` section, the component name needs to look like `Book` (singular noun).
65-
For `put`, the schema is only retrieved in the [`requestBody` / `content` / `application/json`] path section.
66-
If no schema is found, the resource is skipped.
81+
If retrieved from the `components` section, the component name needs to look like `Book` (singular noun).
82+
For `put`, the schema is only retrieved in the [`requestBody` / `content` / `application/json`] path section.
83+
If no schema is found, the resource is skipped.
6784
- If there are two schemas (one for `get` and one for `put`), resource fields are merged.
6885
- The library looks for a creation (`POST`) and list (`GET`) path. They need to look like `/books` (plural noun).
6986
- The deletion (`DELETE`) path needs to be inside the get / edit path.
7087
- In order to reference the resources between themselves (embeddeds or relations), the library guesses embeddeds or references from property names.
71-
For instance if a book schema has a `reviews` property, the library tries to find a `Review` resource.
72-
If there is, a relation or an embedded between `Book` and `Review` resources is made for the `reviews` field.
73-
The property name can also be like `review_id`, `reviewId`, `review_ids` or `reviewIds` for references.
88+
For instance if a book schema has a `reviews` property, the library tries to find a `Review` resource.
89+
If there is, a relation or an embedded between `Book` and `Review` resources is made for the `reviews` field.
90+
The property name can also be like `review_id`, `reviewId`, `review_ids` or `reviewIds` for references.
7491
- Parameters are only retrieved in the list path.
7592

7693
## Support for other formats (JSON:API...)
@@ -81,8 +98,8 @@ to include it in the library.
8198

8299
## Run tests
83100

84-
yarn test
85-
yarn lint
101+
pnpm test
102+
pnpm lint
86103

87104
## Credits
88105

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@eslint/compat": "^1.2.5",
2020
"@eslint/eslintrc": "^3.2.0",
2121
"@eslint/js": "^9.19.0",
22+
"@jest/types": "29.0.0",
2223
"@types/inflection": "^1.13.0",
2324
"@types/jest": "^29.0.0",
2425
"@types/jsonld": "^1.5.0",
@@ -51,7 +52,7 @@
5152
"scripts": {
5253
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
5354
"lint": "eslint src",
54-
"fix": "yarn lint --fix",
55+
"fix": "pnpm lint --fix",
5556
"eslint-check": "eslint-config-prettier src/index.ts",
5657
"build": "rm -rf lib/* && tsc",
5758
"watch": "tsc --watch"
@@ -60,5 +61,5 @@
6061
"publishConfig": {
6162
"access": "public"
6263
},
63-
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
64+
"packageManager": "[email protected]+sha512.6540583f41cc5f628eb3d9773ecee802f4f9ef9923cc45b69890fb47991d4b092964694ec3a4f738a420c918a333062c8b925d312f42e4f0c263eb603551f977"
6465
}

0 commit comments

Comments
 (0)