Giter Club home page Giter Club logo

Comments (6)

esatterwhite avatar esatterwhite commented on June 24, 2024 1

I think think this is a bit less maintainable. the new method appears to require you to fix a version with the dependency. In most cases I don't want to specify a version and jsut let the most recent version be installed.

I'm also having a bit of trouble actually getting it to update package.json. In the debug logs, I can see something resolving packages from npm, but the package dependencies are never added

from generator.

mshima avatar mshima commented on June 24, 2024

See https://github.com/yeoman/generator/releases/tag/v5.0.0.
I will keep open, so if the new approach is not enough, we can revert and include install mixin by default.

from generator.

esatterwhite avatar esatterwhite commented on June 24, 2024

What was the reasoning for deprecating this behavior?

from generator.

mshima avatar mshima commented on June 24, 2024

What was the reasoning for deprecating this behavior?

@esatterwhite see #1067 (comment).
npmInstall should work for simple generators (easy to load the deprecated mixin too).
But it's not friendly when composing with multiples generators.

  • package manager conflicts (each generator executes it's preferred package manager).
  • multiples install executions when generating (each generator trigger it's own install).
  • not integrated with package.json changes (the install/end priority may have an outdated package.json in memory, since install was executed directly in the disk).

I think think this is a bit less maintainable. the new method appears to require you to fix a version with the dependency. In most cases I don't want to specify a version and jsut let the most recent version be installed.

Should be fixed, when the version is empty, it should add latest version to package.json.
I should address this problem soon, but feel free to open an issue for it.

I'm also having a bit of trouble actually getting it to update package.json. In the debug logs, I can see something resolving packages from npm, but the package dependencies are never added

If so, it's a bug, please open a new issue detailing the behavior.

from generator.

esatterwhite avatar esatterwhite commented on June 24, 2024

It doesn't look like the new methods have a way to specify a working directory and its always updating the package.json in the process cwd.

I maybe missing something too, is there away to modify package.json in a different directory?

from generator.

mshima avatar mshima commented on June 24, 2024

It updates package.json relative to the generator destinationPath().

  1. Api could be improved by passing a storage instead of always using this.packageJson storage.
this.addDependencies({foo: ''}, this.createStorage('packages/my-project/package.json');
  1. Taking a mono-repo as examples.
    The correct approach is to have a generator for the mono-repo called workspaces.
    And another generator for the workspace (project).
    Each project generator should be composed by passing destinationRoot.
    Eg: from workspaces generator:
    composeWith('workspace', {destinationRoot: this.destinationPath('packages/my-project'});
    So package.json will be relative to 'packages/my-project'.
    Detail: composeWith forwards the current destinationRoot to it's child by default, so it's chained.

from generator.

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.