@@ -9,7 +9,6 @@ var opener = require("opener");
99import os from "os" ;
1010import path from "path" ;
1111var prompt = require ( "prompt" ) ;
12- import Q from "q" ;
1312import * as rimraf from "rimraf" ;
1413var which = require ( "which" ) ;
1514import wordwrap = require( "wordwrap" ) ;
@@ -38,11 +37,11 @@ import {
3837import { isBinaryOrZip } from "./lib/file-utils" ;
3938import { out } from "./util/interaction" ;
4039import { isValidRange } from "./lib/validation-utils" ;
40+ import { getCordovaProjectAppVersion } from "./lib/cordova-utils" ;
4141
4242var configFilePath : string = path . join ( process . env . LOCALAPPDATA || process . env . HOME , ".code-push.config" ) ;
4343var emailValidator = require ( "email-validator" ) ;
4444var packageJson = require ( "../package.json" ) ;
45- var parseXml = Q . denodeify ( require ( "xml2js" ) . parseString ) ;
4645
4746const CLI_HEADERS : Headers = {
4847 "X-CodePush-CLI-Version" : packageJson . version ,
@@ -1063,12 +1062,12 @@ export var release = (command: cli.IReleaseCommand): Promise<void> => {
10631062 type : command . type ,
10641063 } ;
10651064
1066- var releaseHooksPromise = hooks . reduce ( ( accumulatedPromise : Q . Promise < cli . IReleaseCommand > , hook : cli . ReleaseHook ) => {
1065+ var releaseHooksPromise = hooks . reduce ( ( accumulatedPromise : Promise < cli . IReleaseCommand > , hook : cli . ReleaseHook ) => {
10671066 return accumulatedPromise . then ( ( modifiedCommand : cli . IReleaseCommand ) => {
10681067 currentCommand = modifiedCommand || currentCommand ;
10691068 return hook ( currentCommand , command , sdk ) ;
10701069 } ) ;
1071- } , Q ( currentCommand ) ) ;
1070+ } , Promise . resolve ( currentCommand ) ) ;
10721071
10731072 return releaseHooksPromise . then ( ( ) => { } ) . catch ( ( err : CodePushError ) => releaseErrorHandler ( err , command ) ) ;
10741073 } ) ;
@@ -1083,7 +1082,6 @@ export var releaseCordova = (command: cli.IReleaseCordovaCommand): Promise<void>
10831082 var platform : string = command . platform . toLowerCase ( ) ;
10841083 var projectRoot : string = process . cwd ( ) ;
10851084 var platformFolder : string = path . join ( projectRoot , "platforms" , platform ) ;
1086- var platformCordova : string = path . join ( platformFolder , "cordova" ) ;
10871085 var outputFolder : string ;
10881086
10891087 if ( platform === "ios" ) {
@@ -1125,31 +1123,17 @@ export var releaseCordova = (command: cli.IReleaseCordovaCommand): Promise<void>
11251123 ) ;
11261124 }
11271125
1128- try {
1129- var configString : string = fs . readFileSync ( path . join ( projectRoot , "config.xml" ) , { encoding : "utf8" } ) ;
1130- } catch ( error ) {
1131- throw new Error (
1132- `Unable to find or read "config.xml" in the CWD. The "release-cordova" command must be executed in a Cordova project folder.`
1133- ) ;
1134- }
1135-
1136- var configPromise : Promise < any > = parseXml ( configString ) as any ;
1137-
11381126 releaseCommand . package = outputFolder ;
11391127 releaseCommand . type = cli . CommandType . release ;
11401128
1141- return configPromise . catch ( ( err : any ) => {
1142- throw new Error ( `Unable to parse "config.xml" in the CWD. Ensure that the contents of "config.xml" is valid XML.` ) ;
1143- } ) ;
1129+ return getCordovaProjectAppVersion ( projectRoot ) ;
11441130 } )
1145- . then ( ( parsedConfig : any ) => {
1146- var config : any = parsedConfig . widget ;
1147-
1131+ . then ( ( appVersion : string ) => {
11481132 var releaseTargetVersion : string ;
11491133 if ( command . appStoreVersion ) {
11501134 releaseTargetVersion = command . appStoreVersion ;
11511135 } else {
1152- releaseTargetVersion = config [ "$" ] . version ;
1136+ releaseTargetVersion = appVersion ;
11531137 }
11541138
11551139 throwForInvalidSemverRange ( releaseTargetVersion ) ;
@@ -1231,7 +1215,7 @@ export var releaseReact = (command: cli.IReleaseReactCommand): Promise<void> =>
12311215 }
12321216
12331217 var appVersionPromise : Promise < string > = command . appStoreVersion
1234- ? ( Q ( command . appStoreVersion ) as any )
1218+ ? Promise . resolve ( command . appStoreVersion )
12351219 : getReactNativeProjectAppVersion ( command , projectName ) ;
12361220
12371221 if ( command . sourcemapOutputDir && command . sourcemapOutput ) {
0 commit comments