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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use yarn publish for Yarn #220

Merged
merged 3 commits into from Feb 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 30 additions & 7 deletions index.js
Expand Up @@ -103,15 +103,38 @@ module.exports = (input, opts) => {
]);

if (runPublish) {
tasks.add({
title: 'Publishing package',
skip: () => {
if (pkg.private) {
return 'Private package: not publishing to npm.';
tasks.add([
{
title: 'Publishing package using Yarn',
enabled: () => opts.yarn === true,
skip: () => {
if (pkg.private) {
return 'Private package: not publishing to Yarn.';
}
},
task: () => {
const args = ['publish', '--new-version', input];

if (opts.tag) {
args.push('--tag', opts.tag);
}

return exec('yarn', args).catch(err => {
throw new Error(err);
});
Copy link
Owner

Choose a reason for hiding this comment

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

Just noticed this. Why do you catch the error, rewrap it in an error, and throw it again?

}
},
task: (ctx, task) => publish(task, opts.tag)
});
{
title: 'Publishing package using npm',
enabled: () => opts.yarn === false,
skip: () => {
if (pkg.private) {
return 'Private package: not publishing to npm.';
}
},
task: (ctx, task) => publish(task, opts.tag)
}
]);
}

tasks.add({
Expand Down