nativescript-cloud
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -5,2 +5,3 @@ "use strict"; | ||
$injector.require("serviceProxy", path.join(__dirname, "services", "service-proxy")); | ||
$injector.require("packageInfoService", path.join(__dirname, "services", "package-info-service")); | ||
$injector.require("serverConfig", path.join(__dirname, "server-config")); | ||
@@ -7,0 +8,0 @@ $injector.require("server", path.join(__dirname, "services", "cloud-service")); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -10,6 +10,5 @@ "use strict"; | ||
}; | ||
const path = require("path"); | ||
class CloudLibVersion { | ||
constructor($fs, $logger) { | ||
this.$fs = $fs; | ||
constructor($packageInfoService, $logger) { | ||
this.$packageInfoService = $packageInfoService; | ||
this.$logger = $logger; | ||
@@ -20,6 +19,3 @@ this.allowedParameters = []; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const pathToPackageJson = path.join(__dirname, "..", "..", "package.json"); | ||
const packageJsonContent = this.$fs.readJson(pathToPackageJson); | ||
const version = packageJsonContent.version; | ||
this.$logger.info(version); | ||
this.$logger.info(this.$packageInfoService.getVersion()); | ||
}); | ||
@@ -26,0 +22,0 @@ } |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -18,3 +18,3 @@ "use strict"; | ||
class CloudBuildService { | ||
constructor($fs, $httpClient, $projectFilesManager, $errors, $server, $mobileHelper, $projectHelper, $logger) { | ||
constructor($fs, $httpClient, $projectFilesManager, $errors, $server, $qr, $mobileHelper, $projectHelper, $logger) { | ||
this.$fs = $fs; | ||
@@ -25,2 +25,3 @@ this.$httpClient = $httpClient; | ||
this.$server = $server; | ||
this.$qr = $qr; | ||
this.$mobileHelper = $mobileHelper; | ||
@@ -36,15 +37,7 @@ this.$projectHelper = $projectHelper; | ||
let buildProps = yield this.prepareBuildRequest(projectSettings, platform, buildConfiguration); | ||
let outputFileName = projectSettings.projectName; | ||
if (this.$mobileHelper.isAndroidPlatform(platform)) { | ||
buildProps = yield this.getAndroidBuildProperties(projectSettings, buildProps, androidBuildData); | ||
outputFileName += ".apk"; | ||
} | ||
else if (this.$mobileHelper.isiOSPlatform(platform)) { | ||
buildProps = yield this.getiOSBuildProperties(projectSettings, buildProps, iOSBuildData); | ||
if (iOSBuildData.buildForDevice) { | ||
outputFileName += ".ipa"; | ||
} | ||
else { | ||
outputFileName += ".zip"; | ||
} | ||
} | ||
@@ -56,8 +49,14 @@ const buildResult = yield this.$server.appsBuild.buildProject(projectSettings.projectId, buildProps); | ||
this.$logger.info(`Finished ${buildInformationString} successfully. Downloading result...`); | ||
const localBuildResult = yield this.downloadBuildResult(buildResult, projectSettings.projectDir, outputFileName); | ||
this.$logger.info(`The result of ${buildInformationString} successfully downloaded. Log from cloud build is:${os_1.EOL}* stderr: ${buildResult.Error}${os_1.EOL}* stdout: ${buildResult.Output}${os_1.EOL}* outputFilePath: ${localBuildResult}`); | ||
const localBuildResult = yield this.downloadBuildResult(buildResult, projectSettings.projectDir); | ||
this.$logger.info(`The result of ${buildInformationString} successfully downloaded. Log from cloud build is:${os_1.EOL}* stderr: ${buildResult.Errors}${os_1.EOL}* stdout: ${buildResult.Output}${os_1.EOL}* outputFilePath: ${localBuildResult}`); | ||
const buildResultUrl = this.getBuildResultUrl(buildResult); | ||
return { | ||
stderr: buildResult.Error, | ||
stderr: buildResult.Errors, | ||
stdout: buildResult.Output, | ||
outputFilePath: localBuildResult | ||
fullOutput: buildResult.FullOutput, | ||
outputFilePath: localBuildResult, | ||
qrData: { | ||
originalUrl: buildResultUrl, | ||
imageData: yield this.$qr.generateDataUri(buildResultUrl) | ||
} | ||
}; | ||
@@ -168,2 +167,4 @@ }); | ||
requestOpts.body = this.$fs.readFile(localFilePath); | ||
requestOpts.headers = requestOpts.headers || {}; | ||
requestOpts.headers["Content-Length"] = requestOpts.body.length; | ||
try { | ||
@@ -251,11 +252,17 @@ yield this.$httpClient.httpRequest(requestOpts); | ||
} | ||
downloadBuildResult(buildResult, projectDir, outputFileName) { | ||
getBuildResultUrl(buildResult) { | ||
return this.getBuildResult(buildResult).FullPath; | ||
} | ||
getBuildResult(buildResult) { | ||
return _.find(buildResult.BuildItems, (b) => b.Disposition === "BuildResult"); | ||
} | ||
downloadBuildResult(buildResult, projectDir) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const buildResultUrl = _.find(buildResult.BuildItems, (b) => b.Disposition === "BuildResult").FullPath; | ||
const destinationDir = path.join(projectDir, constants.CLOUD_TEMP_DIR_NAME); | ||
this.$fs.ensureDirectoryExists(destinationDir); | ||
const targetFileName = path.join(destinationDir, outputFileName); | ||
const buildResultObj = this.getBuildResult(buildResult); | ||
const targetFileName = path.join(destinationDir, buildResultObj.Filename); | ||
const targetFile = this.$fs.createWriteStream(targetFileName); | ||
yield this.$httpClient.httpRequest({ | ||
url: buildResultUrl, | ||
url: buildResultObj.FullPath, | ||
pipeTo: targetFile | ||
@@ -262,0 +269,0 @@ }); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -11,4 +11,5 @@ "use strict"; | ||
class ServiceProxy { | ||
constructor($httpClient, $logger, $serverConfig, $errors) { | ||
constructor($httpClient, $packageInfoService, $logger, $serverConfig, $errors) { | ||
this.$httpClient = $httpClient; | ||
this.$packageInfoService = $packageInfoService; | ||
this.$logger = $logger; | ||
@@ -23,2 +24,3 @@ this.$serverConfig = $serverConfig; | ||
headers["X-Icenium-SolutionSpace"] = headers["X-Icenium-SolutionSpace"] || "Private_Build_Folder"; | ||
headers["User-Agent"] = `fusion/${this.$packageInfoService.getVersion()} (Node.js ${process.versions.node}; ${process.platform}; ${process.arch})`; | ||
if (accept) { | ||
@@ -25,0 +27,0 @@ headers.Accept = accept; |
{ | ||
"name": "nativescript-cloud", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Used for cloud support in NativeScript CLI", | ||
@@ -5,0 +5,0 @@ "main": "lib/bootstrap.js", |
@@ -0,0 +0,0 @@ # nativescript-cloud |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47345
17
654