Skip to content
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

Release v6.0.0 Roadmap #542

Closed
4 of 5 tasks
ST-DDT opened this issue Feb 22, 2022 · 17 comments
Closed
4 of 5 tasks

Release v6.0.0 Roadmap #542

ST-DDT opened this issue Feb 22, 2022 · 17 comments
Labels
c: feature Request for new feature

Comments

@ST-DDT
Copy link
Member

ST-DDT commented Feb 22, 2022

This is our planned roadmap to v6.0.0.

Feel free to suggest changes or report important bugs/incompatibilities.

  1. Fix remaining todos
  1. ✅ Release v6.0.0-beta.1/rc.1 (Early March)
  2. ✅ Migrate some well known libraries to fakerjs (to test compatibility)
  3. ✅ Wait a week or two for feedback
  4. ✅ Release v6.0.0 (~Mid March)
  5. ✅ Freeze for potential v6.0.x bug fixes (1 week)
  6. ✅ Close v6.0.x release window and start development of v6.1.0. (Late March)
@ST-DDT ST-DDT added the c: feature Request for new feature label Feb 22, 2022
@ST-DDT ST-DDT pinned this issue Feb 22, 2022
@ST-DDT
Copy link
Member Author

ST-DDT commented Mar 7, 2022

Beta has been released: https://github.com/faker-js/faker/releases/tag/v6.0.0-beta.0

@ST-DDT
Copy link
Member Author

ST-DDT commented Mar 7, 2022

@connorjs
Copy link

I saw y'all released v6.0.0 - just wanted to say A W E S O M E and THANK YOU to everyone involved in all of this 🤩

@HonzaMac
Copy link
Contributor

V6 stable works great in our repository, we just need little adjustments.
Thanks 🎉

@ST-DDT
Copy link
Member Author

ST-DDT commented Mar 16, 2022

V6 stable works great in our repository, we just need little adjustments.

What kind of adjustments? Did some types/methods change from 5.5.3 to v6.0.0?

@HonzaMac
Copy link
Contributor

@ST-DDT
1] We have to change this code:

      const pastYearDate = Faker.date.past(1);
      const pastTwoYearsDate = Faker.date.past(2, pastYearDate);

into this:

      const pastYearDate = Faker.date.past(1);
      const pastTwoYearsDate = Faker.date.past(2, pastYearDate.toISOString());

2] We have to remove memory optimisation for loading just two locales on boot instead of all.

import fakerStatic from 'faker';
import FakerLib from 'faker/lib';

const AVAILABLE_LOCALES = ['cz', 'de', 'en', 'es', 'fr', 'ja', 'ko', 'ru', 'sk', 'uk', 'vi'];

export const Faker = ((): FakerType => {
  const faker: FakerType = new FakerLib({locale: 'en', localeFallback: 'en'});

  const rndLocale = faker.random.arrayElement(AVAILABLE_LOCALES);
  faker.locales[rndLocale] = require(`faker/lib/locales/${rndLocale}`);
  faker.locales.en = require('faker/lib/locales/en');
  faker.locale = rndLocale;

  faker.seed(seed);

  return faker;
})();

This saved not small number of MB in memory of our CI, which led to faster builds.
We use Jest, so every test file import whole Faker and all locales.

@Shinigami92
Copy link
Member

@HonzaMac

  1. We have a fix for that planned here: fix: accept dates as params for Date methods #200
  2. You should use import { faker as fakerStatic } from '@faker-js/faker';, import FakerLib from 'faker/lib' should not be available at all, so I assume you just want to load require(@faker-js/faker/locales/${locale}) and then merge every into one new faker instance constructed manually.

So something like this (not tested):

import { Faker } from '@faker-js/faker';

new Faker({
  locale: 'rndLocale',
  localeFallback: 'en',
  locales: [
    ...require(`@faker-js/faker/locale/${rndLocale}`).locales
  ]
})

This could be a workaround for now, but we plan to change stuff in later major versions. But for the next versions we want to concentrate on bug fixes and small features.

@ST-DDT
Copy link
Member Author

ST-DDT commented Mar 16, 2022

2. and then merge every into one new faker instance

Why merge it? AFAICT these instances are exactly what they need/re-create.
require(`@faker-js/faker/locale/${rndLocale}`)

Maybe we should export the locales (definitions) as well.
@HonzaMac What do you think?

2. import FakerLib from 'faker/lib' should not be available at all,

This is the old import from 553 for comparison.

@Shinigami92
Copy link
Member

Shinigami92 commented Mar 16, 2022

Maybe we should export the locales (definitions) as well.

Yeah yeah, we should, but that means we need to change stuff in our bundling process, and that's something I would like to tackle in v7+
Don't we have an issue to track this? If not, we could open one to track it.


Why merge it?

Oh, I thought because they wanted to change the locale dynamically at runtime instead of everytime call the factory and creating a fully new instance 🤔

@joequincy
Copy link

  1. import FakerLib from 'faker/lib' should not be available at all,

This is the old import from 553 for comparison.

Yeah, it's surprising to not see this called out in the changelog. All the places we're using this library use the
const faker = require('@faker-js/faker') form from 5.5.3, so seeing everything break with no breaking changes noted in the changelog was unexpected.

@Shinigami92
Copy link
Member

@joequincy If you mean you should use const { faker } = require('@faker-js/faker'); instead of const faker = require('@faker-js/faker');, then yes. Both should work currently, but we highly recommend to use the { faker } syntax, cause we want to move away from the default export in a future major.
Also yes, we tried to be as compatible as possible to 5.5.3 but we didn't know each and every single use case and how folks uses it. Now we see some of these special cases (we had alphas for 2 month now... 🤷)
I would like to focus on minor bug fixes (v6.1), small features (v6.2) and then do stuff like rebuilding the bundling process and remove deprecations (v7.0).
We planned this already like a month ago, so I hope it's okay if we currently rely on our roadmap and do as planned.

But if really someone to early tackle such thinks and make sure that it works for cjs and esm, feel free. I just currently want to focus my time as planned.

@joequincy
Copy link

Both should work currently

This does not appear to be the case.
Under 5.5.3, I could do

const faker = require('@faker-js/faker')
faker.datatype.boolean() // true or false

Under 6.0.0, this throws an Undefined TypeError, and I am required to use

const { faker } = require('@faker-js/faker')

image

@Shinigami92
Copy link
Member

@joequincy I really don't understand why, because we exported it as normal and as default

faker/src/index.ts

Lines 33 to 37 in c5df7ee

export const faker: Faker = new Faker({
locales: allLocales,
});
export default faker;

The only thing I could think of would be that esbuild mess up with something 🤷
I can promise you, using the new syntax { faker } will be the long time supported one.
I hope we can move to v7 fast...

@joequincy
Copy link

Yeah, I've updated our imports already and it's an otherwise seamless version bump. I do think either this should be called out in the release notes as a breaking change or the build process should be tweaked so that requires continue to work as before for the 6.x line, but I don't have a strong preference which direction to go there. It was just a jarring breakage.

@Shinigami92
Copy link
Member

We do have the migration guide: https://fakerjs.dev/migration-guide-v5/#tree-shaking
Hopefully this is at least a bit helpful

@ST-DDT
Copy link
Member Author

ST-DDT commented Mar 21, 2022

No critical issues with the release have been reported.
We will now proceed with merging PRs for v6.1 - First Bugfixes.

@ST-DDT ST-DDT closed this as completed Mar 21, 2022
@Shinigami92 Shinigami92 unpinned this issue Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature
Projects
None yet
Development

No branches or pull requests

5 participants