-
-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modifying pushArgs via plugin #988
Comments
There's two options I can think of:
|
Thanks for the help, @webpro! Unfortunately I can't get option 2 to work (after adding the export to Option 1, however, solved the problem nicely! Unfortunately there's a GitLab bug now that prevents that solution from working, but that's another story... :) One thing I did encounter, however, is |
You're most welcome, I like to see how people are using release-it in unexpected ways :)
That's unfortunate and weird, the internal classes do the some thing afaic.
Cool, happy that part of the issue is sorted then.
No I was not really aware of this. Are you saying that there is no way to use |
Sorry for the late reply.
I tried this with the following environment:
And the following contents: module.exports = {
npm: {
publish: false,
},
git: {
requireCleanWorkingDir: false,
},
}; or also export default {
npm: {
publish: false,
},
git: {
requireCleanWorkingDir: false,
},
};
Not using Does this help? |
Thanks for all the details. Just a quick idea for now, did you try this already? Using
Edit: afraid this probably does nothing else than using |
I ran into this same situation; it would be nice if plugins could set options on the main options object For my use case, I want to override the git plugin options from my plugin.
|
Inside a plugin you have access to this.config.setContext({ git: {commitMessage: 'my updated message' } }) This could only work in the constructor. The external plugins are instantiated before the internal ones. |
I tried that, but the git plugin pulls it from the options. |
Oops, I didn't actually try it. Also tbh it didn't really sit right with me in the first place (change config of one plugin from another plugin). |
Yeah, my plan was to only change the git plugin's defaults if there was no change at all from the default in the config. This would ensure no breaking. What do you think of changing the tagName: tag({ name, annotation = this.options.tagAnnotation, args = this.options.tagArgs } = {}) {
const message = format(annotation, this.config.getContext());
const tagName = name || this.config.getContext('tagName'); commitMessage (currently) commit({ message = this.options.commitMessage, args = this.options.commitArgs } = {}) {
const msg = format(message, this.config.getContext());
const commitMessageArgs = msg ? ['--message', msg] : []; |
Any thoughts? |
@webpro I've stumbled into this issue as well when building a bit more eloquent monorepo configuration. And I'd say exporting "native" release-it plugins (like Git, npm, etc) would be already a huge life-saver. I saw that you've already proposed this here and I've confirmed - To overcome this issue in most of my libraries I'm adding this line - it's far from perfect, but allows accessing any js file in the repository 😄 Ofc, just writing explicit exports would work too |
Feel free to open pull request(s), I'm happy to look into them. |
Thanks for this fantastic tool!
Depending on the release, we'd like to set push arguments to set CI/CD variables to toggle certain deployment steps. Whether a certain deployment step is active, is up to whoever creates that release.
To achieve this, I wrote a simple plugin which looks as follows:
Configuration in
package.json
is:git.pushArgs
is modified usingthis.config.setContext
which works. However, when the actualgit push
is executed inlib/plugin/git/Git.js
inpush()
, the options are passed as a default argument usingargs = this.options.pushArgs
.args
contains the push arguments as defined when initializing the plugin and defaults to[ '--follow-tags' ]
and does not contain the changes made usingconfig.setContext()
which would look like this:To fix this, I see two options:
push()
resolvesargs
usingconfig.getContext
Can you please help me resolve this?
The text was updated successfully, but these errors were encountered: