fixes #423
This commit is contained in:
parent
66a41f19ab
commit
2a6d2e6cea
1 changed files with 16 additions and 9 deletions
|
@ -99,11 +99,17 @@ export interface IPublishOptions {
|
|||
ignoreFile?: string;
|
||||
}
|
||||
|
||||
function versionBump(cwd: string = process.cwd(), version?: string, commitMessage?: string): Promise<void> {
|
||||
async function versionBump(cwd: string = process.cwd(), version?: string, commitMessage?: string): Promise<void> {
|
||||
if (!version) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
const manifest = await readManifest(cwd);
|
||||
|
||||
if (manifest.version === version) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (version) {
|
||||
case 'major':
|
||||
case 'minor':
|
||||
|
@ -127,14 +133,15 @@ function versionBump(cwd: string = process.cwd(), version?: string, commitMessag
|
|||
command = `${command} -m "${commitMessage}"`;
|
||||
}
|
||||
|
||||
// call `npm version` to do our dirty work
|
||||
return exec(command, { cwd })
|
||||
.then(({ stdout, stderr }) => {
|
||||
process.stdout.write(stdout);
|
||||
process.stderr.write(stderr);
|
||||
return Promise.resolve(null);
|
||||
})
|
||||
.catch(err => Promise.reject(err.message));
|
||||
try {
|
||||
// call `npm version` to do our dirty work
|
||||
const { stdout, stderr } = await exec(command, { cwd });
|
||||
process.stdout.write(stdout);
|
||||
process.stderr.write(stderr);
|
||||
return null;
|
||||
} catch (err) {
|
||||
throw err.message;
|
||||
}
|
||||
}
|
||||
|
||||
export function publish(options: IPublishOptions = {}): Promise<any> {
|
||||
|
|
Loading…
Add table
Reference in a new issue