Skip to content

Commit

Permalink
fix: try prepending "v" to the checkout tag when installing a bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Van Camp committed Jun 20, 2023
1 parent 0df1631 commit 58daa03
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,28 @@ function action(repo: string, options: { dev: boolean }) {
if (target) {
process.stdout.write(`Checking out version ${target}... `);
try {
// First try the target as-is.
execSync(`git checkout ${target}`, {
cwd: bundlePath,
stdio: ['pipe', 'pipe', 'pipe'],
});
process.stdout.write(chalk.green('done!') + os.EOL);
} catch (e) {
/* istanbul ignore next */
process.stdout.write(chalk.red('failed!') + os.EOL);
/* istanbul ignore next */
console.error(e.stack);
/* istanbul ignore next */
return;
} catch (_e) {
try {
// Next try prepending `v` to the target, which may have been stripped by `semver.coerce`.
execSync(`git checkout v${target}`, {
cwd: bundlePath,
stdio: ['pipe', 'pipe', 'pipe'],
});
process.stdout.write(chalk.green('done!') + os.EOL);
} catch (e) {
/* istanbul ignore next */
process.stdout.write(chalk.red('failed!') + os.EOL);
/* istanbul ignore next */
console.error(e.stack);
/* istanbul ignore next */
return;
}
}
}

Expand Down

0 comments on commit 58daa03

Please sign in to comment.