Giter Club home page Giter Club logo

Comments (4)

julienw avatar julienw commented on May 14, 2024 1

I don't think if that's enough, in the current epoch of webpack, a lot of devs indifferently put the dependencies in either dictionary.

Maybe the check for "hasFlow" shouldn't be in upgradeDeps but rather in index after the 2 calls, with something like this:

if (options.hasFlow &&
    !pkg.dependencies['@babel/preset-flow'] &&
    !pkg.devDependencies['@babel/preset-flow']) {
  pkg.devDependencies['@babel/preset-flow'] = getLatestVersion();
}

from babel-upgrade.

nicolo-ribaudo avatar nicolo-ribaudo commented on May 14, 2024

We should add some logic to decide which field should be upgraded at

if (pkg.devDependencies) {
pkg.devDependencies = sortKeys(upgradeDeps(
pkg.devDependencies,
getLatestVersion(),
options,
));
}
if (pkg.dependencies) {
pkg.dependencies = sortKeys(upgradeDeps(
pkg.dependencies,
getLatestVersion(),
options,
));
}

from babel-upgrade.

julienw avatar julienw commented on May 14, 2024

Looks like the issue is there:

// Adds preset-flow if needed, especially since it was split out of
// preset-react
if (options.hasFlow && !dependencies['@babel/preset-flow']) {
dependencies['@babel/preset-flow'] = version;
}

If hasFlow is true, the dependency will be added in both dictionaries.

from babel-upgrade.

aulisius avatar aulisius commented on May 14, 2024

We could add a new key to the options object to detect if we're modifying devDependencies or not.

from babel-upgrade.

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.