nativescript-cloud
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -49,2 +49,3 @@ "use strict"; | ||
projectName: this.$projectData.projectName, | ||
bundle: !!this.$options.bundle, | ||
clean: this.$options.clean, | ||
@@ -93,3 +94,3 @@ env: this.$options.env | ||
teamId: this.$options.teamId, | ||
bundle: this.$options.bundle, | ||
bundle: !!this.$options.bundle, | ||
device: this.$options.device, | ||
@@ -96,0 +97,0 @@ projectDir: this.$options.path, |
@@ -22,6 +22,7 @@ "use strict"; | ||
class CloudBuildService extends cloud_service_1.CloudService { | ||
constructor($fs, $httpClient, $logger, $errors, $mobileHelper, $nsCloudAccountsService, $nsCloudServerBuildService, $nsCloudBuildOutputFilter, $nsCloudGitService, $nsCloudItmsServicesPlistHelper, $nsCloudUploadService, $nsCloudUserService, $platformService, $projectHelper, $projectDataService, $qr, $staticConfig) { | ||
constructor($fs, $httpClient, $logger, $errors, $mobileHelper, $devicePlatformsConstants, $nsCloudAccountsService, $nsCloudServerBuildService, $nsCloudBuildOutputFilter, $nsCloudGitService, $nsCloudItmsServicesPlistHelper, $nsCloudUploadService, $nsCloudUserService, $platformService, $projectHelper, $projectDataService, $qr, $staticConfig) { | ||
super($fs, $httpClient, $logger); | ||
this.$errors = $errors; | ||
this.$mobileHelper = $mobileHelper; | ||
this.$devicePlatformsConstants = $devicePlatformsConstants; | ||
this.$nsCloudAccountsService = $nsCloudAccountsService; | ||
@@ -101,3 +102,17 @@ this.$nsCloudServerBuildService = $nsCloudServerBuildService; | ||
const filesToUpload = this.prepareFilesToUpload(buildCredentials.urls, buildFiles); | ||
let buildProps = yield this.prepareBuildRequest(buildId, projectSettings, platform, buildConfiguration, buildCredentials, filesToUpload, accountId); | ||
const additionalCliFlags = []; | ||
if (projectSettings.bundle) { | ||
const envOptions = _.keys(projectSettings.env).map(option => `--env.${option}`); | ||
additionalCliFlags.push("--bundle", ...envOptions); | ||
} | ||
let buildProps = yield this.prepareBuildRequest({ | ||
buildId, | ||
projectSettings, | ||
platform, | ||
buildConfiguration, | ||
buildCredentials, | ||
filesToUpload, | ||
additionalCliFlags, | ||
accountId | ||
}); | ||
if (this.$mobileHelper.isAndroidPlatform(platform)) { | ||
@@ -250,2 +265,10 @@ buildProps = yield this.getAndroidBuildProperties(projectSettings, buildProps, filesToUpload, androidBuildData); | ||
const cliVersion = this.$staticConfig.version; | ||
const userAppGradleFilePath = path.join(projectData.appResourcesDirectoryPath, this.$devicePlatformsConstants.Android, "app.gradle"); | ||
if (this.$fs.exists(userAppGradleFilePath)) { | ||
const appGradleContents = this.$fs.readText(userAppGradleFilePath); | ||
const appGradleReplacedContents = appGradleContents.replace(/__PACKAGE__/g, projectData.projectId); | ||
if (appGradleReplacedContents !== appGradleContents) { | ||
this.$fs.writeFile(userAppGradleFilePath, appGradleReplacedContents); | ||
} | ||
} | ||
const shouldUseOldPrepare = semver.valid(cliVersion) && semver.lt(cliVersion, semver.prerelease(cliVersion) ? "3.4.0-2017-11-02-10045" : "3.4.0"); | ||
@@ -271,12 +294,12 @@ if (shouldUseOldPrepare) { | ||
} | ||
prepareBuildRequest(buildId, projectSettings, platform, buildConfiguration, buildCredentials, filesToUpload, accountId) { | ||
prepareBuildRequest(settings) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
this.emitStepChanged(buildId, constants.BUILD_STEP_NAME.UPLOAD, constants.BUILD_STEP_PROGRESS.START); | ||
this.emitStepChanged(settings.buildId, constants.BUILD_STEP_NAME.UPLOAD, constants.BUILD_STEP_PROGRESS.START); | ||
let buildFiles; | ||
try { | ||
yield this.$nsCloudGitService.gitPushChanges(projectSettings, { httpRemoteUrl: buildCredentials.codeCommit.cloneUrlHttp }, buildCredentials.codeCommit.credentials, { isNewRepository: buildCredentials.codeCommit.isNewRepository }); | ||
yield this.$nsCloudGitService.gitPushChanges(settings.projectSettings, { httpRemoteUrl: settings.buildCredentials.codeCommit.cloneUrlHttp }, settings.buildCredentials.codeCommit.credentials, { isNewRepository: settings.buildCredentials.codeCommit.isNewRepository }); | ||
buildFiles = [ | ||
{ | ||
disposition: constants.DISPOSITIONS.PACKAGE_GIT, | ||
sourceUri: buildCredentials.codeCommitUrl | ||
sourceUri: settings.buildCredentials.codeCommitUrl | ||
} | ||
@@ -288,6 +311,6 @@ ]; | ||
this.$logger.warn(err.message); | ||
const filePath = yield this.zipProject(projectSettings.projectDir); | ||
const filePath = yield this.zipProject(settings.projectSettings.projectDir); | ||
const preSignedUrlData = yield this.$nsCloudServerBuildService.getPresignedUploadUrlObject(uuid.v4()); | ||
const disposition = constants.DISPOSITIONS.PACKAGE_ZIP; | ||
filesToUpload.push(_.merge({ filePath, disposition }, preSignedUrlData)); | ||
settings.filesToUpload.push(_.merge({ filePath, disposition }, preSignedUrlData)); | ||
buildFiles = [ | ||
@@ -300,24 +323,25 @@ { | ||
} | ||
for (const fileToUpload of filesToUpload) { | ||
for (const fileToUpload of settings.filesToUpload) { | ||
yield this.$nsCloudUploadService.uploadToS3(fileToUpload.filePath, fileToUpload.fileName, fileToUpload.uploadPreSignedUrl); | ||
} | ||
this.emitStepChanged(buildId, constants.BUILD_STEP_NAME.UPLOAD, constants.BUILD_STEP_PROGRESS.END); | ||
const coreModulesVersion = this.$fs.readJson(path.join(projectSettings.projectDir, "package.json")).dependencies["tns-core-modules"]; | ||
const runtimeVersion = yield this.getRuntimeVersion(platform, projectSettings.nativescriptData, coreModulesVersion); | ||
this.emitStepChanged(settings.buildId, constants.BUILD_STEP_NAME.UPLOAD, constants.BUILD_STEP_PROGRESS.END); | ||
const coreModulesVersion = this.$fs.readJson(path.join(settings.projectSettings.projectDir, "package.json")).dependencies["tns-core-modules"]; | ||
const runtimeVersion = yield this.getRuntimeVersion(settings.platform, settings.projectSettings.nativescriptData, coreModulesVersion); | ||
const cliVersion = yield this.getCliVersion(runtimeVersion); | ||
const sanitizedProjectName = this.$projectHelper.sanitizeName(projectSettings.projectName); | ||
const sanitizedProjectName = this.$projectHelper.sanitizeName(settings.projectSettings.projectName); | ||
return { | ||
accountId, | ||
accountId: settings.accountId, | ||
properties: { | ||
buildId, | ||
buildConfiguration: buildConfiguration, | ||
platform: platform, | ||
appIdentifier: projectSettings.projectId, | ||
buildId: settings.buildId, | ||
buildConfiguration: settings.buildConfiguration, | ||
platform: settings.platform, | ||
appIdentifier: settings.projectSettings.projectId, | ||
frameworkVersion: cliVersion, | ||
runtimeVersion: runtimeVersion, | ||
sessionKey: buildCredentials.sessionKey, | ||
sessionKey: settings.buildCredentials.sessionKey, | ||
templateAppName: sanitizedProjectName, | ||
projectName: sanitizedProjectName, | ||
framework: "tns", | ||
useIncrementalBuild: !projectSettings.clean, | ||
additionalCliFlags: settings.additionalCliFlags, | ||
useIncrementalBuild: !settings.projectSettings.clean, | ||
userEmail: this.$nsCloudUserService.getUser().email | ||
@@ -324,0 +348,0 @@ }, |
{ | ||
"name": "nativescript-cloud", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Used for cloud support in NativeScript CLI", | ||
@@ -5,0 +5,0 @@ "main": "lib/bootstrap.js", |
@@ -65,3 +65,3 @@ # nativescript-cloud | ||
* Builds the specified application in the cloud and returns information about the whole build process. | ||
* @param {IProjectSettings} projectSettings Describes the current project - project dir, application identifier, name and nativescript data. | ||
* @param {INSCloudProjectSettings} projectSettings Describes the current project - project dir, application identifier, name and nativescript data, as well as additional options to control the build workflow. | ||
* @param {string} platform The mobile platform for which the application should be built: Android or iOS. | ||
@@ -74,3 +74,3 @@ * @param {string} buildConfiguration The build configuration - Debug or Release. | ||
*/ | ||
build(projectSettings: IProjectSettings, | ||
build(projectSettings: INSCloudProjectSettings, | ||
platform: string, | ||
@@ -132,3 +132,7 @@ buildConfiguration: string, | ||
projectName: path.dirname(process.cwd()), | ||
nativeScriptData: packageJsonContent.nativescript | ||
nativeScriptData: packageJsonContent.nativescript, | ||
bundle: true, | ||
env: { | ||
uglify: true | ||
} | ||
}; | ||
@@ -135,0 +139,0 @@ |
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
254901
3770
1131