diff --git a/src/commands/build.js b/src/commands/build.js index 003fbc709..bf9c00cb5 100644 --- a/src/commands/build.js +++ b/src/commands/build.js @@ -39,8 +39,7 @@ export async function build( targetName = null, compileOnly = false, compileBuildOnly = false, - compileBuildDeployOnly = false, - isForced = false + compileBuildDeployOnly = false ) { const CONSTANTS = require('../constants') @@ -55,7 +54,7 @@ export async function build( if (compileBuildDeployOnly) { await compile(targetName) await createFinalSasFiles() - return await deploy(targetName, targetToBuild, isForced) + return await deploy(targetName, targetToBuild) } if (compileBuildOnly) { diff --git a/src/commands/deploy.js b/src/commands/deploy.js index d81e7d36b..805af4e0f 100644 --- a/src/commands/deploy.js +++ b/src/commands/deploy.js @@ -19,11 +19,7 @@ import { let targetToBuild = null let executionSession -export async function deploy( - targetName = null, - preTargetToBuild = null, - isForced = false -) { +export async function deploy(targetName = null, preTargetToBuild = null) { if (preTargetToBuild) targetToBuild = preTargetToBuild else { const { target } = await findTargetInConfiguration(targetName) @@ -48,7 +44,7 @@ export async function deploy( chalk.cyanBright(`Executing deployServicePack to update SAS server.`) ) - await deployToSasViyaWithServicePack(targetToBuild, isForced) + await deployToSasViyaWithServicePack(targetToBuild) console.log('Job execution completed!') } @@ -153,7 +149,7 @@ async function getSASjsAndAccessToken(buildTarget) { } } -async function deployToSasViyaWithServicePack(buildTarget, isForced) { +async function deployToSasViyaWithServicePack(buildTarget) { const sasjs = new SASjs({ serverUrl: buildTarget.serverUrl, appLoc: buildTarget.appLoc, @@ -194,11 +190,11 @@ async function deployToSasViyaWithServicePack(buildTarget, isForced) { null, null, access_token, - isForced + true ) } - return await sasjs.deployServicePack(jsonObject, null, null, null, isForced) + return await sasjs.deployServicePack(jsonObject, null, null, null, true) } async function deployToSasViya( diff --git a/src/commands/help.js b/src/commands/help.js index bd5908e01..3f7661136 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -89,6 +89,9 @@ export async function printHelpText() { 'serverUrl' )} - The full path to the server (eg https://yourserver) * ${chalk.cyanBright('serverType')} - Eg SAS9 or SASVIYA + + NOTE: By default deploy will overwrite an existing deploy (force deploy). + * ${chalk.greenBright( 'compilebuilddeploy ' )} - executes script file specified in the ${chalk.cyanBright( diff --git a/src/main.js b/src/main.js index 23b98a860..cc1f0589d 100644 --- a/src/main.js +++ b/src/main.js @@ -131,13 +131,12 @@ export async function compileServices(targetName) { export async function deployServices(commandLine) { const command = new Command(commandLine) let targetName = command.getFlagValue('target') - const isForced = command.getFlagValue('force') if (!targetName) { targetName = command.getTargetWithoutFlag() } - await deploy(targetName, null, isForced) + await deploy(targetName, null) .then(() => console.log( chalk.greenBright.bold.italic( @@ -155,11 +154,8 @@ export async function deployServices(commandLine) { console.log( chalk.redBright( 'An error has occurred when building services.', - `${message}${ - status === 409 - ? '\nIf you still want to deploy, use force flag (-f) after target name.' - : '' - }${details ? '\n' + details : ''}` + `${message} + ${details ? '\n' + details : ''}` ) ) } else { @@ -234,11 +230,7 @@ export async function compileBuildDeployServices(commandLine) { console.log( chalk.redBright( 'An error has occurred when building services.', - `${message}${ - status === 409 - ? '\nIf you still want to deploy, use force flag (-f) after target name.' - : '' - }${details ? '\n' + details : ''}` + `${message}${details ? '\n' + details : ''}` ) ) } else { diff --git a/test/utils.spec.js b/test/utils.spec.js index 65c99154d..8aaeacf38 100644 --- a/test/utils.spec.js +++ b/test/utils.spec.js @@ -5,7 +5,9 @@ describe('generateTimestamp', () => { beforeAll(() => { const currentDate = new Date('2020-10-02T10:10:10.10Z') realDate = Date - global.Date = class extends Date { + global.Date = class extends ( + Date + ) { constructor(date) { if (date) { return super(date)