Skip to content
17 changes: 15 additions & 2 deletions src/commands/code/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { APP_ID_TO_ENTER, APP_VERSION_ID_TO_ENTER } from 'consts/messages';
import { DynamicChoicesService } from 'services/dynamic-choices-service';
import { getCurrentWorkingDirectory } from 'services/env-service';
import { validateIfCanBuild } from 'services/files-service';
import { getTasksForServerSide } from 'services/share/deploy';
import { getTasksForClientSide, getTasksForServerSide } from 'services/share/deploy';
import logger from 'utils/logger';
import { addRegionToFlags, chooseRegionIfNeeded, getRegionFromString } from 'utils/region';

Expand Down Expand Up @@ -43,6 +43,9 @@ export default class Push extends AuthenticatedCommand {
char: 'f',
description: MESSAGES.force,
}),
cdn: Flags.boolean({
char: 'c',
}),
}),
);

Expand All @@ -51,9 +54,19 @@ export default class Push extends AuthenticatedCommand {

public async run(): Promise<void> {
const { flags } = await this.parse(Push);
const { directoryPath, region: strRegion } = flags;
const { directoryPath, region: strRegion, cdn } = flags;
const region = getRegionFromString(strRegion);
let appVersionId = flags.appVersionId;

if (cdn) {
const { appVersionId } = await DynamicChoicesService.chooseAppAndAppVersion(false, false, {
autoSelectVersion: true,
});
logger.info('Deploying server side files...');
await getTasksForClientSide(Number(appVersionId), directoryPath || getCurrentWorkingDirectory()).run();
process.exit(0);
}

validateIfCanBuild(directoryPath || getCurrentWorkingDirectory());

try {
Expand Down
2 changes: 1 addition & 1 deletion src/services/push-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export const deployClientZip = async (
task.output = `Deploying client zip (${ctx.archivePath!}) to cdn`;
const buffer = readZipFileAsBuffer(ctx.archivePath!);
const data = await uploadClientZipFile(ctx.appVersionId, buffer);
task.title = `your project is live at: ${data.url}, use ${data.sourceUrl} for download your source`;
task.title = `Your project is live at: ${data.url}\n You can download your source code here: ${data.sourceUrl}`;
};

export const buildAssetToDeployTask = async (
Expand Down
Loading