Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: upgrade to @faker-js/faker v9 #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2025

Conversation

bmulholland
Copy link
Contributor

@bmulholland bmulholland commented Jun 8, 2025

The upgrade was pretty much seamless, except the test suite, which hard-codes values in a way that ties them to the seed used.

I opted for a regex approach that would make the broken tests work before and after, and for future seeds. That may not be desirable, though. Let me know if you want me to just update the values to effectively be snapshots.

Closes #186


This release upgrades to Faker v9, which introduces several breaking changes:

  • Node.js v18+ required: Faker v9 requires Node.js v18 or higher
  • TypeScript v5+ required: Faker v9 requires TypeScript v5 or higher
  • Different mock values: Due to Faker v9's improved RNG (53-bit vs 32-bit), generated mock values will be different even with the same seed
  • Removed deprecated code: Faker v8 had deprecated many methods, which have now been removed

For more details, see the Faker v9 migration guide.

.gitattributes Outdated
@@ -0,0 +1,2 @@
**/*.snap linguist-generated=true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a QoL improvement for the snapshots; it's what tells Github to do below "Some generated files are not rendered by default."

More details here. Happy to undo this.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that could be interesting if we don't want to review snapshots but I find it useful sometimes to see them

Can you undo it please?

CHANGELOG.md Outdated
@@ -1,3 +1,24 @@
# v5.0.0 (Thu Jan 02 2025)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there's a breaking change, I updated the version to v5. Happy to change that though.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you update the changelog yourself?
It's auto generated by the PR merge, I would manage the versioning when I merge the PR

@ardeois ardeois self-assigned this Jun 11, 2025
@ardeois ardeois added the major Increment the major version when merged label Jun 11, 2025
Copy link
Owner

@ardeois ardeois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thank you for your contribution !
I've got few comments before we're able to merge

package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "graphql-codegen-typescript-mock-data",
"version": "4.4.0",
"version": "5.0.0",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback this, it will be handled by our versioning tool

CHANGELOG.md Outdated
Comment on lines 3 to 18
#### 💥 Breaking Change

- feat: upgrade to @faker-js/faker v9

This release upgrades to Faker v9, which introduces several breaking changes:

- **Node.js v18+ required**: Faker v9 requires Node.js v18 or higher
- **TypeScript v5+ required**: Faker v9 requires TypeScript v5 or higher
- **Different mock values**: Due to Faker v9's improved RNG (53-bit vs 32-bit), generated mock values will be different even with the same seed
- **Removed deprecated code**: Faker v8 had deprecated many methods, [which have now been removed](https://fakerjs.dev/guide/upgrading.html#removals-of-deprecated-code)

For more details, see the [Faker v9 migration guide](https://fakerjs.dev/guide/upgrading.html).

#### Authors: 1

- Brendan Mulholland ([@bmulholland](https://github.com/bmulholland))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback this, it will be handled by our versioning tool

However, could you move all this detail inside the PR description. I will reuse the PR description when merging in order to have this level of detail in the changelog

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know snapshots could be verbose but it's useful so see the difference of what's changed, so please remove the .gitattributes update
thanks !

@bmulholland
Copy link
Contributor Author

Rolled back as requested, and put details in PR description. Let me know if I missed anything?

BTW, looks like this project uses yarn, but there's missing files with both Yarn V1 Classic, and latest (Berry), both of which want to be checked into git :). It's fine, I'm just ignoring it, but I accidentally checked in e.g. .yarnrc.yml just now. More an FYI on ease of contributing that anything that's a big deal.

Copy link
Owner

@ardeois ardeois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good !

package.json Outdated
@@ -84,5 +88,6 @@
"dist/**/*",
"LICENSE",
"README.md"
]
],
"packageManager": "[email protected]+sha512.a333bf9c2557d71f5ba87dd1446cde24bb9c35301ec29dd2baba577b3f9d1ab61348b66a1324de9088c40a996c5b9203794da8bf14cab9fae6a6eccc00cb8078"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this, it makes the build crash

You're right that we're using yarn v1. We should probably switch to npm now, but that's a task for another day

Copy link
Contributor Author

@bmulholland bmulholland Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh man, I must have checked for this three times. Kept having to revert changes to yarn config and such, even in yarn v1 mode, and I guess I missed one in the end.

Removed :)

@ardeois ardeois merged commit 9fa72b1 into ardeois:main Jun 26, 2025
5 checks passed
@bmulholland bmulholland deleted the feat/faker-v9 branch June 27, 2025 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Increment the major version when merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to faker v9
2 participants