Skip to content

Commit

Permalink
Fixed bug where not selecting any platform would freeze installation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugos68 committed Sep 27, 2023
1 parent 2292fe7 commit 321b66e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-apes-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'capkit': patch
---

Fixed bug where selecting no platforms would make the installation freeze (ty Liam)
8 changes: 4 additions & 4 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function promptOptions() {

const allPlatforms = ['Android', 'iOS'];

let platforms: Platform[] | null = null;
let platforms: Platform[] = [];
if (shouldPromptPlatforms) {
platforms = (await multiselect({
message: 'What platforms do you want to add?',
Expand Down Expand Up @@ -112,7 +112,7 @@ async function promptOptions() {
message: 'Do you want to add additional plugins?'
});

let plugins: Plugin[] | null = null;
let plugins: Plugin[] = [];
if (shouldPromptPlugins) {
plugins = (await multiselect({
message: 'What plugins do you want to add?',
Expand Down Expand Up @@ -195,7 +195,7 @@ export async function initializeProject({ appName, appId, platforms, plugins }:
task: async () => await asyncExec(`${packageManager} install @capacitor/cli @capacitor/core`)
});

if (platforms) {
if (platforms.length > 0) {
jobs.push({
start: 'Adding additional platforms',
stop: 'Successfully added additional platforms',
Expand All @@ -209,7 +209,7 @@ export async function initializeProject({ appName, appId, platforms, plugins }:
});
}

if (plugins) {
if (plugins.length > 0) {
jobs.push({
start: 'Adding additional plugins',
stop: 'Successfully added additional plugins',
Expand Down

0 comments on commit 321b66e

Please sign in to comment.