Git Product home page Git Product logo

Comments (14)

MicheleBertoli avatar MicheleBertoli commented on May 22, 2024 4

Thank you very much @good-idea @edorivai to discuss about this.

I was thinking about separating the packages, like:

import { Action, State, withStateMachine } from 'react-automata'

and:

import { testStateMachine } from 'react-automata-test-utilities'

What do you think?

Also, if someone has experience creating a monorepo with Learn and Yarn Workspaces is more than welcome to submit a PR : )

Than you very much!

from react-automata.

san650 avatar san650 commented on May 22, 2024 3

I'll start working on it!

from react-automata.

ctrlplusb avatar ctrlplusb commented on May 22, 2024 2

Howdy all 👋

I've made great progress on the Lerna Monorepo migration.

Check it out at #83

from react-automata.

edorivai avatar edorivai commented on May 22, 2024 1

I dove into this a little bit more. Looking through the source code here, I would guess the idea is that react-test-renderer will get removed by tree shaking. However, at least in my setup, it is not:

image

Note that I am not importing testStateMachine in my production code.

We're running a setup with Typescript, Babel, and Webpack. I can see in my bundle stats that the react-automata.es.js file is imported, but the test renderer does not get tree-shaken away.

So my question: what is the recommended way to use react-automata, but prevent react-test-renderer from being included in my bundle.

Personally, I always appreciate it if there is a way to manually selectively import parts of a library, like so:

import { State } from 'react-automata/State';

from react-automata.

good-idea avatar good-idea commented on May 22, 2024 1

@edorivai I'm digging through my projects but can't find the config file where I implemented this, sorry! I'll try to set it up with a repo sometime this week

from react-automata.

good-idea avatar good-idea commented on May 22, 2024

My apologies! I didn't do enough searching and just saw that you can do this manually with babel-plugin-transform-import

from react-automata.

edorivai avatar edorivai commented on May 22, 2024

@good-idea Could you elaborate on your setup? Did you manage to produce a production bundle without react-test-renderer, but with react-automata?

from react-automata.

edorivai avatar edorivai commented on May 22, 2024

That solution sounds good to me. Any particular reason you won't just expose it like this:

import { testUtility } from 'react-automata/testUtility';

from react-automata.

MicheleBertoli avatar MicheleBertoli commented on May 22, 2024

@edorivai separate packages would allow us to define different dependencies.

Thank you very much, @good-idea, that would be awesome.

from react-automata.

good-idea avatar good-idea commented on May 22, 2024

Hey all, sorry, I gave this a shot and wasn't able to get it working - it requires that the bundled NPM package has a structure like lib/moduleName.

I'm not sure where or how I had this working. (Maybe I actually didn't?) This was also back in february, when React-automata was at an earlier version.

from react-automata.

MicheleBertoli avatar MicheleBertoli commented on May 22, 2024

@good-idea I see, thanks for checking. That was possible (not recommended) before we moved to flat bundles in #38.

from react-automata.

san650 avatar san650 commented on May 22, 2024

+1 to have separate projects for testing helpers. Having react-test-rendered pulled in into production builds is a blocker for us.

Can I help making this happen? I could try updating this repo to be a monorepo for both libraries.

from react-automata.

MicheleBertoli avatar MicheleBertoli commented on May 22, 2024

Yes, please @san650.
Ping me anytime if you need support, and I'll be more than happy to review a PR.
Thank you very much!

from react-automata.

Gioni06 avatar Gioni06 commented on May 22, 2024

Hey @san650 .. any updates on this ?

from react-automata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.