Coder Social home page Coder Social logo

Comments (12)

pvdlg avatar pvdlg commented on May 24, 2024 1

The code explicitly load the angular preset only if neither writerOpts and parserOpts are defined:

} else if (!parserOpts || !writerOpts) {

I don't remember why exactly but I guess there must have been a reason for that. I'll dig in the commit history to try to figure out.

from release-notes-generator.

pvdlg avatar pvdlg commented on May 24, 2024

writerOpts: Additional conventional-commits-writer options that will extends ones loaded by preset or config. See Writer options means that option you set in writerOpts will be added to the one from the preset you use.
If you don't use a preset it just uses whatever you pass in writerOpts.

from release-notes-generator.

jormot avatar jormot commented on May 24, 2024

Isn't the preset default to angular? If what you say is true, then passing an empty writerOpts should have the same effect than passing no writerOpts at all, which is not the case.

from release-notes-generator.

pvdlg avatar pvdlg commented on May 24, 2024

Yes the preset defaults to angular but only if you don't pass writerOpts or parserOpts.

from release-notes-generator.

jormot avatar jormot commented on May 24, 2024
  • So if I pass a preset, writerOpts will extend the config stored at the preset. So I can pass a preset and an empty writerOpts, this will work.
  • If I don't pass a preset, writerOpts will be set as the config, so if I pass an empty writerOpts the config will have an empty value, which will not work correctly.
  • If I don't pass a preset or writerOpts, the preset will be set to angular.

Is this correct?

from release-notes-generator.

pvdlg avatar pvdlg commented on May 24, 2024

Yes. But in any case there is absolutely no reason to pass an empty writerOpts. I don't understand why you are trying to do that.

from release-notes-generator.

pvdlg avatar pvdlg commented on May 24, 2024

I'm closing as it doesn't seems you are reporting a bug. Feel free to comment further if you think there is actually a bug.

from release-notes-generator.

jormot avatar jormot commented on May 24, 2024

If I understood correctly, an empty writerOpts would be the same than passing a single parameter. In the example on the README:

{
  "release": {
    "generateNotes": {
      "preset": "angular",
      "writerOpts": {
        "commitsSort": ["subject", "scope"],
      }
    }
  }
}

This works since you are explicitly passing preset: angular, but if I don't pass preset (assuming the preset will default to angular), this will not work as desired.

I believe the documentation may be more specific about that case. Since it says that the default value for preset is angular, and writerOpts extends the preset or config, one can easily assume that when passing no preset, it will default to angular and writerOpts will extend from that, but that's not the case.

This is either a bug in the documentation or a bug on the behavior.

from release-notes-generator.

jormot avatar jormot commented on May 24, 2024

Maybe you can add something like this in the note.

-**NOTE:** `options.config` will be overwritten by the values of preset. You should use either `preset` or `config`, but not both. Individual properties of `parserOpts` and `writerOpts` will overwrite ones loaded with `preset` or `config`.
+**NOTE:** `options.config` will be overwritten by the values of preset. You should use either `preset` or `config`, but not both. Individual properties of `parserOpts` and `writerOpts` will overwrite ones loaded with `preset` or `config`, only if `preset` is provided, otherwise it will not extend but set the values at config.

from release-notes-generator.

jormot avatar jormot commented on May 24, 2024

Hey @pvdlg, can you explain what changed? I can see in the PR #91 that you clarify the current behavior, but on line 23 you change the behavior.

If parserOpts or writerOpts are not defined, it will use Angular preset, and then it will be merged.

from release-notes-generator.

pvdlg avatar pvdlg commented on May 24, 2024

The behavior didn't change, it's just a refactoring of the code to make it more clear.
The condition on line 23 was useless as it's repeated on lines 35-36

The intention behind this behavior is:

  • If you want to customize a preset, set the preset and use parserOpts/ writerOpts to override
  • If you want to specify your own config then use config

from release-notes-generator.

semantic-release-bot avatar semantic-release-bot commented on May 24, 2024

🎉 This issue has been resolved in version 6.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from release-notes-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.