Skip to content

Commit

Permalink
Added log in catch after creating app on appcenter (#1971)
Browse files Browse the repository at this point in the history
* Added getting owner name if app already exists

* Added catch and logs
  • Loading branch information
alexChernyatiev authored Nov 6, 2020
1 parent 0a3db5a commit 8614337
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Examples/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,18 @@ linkCodePush(androidStagingDeploymentKey, iosStagingDeploymentKey);
function createCodePushApp(name, os) {
try {
console.log(`Creating CodePush app "${name}" to release updates for ${os}...`);
const appResult = execCommand(`appcenter apps create -d ${name} -n ${name} -o ${os} -p React-Native --output json`);
const app = JSON.parse(appResult);
owner = app.owner.name;
console.log(`App "${name}" has been created \n`);
try {
const appResult = execCommand(`appcenter apps create -d ${name} -n ${name} -o ${os} -p React-Native --output json`);
const app = JSON.parse(appResult);
owner = app.owner.name;
console.log(`App "${name}" has been created \n`);
} catch(e) {
console.log("Error: ", e);
console.log(`Please check that you haven't application with "${name}" name on portal`);
}
execCommand(`appcenter codepush deployment add -a ${owner}/${name} Staging`);
} catch (e) {
console.log(`App "${name}" already exists \n`);
console.log("Error", e);
}
const deploymentKeysResult = execCommand(`appcenter codepush deployment list -a ${owner}/${name} -k --output json`);
const deploymentKeys = JSON.parse(deploymentKeysResult);
Expand Down

0 comments on commit 8614337

Please sign in to comment.