Skip to content

Commit

Permalink
fix(cli): halt update upon failure (#3595)
Browse files Browse the repository at this point in the history
  • Loading branch information
imhoffd authored Sep 24, 2020
1 parent 5133e2e commit ec086b0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
18 changes: 7 additions & 11 deletions cli/src/tasks/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,11 @@ export function updateChecks(config: Config, platforms: string[]): CheckFunction
}

export async function update(config: Config, platformName: string, deployment: boolean) {
try {
await runTask(chalk`{green {bold update}} {bold ${platformName}}`, async () => {
if (platformName === config.ios.name) {
await updateIOS(config, deployment);
} else if (platformName === config.android.name) {
await updateAndroid(config);
}
});
} catch (e) {
logError('Error running update:', e);
}
await runTask(chalk`{green {bold update}} {bold ${platformName}}`, async () => {
if (platformName === config.ios.name) {
await updateIOS(config, deployment);
} else if (platformName === config.android.name) {
await updateAndroid(config);
}
});
}
5 changes: 1 addition & 4 deletions cli/test/update.android.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { APP_ID, APP_NAME, CORDOVA_PLUGIN_ID, MappedFS, makeAppDir, makeConfig, run } from './util';
import { updateCommand } from '../src/tasks/update';
import { APP_ID, APP_NAME, CORDOVA_PLUGIN_ID, MappedFS, makeAppDir, run } from './util';

describe.each([false, true])('Update: Android (monoRepoLike: %p)', (monoRepoLike) => {
let appDirObj;
Expand All @@ -14,8 +13,6 @@ describe.each([false, true])('Update: Android (monoRepoLike: %p)', (monoRepoLike
// Init in this directory so we can test add
await run(appDir, `init "${APP_NAME}" "${APP_ID}" --npm-client npm`);
await run(appDir, `add android`);
// Redundant, because add does this, but called explicitly for thoroughness
await updateCommand(makeConfig(appDir), 'android', false);
FS = new MappedFS(appDir);
});

Expand Down
5 changes: 1 addition & 4 deletions cli/test/update.ios.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { APP_ID, APP_NAME, CORDOVA_PLUGIN_ID, MappedFS, makeAppDir, makeConfig, run } from './util';
import { updateCommand } from '../src/tasks/update';
import { APP_ID, APP_NAME, CORDOVA_PLUGIN_ID, MappedFS, makeAppDir, run } from './util';

describe.each([false, true])('Update: iOS (monoRepoLike: %p)', (monoRepoLike) => {
let appDirObj;
Expand All @@ -14,8 +13,6 @@ describe.each([false, true])('Update: iOS (monoRepoLike: %p)', (monoRepoLike) =>
// Init in this directory so we can test add
await run(appDir, `init "${APP_NAME}" "${APP_ID}" --npm-client npm`);
await run(appDir, `add ios`);
// Redundant, because add does this, but called explicitly for thoroughness
await updateCommand(makeConfig(appDir), 'ios', false);
FS = new MappedFS(appDir);
});

Expand Down

0 comments on commit ec086b0

Please sign in to comment.