Giter Club home page Giter Club logo

Comments (8)

ntucker avatar ntucker commented on September 25, 2024 1

@terenceodonoghue btw: one mistake I had was not awaiting these methods as they now return promises, which is why the conflict resolver was triggered.

This is still a problem for running yo on existing filesystems, but for completely new projects properly awaiting their return values should avoid this issue.

from generator.

terenceodonoghue avatar terenceodonoghue commented on September 25, 2024

Running into this with yeoman-generator@^5.3.0. Can confirm that the trailing comma seems to be triggering the conflict resolver.

Screen Shot 2021-06-03 at 8 23 04 pm

from generator.

terenceodonoghue avatar terenceodonoghue commented on September 25, 2024

@ntucker that fixed it, thanks! I replaced:

writing() {
  this.addDependencies([...])
}

with:

async writing() {
  await this.addDependencies([...])
}

Off-topic, but it's now failing for another reason: addDependencies and addDevDependencies attempt to resolve all packages against the public npm registry and ignores those I've defined in my .npmrc, thus the generator fails with a 404 error.

from generator.

mshima avatar mshima commented on September 25, 2024

Closing, since it's resolved. The private repo problem is unrelated and should be discussed in the other issue.

from generator.

ntucker avatar ntucker commented on September 25, 2024

@mshima "This is still a problem for running yo on existing filesystems, but for completely new projects properly awaiting their return values should avoid this issue."

This conflict issue will appear if you have an existing package.json - which is often the case when you're using yo to add pieces to an existing project instead of just create a new one. (I assume this is the point of making yorc files)

from generator.

mshima avatar mshima commented on September 25, 2024

If you want to force package.json to be written, you can do something like #1239.
Or write a .yo-resolve file with

package.json force

from generator.

ntucker avatar ntucker commented on September 25, 2024

Why is there a merging policy if the expectation is to only write to existing files if it's completely forced?

from generator.

mshima avatar mshima commented on September 25, 2024

What are you spectating here?
To merge? To don’t generate at all? To use existing values?

The default is to merge, which is the better default for composing.
If you want to keep old values as default, you should load them.

this.addDependencies({
  …dependencies,
  …this.packageJson.getAll().dependencies
})

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.