Skip to content

Commit

Permalink
Apply prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
ncamera committed Jun 17, 2024
1 parent 69d47df commit 5403f26
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions libs/ngx-aws-deploy/src/lib/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import {
BuilderOutput,
createBuilder,
targetFromTargetString,
} from '@angular-devkit/architect';
import * as glob from 'glob';
import { getAccessKeyId, getSecretAccessKey } from './config';
import { CloudFront } from './cloudfront';
import { Schema } from './schema';
import { Uploader } from './uploader';
} from "@angular-devkit/architect";
import * as glob from "glob";
import { getAccessKeyId, getSecretAccessKey } from "./config";
import { CloudFront } from "./cloudfront";
import { Schema } from "./schema";
import { Uploader } from "./uploader";

const getFiles = (filesPath: string) => {
return glob.sync(`**`, {
ignore: ['.git'],
ignore: [".git"],
cwd: filesPath,
nodir: true,
// Directory and file names may contain `.` at the beginning,
Expand All @@ -26,9 +26,9 @@ export default createBuilder(
builderConfig: Schema,
context: BuilderContext
): Promise<BuilderOutput> => {
context.reportStatus('Executing deployment');
context.reportStatus("Executing deployment");
if (!context.target) {
throw new Error('Cannot deploy the application without a target');
throw new Error("Cannot deploy the application without a target");
}
const buildTarget = {
name:
Expand All @@ -50,7 +50,7 @@ export default createBuilder(

const deployConfig = { bucket, region, subFolder } as Pick<
Schema,
'bucket' | 'region' | 'subFolder'
"bucket" | "region" | "subFolder"
>;

let buildResult: BuilderOutput;
Expand Down Expand Up @@ -87,17 +87,17 @@ export default createBuilder(

if (files.length === 0) {
throw new Error(
'Target did not produce any files, or the path is incorrect.'
"Target did not produce any files, or the path is incorrect."
);
}
if (getAccessKeyId() || getSecretAccessKey()) {
const uploader = new Uploader(context, deployConfig);

if (builderConfig.deleteBeforeUpload) {
context.logger.info('Start removing files before upload...');
context.logger.info("Start removing files before upload...");
const success = await uploader.deleteAllFiles();
if (success) {
context.logger.info('✔ Finished removing files...');
context.logger.info("✔ Finished removing files...");
} else {
return {
error: `❌ We encounterd an error during the removal of the files`,
Expand All @@ -106,16 +106,16 @@ export default createBuilder(
}
}

context.logger.info('Start uploading files...');
context.logger.info("Start uploading files...");
const success = await uploader.upload(files, filesPath);
if (success) {
context.logger.info('✔ Finished uploading files...');
context.logger.info("✔ Finished uploading files...");

if (builderConfig.deleteAfterUpload) {
context.logger.info('Start removing files after upload...');
context.logger.info("Start removing files after upload...");
const success = await uploader.deleteStaleFiles(files);
if (success) {
context.logger.info('✔ Finished removing files...');
context.logger.info("✔ Finished removing files...");
} else {
return {
error: `❌ Error during files removal`,
Expand All @@ -124,11 +124,11 @@ export default createBuilder(
}
}

context.logger.info('Start CloudFront invalidation...');
context.logger.info("Start CloudFront invalidation...");
const cloudFront = new CloudFront(context, deployConfig);
const success = await cloudFront.invalidate();
if (success) {
context.logger.info('✔ Finished CloudFront invalidation...');
context.logger.info("✔ Finished CloudFront invalidation...");
return { success: true };
} else {
context.logger.error(`❌ Error during CloudFront invalidation`);
Expand Down

0 comments on commit 5403f26

Please sign in to comment.