Giter VIP home page Giter VIP logo

Comments (6)

jhnns avatar jhnns commented on May 27, 2024 1

Fix shipped as breaking change with 1.0.0

from dynamic-config.

meaku avatar meaku commented on May 27, 2024

Thanks @benurb for pointing out. The npm change has a lot of side effects nobody was thinking about in the first place :)

If var dynamicConfig = require("dynamic-config").createInstance(); works without breaking changes, then it's the way to go imho. Do you propose returning an instance (for backwards compatibility) with a createInstance() method to solve the current hazzle?

from dynamic-config.

benurb avatar benurb commented on May 27, 2024

Yes, it's basically a factory pattern.
Nevertheless I would prefer the breaking change. I cannot imagine a case where the current behavior is desired. It's totally unpredictable, because it depends on loading order. But of course the factory method would solve the problem, too. What's your opinion?

from dynamic-config.

jhnns avatar jhnns commented on May 27, 2024

I'm always surprised that the shift from npm2 to npm3 works so well for most projects, because imho many modules suffer from this issue.

In this particular case, I'm a little bit surprised that you have two modules which depend on dynamic-config. Shouldn't dynamic-config be a typical module that is only required by the actual application? Why is your dependency using dynamic-config?

Besides that I agree with @benurb. This should be a breaking change. Existing applications should be very easy to upgrade.

from dynamic-config.

benurb avatar benurb commented on May 27, 2024

Actually already npm2 is an issue here, because it dedupes after install.

My specific use case is that we have a project, which runs integration tests on our backend infrastructure. Therefore it lists all the services as dependencies and each of these services uses dynamic-config. Pre-npm2 each service would have a node_modules/serviceX/node_modules/dynamic-config module, but since npm2 they all share the same instance in node_modules/dynamic-config, because the "outer" module also has a dynamic-config dependency.

from dynamic-config.

jhnns avatar jhnns commented on May 27, 2024

In your particular case, the argv and env plugin don't really make sense because they assume a 1:1 relationship between dynamic-config instance and process (or otherwise equally named config keys will clash).

So imho in your situation it's more suitable to spin up multiple processes as it reflects the actual use-case better.

Your proposed change, however, is still reasonable because you might want to use dynamic-config for multiple configs. In this case, however, still the argv and env plugin don't really make sense.

from dynamic-config.

Related Issues (6)

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.