Skip to content
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

Add configurable publishCommand #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NullVoxPopuli
Copy link
Contributor

In response to feedback on #110

try {
await this.exec(
`npm publish ./${workspaceInfo.relativeRoot} --tag ${tag}${accessArg}${otpArg}${dryRunArg}`,
`${publishCommand} ./${workspaceInfo.relativeRoot} --tag ${tag}${accessArg}${otpArg}${dryRunArg}`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still assumes a bunch of details about the command. For example, it assumes --otp, --tag, --access, and --dry-run are valid arguments to the configured publish command. I think it would probably be better to allow the customized command to include the various arguments internally instead.

I think we can use some built in functionality to release-it to easily support templating here.

It will require some additional tweaks here, but not too much AFAICT. This would become something like:

const context = {
  pathToWorkspace: workspaceInfo.relativeRoot,
  otp: otp.value,
  access,
  dryRun: this.config.isDryRun
};
let publishCommand = this.getContext().publishCommand;

if (isPNPM ) {
  // you'll need to implement the `isPNPM` conditional above, and also the default command for it; but maybe it's basically the same as the `npm publish` one but with `p` prefixed?
} else {
  publishCommand = 'npm publish <%= pathToWorkspace %> --tag <%= tag %> <%= access ? "--access " + access : "" %> <%= otp.value ? "--otp " + otp.value : "" %> <%= dryRun ? "--dry-run" : "" %>';
}

await this.exec(publishCommand, options, context);

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants