@@ -90,27 +90,34 @@ function createCodePushApp(name, os) {
90
90
owner = app . owner . name ;
91
91
console . log ( `App "${ name } " has been created \n` ) ;
92
92
} catch ( e ) {
93
- console . log ( " Error: " , e ) ;
94
- console . log ( `Please check that you haven't application with " ${ name } " name on portal` ) ;
93
+ console . error ( ` Error: Unable to create CodePush app. Please check that you haven't application with " ${ name } " name on portal.` , ) ;
94
+ console . error ( "Error: " , e . toString ( ) ) ;
95
95
}
96
96
execCommand ( `appcenter codepush deployment add -a ${ owner } /${ name } Staging` ) ;
97
97
} catch ( e ) {
98
- console . log ( "Error" , e ) ;
98
+ console . error ( "Error" , e . toString ( ) ) ;
99
99
}
100
- const deploymentKeysResult = execCommand ( `appcenter codepush deployment list -a ${ owner } /${ name } -k --output json` ) ;
101
- const deploymentKeys = JSON . parse ( deploymentKeysResult ) ;
102
- const stagingDeploymentKey = deploymentKeys [ 0 ] [ 1 ] ;
103
- console . log ( `Deployment key for ${ os } : ${ stagingDeploymentKey } ` ) ;
104
- console . log ( `Use "appcenter codepush release-react ${ owner } /${ name } " command to release updates for ${ os } \n` ) ;
105
-
106
- switch ( os ) {
107
- case 'Android' :
108
- androidStagingDeploymentKey = stagingDeploymentKey ;
109
- break ;
110
- case 'iOS' :
111
- iosStagingDeploymentKey = stagingDeploymentKey ;
112
- break ;
100
+
101
+ try {
102
+ const deploymentKeysResult = execCommand ( `appcenter codepush deployment list -a ${ owner } /${ name } -k --output json` ) ;
103
+ const deploymentKeys = JSON . parse ( deploymentKeysResult ) ;
104
+ const stagingDeploymentKey = deploymentKeys [ 0 ] [ 1 ] ;
105
+ console . log ( `Deployment key for ${ os } : ${ stagingDeploymentKey } ` ) ;
106
+ console . log ( `Use "appcenter codepush release-react ${ owner } /${ name } " command to release updates for ${ os } \n` ) ;
107
+
108
+ switch ( os ) {
109
+ case 'Android' :
110
+ androidStagingDeploymentKey = stagingDeploymentKey ;
111
+ break ;
112
+ case 'iOS' :
113
+ iosStagingDeploymentKey = stagingDeploymentKey ;
114
+ break ;
115
+ }
116
+ } catch ( e ) {
117
+ console . error ( "Error: Unable to load deployment keys" ) ;
118
+ console . error ( "Error: " , e . toString ( ) ) ;
113
119
}
120
+
114
121
}
115
122
116
123
function generatePlainReactNativeApp ( appName , reactNativeVersion ) {
@@ -165,12 +172,12 @@ function setupAssets() {
165
172
fs . writeFileSync ( 'index.android.js' , fs . readFileSync ( '../CodePushDemoApp-pre0.49/index.android.js' ) ) ;
166
173
fileToEdit = 'demo.js'
167
174
} else {
168
- fs . writeFileSync ( 'index.js' , fs . readFileSync ( '.. /CodePushDemoApp/index.js') ) ;
169
- fs . writeFileSync ( 'App.js' , fs . readFileSync ( '.. /CodePushDemoApp/App.js') ) ;
175
+ fs . writeFileSync ( 'index.js' , fs . readFileSync ( __dirname + ' /CodePushDemoApp/index.js') ) ;
176
+ fs . writeFileSync ( 'App.js' , fs . readFileSync ( __dirname + ' /CodePushDemoApp/App.js') ) ;
170
177
fileToEdit = 'index.js'
171
178
}
172
179
173
- copyRecursiveSync ( '.. /CodePushDemoApp/images', './images' ) ;
180
+ copyRecursiveSync ( __dirname + ' /CodePushDemoApp/images', './images' ) ;
174
181
175
182
fs . readFile ( fileToEdit , 'utf8' , function ( err , data ) {
176
183
if ( err ) {
0 commit comments