Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions packages/api/src/cli/commands/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ cmd
'ts',
])
)
.action(async (uri: string, options: { lang: string }) => {
.addOption(new Option('-y, --yes', 'Automatically answer "yes" to any prompts printed'))
.action(async (uri: string, options: { lang: string; yes?: boolean }) => {
let language: SupportedLanguages;
if (options.lang) {
language = options.lang as SupportedLanguages;
Expand Down Expand Up @@ -155,18 +156,20 @@ cmd
logger(` ${figures.pointerSmall} ${pkg}: ${pkgInfo.reason} ${pkgInfo.url}`);
});

await promptTerminal({
type: 'confirm',
name: 'value',
message: 'OK to proceed with package installation?',
initial: true,
}).then(({ value }) => {
if (!value) {
// @todo cleanup installed files
logger('Installation cancelled.', true);
process.exit(1);
}
});
if (!options.yes) {
await promptTerminal({
type: 'confirm',
name: 'value',
message: 'OK to proceed with package installation?',
initial: true,
}).then(({ value }) => {
if (!value) {
// @todo cleanup installed files
logger('Installation cancelled.', true);
process.exit(1);
}
});
}

spinner = ora('Installing required packages').start();
try {
Expand Down