-
Notifications
You must be signed in to change notification settings - Fork 439
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
Make Faker.js a user-configured dependency #1037
Comments
See #1062 |
As a side point, could we look at making the faker an user configured add on. That would mean that there is no hard dependency to a faker version and people would have better control over its configuration. E.g. requiring specific locales for example. |
Yes, in retrospect perhaps it shouldn't be in |
As discussed at #1062, bumping the version on Faker gets a bit more complicated, as the source files we currently rely on are removed in the new version. Upgrading will require working through that now ... johno/ember-faker#15 might be worth referencing, though I haven't looked at it in detail ... |
Our options include:
Separately: even if we want this dependency to move out of |
I got faker to export the main file |
https://github.com/Marak/faker.js/pull/584 it's merged, we're waiting on a release now |
It's been released since then - ready for us to do the change we need on this side :) |
@caseywatts so we can bump now? Are there any breaking changes? |
I don't think a new version has been published since @caseywatts's PR (it's after the 4.1.0 release). Also looks like a new version isn't going to be published: https://github.com/Marak/faker.js/issues/621#issuecomment-376164148 |
suddenly getting a build error when using this Faker version: Build Error (Babel)
|
Going to get to this soon. reference: https://discuss.emberjs.com/t/best-practices-for-including-3rd-party-libraries-in-an-addon/15200/2 |
Recommend publishing a @mirage/faker fork |
I'd say just take it out entirely and update the docs to recommend that users install Faker (or an equivalent) separately. It would be totally fine to also publish a fork in parallel as @Gaurav0 suggests, but I I'd love Mirage just the same even if it didn't install Faker for me. |
Ya. Leaning towards taking it out since we have auto-import now, but it is nice having it in there. What would @mirage/faker fork look like? |
At least the current master, if not accepting some PRs that have been ignored. |
Hm... that seems like a big maintenance burden. At this point I think the options are
|
I would 😍 using faker at the app level rather than as a dependency of Mirage. I think Seems best with a few 👍 side-effects:
I don't think that we need to go straight to "Dropping Faker from Mirage entirely" unless it's as small as one reference. There's also a lot of |
Yea a codemod would be great for that. I'm thinking I think eaf's peerDependency workflow makes sense for ECLI-Tailwind & the |
I just started a codemod here: (not usable yet, just some skeleton-y code & some reference material I found useful) |
Amazing! I would love to button this up and include a reference to it as part of v1.0 (still a little bit away, but not too far). What do you think? |
I'd love to share this there, yes :) It's not working yet lol - but I don't mind if you point at it even while it's a work-in-progress, no problem. It could be a starting point for someone else to finish it if they have time sooner than I do. I'm trying to document it enough that someone could pick it up at least. |
This works now! :D https://github.com/caseywatts/ember-cli-mirage-faker-codemod It could use a couple more things, but they're optional:
|
Run the codemodThe codemod is all set!
FakerGetting Issues
Install faker and ember-auto-import
|
got it! ✨
Install faker and ember-auto-import
add to
|
@caseywatts, thank you very much for all the work you put in this topic. I think that it would be good to provide a small tutorial/guide/tip on how to remove |
@AndreJoaquim good idea! I think your idea is to help people remove faker from the ember-cli-mirage build itself - especially for people who have no plans to use faker at all, even directly from npm. Could you make a new issue about that so it gets tracked better? :) |
I just updated the instructions from this thread into the README over here: |
Can someone provide instructions on how to import without
|
After chatting with @rwjblue, I think what I'm going to do here (as well as for the To do this we can copy ember-jquery's code here. This will replace the pretender and faker import lines here. This also lets us do this in a forwards-compatible way, which I didn't think we'd be able to do. All that's left is to add documentation on how folks can go about specifying their own versions of faker and pretender, if & when they have the need. |
I actually might remove faker as a dep/peerDep at all, its not really a dep, and we can leverage Casey's wonderful codemod and provide instructions for how to install. I'll still use the above approach for Pretender. |
IMO that's the best solution. It would also make it much easier to use another library to generate random data for testing. I have never used it myself, but e.g. Chance looks promising. Please note that you already listed dropping faker as a to do for releasing v1.0.0 on August 2018 here #1363. |
@jelhan FWIW you could absolutely install Chance, import with Ember Auto Import, and use it in your Mirage factories today. No need to use Faker at all. |
Another issue is that the Faker included with Mirage seems to break source maps on Chrome when
Related: https://github.com/Marak/faker.js/issues/375 |
#1527 removes faker! I added upgrade notes to the AddonDocs site and will copy them over to the Release, once we cut 1.0. I tried this out on EmberMap's frontend but ran into issues with @caseywatts' codemod. I'm going to wait until we get that sorted out & working before releasing 1.0 (among a few other things). |
75c458d adds docs with codemod & closes. |
No description provided.
The text was updated successfully, but these errors were encountered: