Skip to content

Commit c458704

Browse files
committed
📦 Use forked class-validator package
**Problem** They are inheritance issues in `class-validator` (see issue: typestack/class-validator#633). We updated a PR to fix this problem: typestack/class-validator#2641. However, the chances of it ever being merged are low, as the repository no longer appears to be actively maintained. **Proposal** Use the patched package and import it via an "ugly" github link. This should push us toward eventually migrating to another validation library such as Zod.
1 parent 658983c commit c458704

File tree

4 files changed

+89
-7
lines changed

4 files changed

+89
-7
lines changed

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,70 @@ $ docker compose run --rm init-core
283283
> This `init-core-fca-low` container is a dependency of the `core-fca-low` container.
284284
> It will run the migration script every time the `core-fca-low` container is started.
285285
> No need to do it manually when using the `dks switch`
286+
287+
288+
## Generate a new version of class-validator-0.14.2
289+
290+
We forked the class-validator package because we needed inhertiance features and is not yet merged [into the main branch](https://github.com/typestack/class-validator/pull/2641).
291+
292+
To update the package, follow these steps.
293+
294+
Get and update the project:
295+
```bash
296+
git clone git@github.com:proconnect-gouv/class-validator.git
297+
```
298+
299+
Update the version attribute of `class-validator/package.json`:
300+
```json
301+
{
302+
"name": "class-validator",
303+
"version": "0.14.2-proconnect.1",
304+
"...": "..."
305+
}
306+
```
307+
308+
Build the new package:
309+
```bash
310+
rm -rf build
311+
npm ci --ignore-scripts
312+
npm run prettier:check
313+
npm run lint:check
314+
npm run test:ci
315+
npm run build:es2015
316+
npm run build:esm5
317+
npm run build:cjs
318+
npm run build:umd
319+
npm run build:types
320+
cp LICENSE build/LICENSE
321+
cp README.md build/README.md
322+
jq 'del(.devDependencies) | del(.scripts)' package.json > build/package.json
323+
npm pack ./build
324+
```
325+
326+
Then push the built package in a dedicated branch:
327+
```bash
328+
git checkout -b build-0.14.2-proconnect.1
329+
find . -mindepth 1 -maxdepth 1 \
330+
! -name '.git' \
331+
! -name '.idea' \
332+
! -name '.gitignore' \
333+
! -name 'build' \
334+
-exec rm -rf {} +
335+
mv build/* .
336+
rmdir build
337+
git add .
338+
git commit -m "Build version 0.14.2-proconnect.1"
339+
git push
340+
```
341+
342+
Update `federation/back/package.json`:
343+
344+
```json
345+
{
346+
"dependencies": {
347+
"class-validator": "git+https://github.com/proconnect-gouv/class-validator.git#build-0.14.2-proconnect.1",
348+
}
349+
}
350+
```
351+
352+
Run yarn install.
845 KB
Binary file not shown.

back/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"axios": "^1.12.0",
5050
"body-parser": "^2.2.0",
5151
"class-transformer": "^0.5.1",
52-
"class-validator": "^0.14.2",
52+
"class-validator": "git+https://github.com/proconnect-gouv/class-validator.git#build-0.14.2-proconnect.1",
5353
"cookie-parser": "^1.4.7",
5454
"deep-freeze": "^0.0.1",
5555
"ejs": "^3.1.10",

back/yarn.lock

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,10 +2426,9 @@ class-transformer@^0.5.1:
24262426
resolved "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz"
24272427
integrity sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw==
24282428

2429-
class-validator@^0.14.2:
2430-
version "0.14.2"
2431-
resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.14.2.tgz#a3de95edd26b703e89c151a2023d3c115030340d"
2432-
integrity sha512-3kMVRF2io8N8pY1IFIXlho9r8IPUUIfHe2hYVtiebvAzU2XeQFXTv+XI4WX+TnXmtwXMDcjngcpkiPM0O9PvLw==
2429+
"class-validator@git+https://github.com/proconnect-gouv/class-validator.git#build-0.14.2-proconnect.1":
2430+
version "0.14.2-proconnect.1"
2431+
resolved "git+https://github.com/proconnect-gouv/class-validator.git#2c1e9983782a509917df586298333f55982fcaf0"
24332432
dependencies:
24342433
"@types/validator" "^13.11.8"
24352434
libphonenumber-js "^1.11.1"
@@ -6685,7 +6684,14 @@ string_decoder@^1.1.1:
66856684
dependencies:
66866685
safe-buffer "~5.2.0"
66876686

6688-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
6687+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
6688+
version "6.0.1"
6689+
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
6690+
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
6691+
dependencies:
6692+
ansi-regex "^5.0.1"
6693+
6694+
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
66896695
version "6.0.1"
66906696
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
66916697
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -7329,7 +7335,7 @@ word-wrap@^1.2.5:
73297335
resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz"
73307336
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==
73317337

7332-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
7338+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
73337339
version "7.0.0"
73347340
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
73357341
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -7347,6 +7353,15 @@ wrap-ansi@^6.2.0:
73477353
string-width "^4.1.0"
73487354
strip-ansi "^6.0.0"
73497355

7356+
wrap-ansi@^7.0.0:
7357+
version "7.0.0"
7358+
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
7359+
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
7360+
dependencies:
7361+
ansi-styles "^4.0.0"
7362+
string-width "^4.1.0"
7363+
strip-ansi "^6.0.0"
7364+
73507365
wrap-ansi@^8.1.0:
73517366
version "8.1.0"
73527367
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz"

0 commit comments

Comments
 (0)