From d006978916e5997ac595a25df78c79162929d9ee Mon Sep 17 00:00:00 2001 From: Kai Nguyen Date: Tue, 21 Nov 2023 12:01:00 +1030 Subject: [PATCH] MICRO-41: added some log --- src/index.ts | 18 ++++++++++++------ tsconfig.lib.json | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index 49607f2..5329643 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,7 +62,7 @@ class ServerlessExportResources implements ServerlessPlugin { }; } - initialize() { + private initialize() { this.exportResources = { ...this.service.custom.exportResources, prefix: @@ -72,13 +72,17 @@ class ServerlessExportResources implements ServerlessPlugin { this.validateResourceOutputRequirements(); + this.log.success( + 'Resource Export requirement validation complete! No errors were found.', + ); + this.resourceOutputs = this.prepareResourceOutputs(); } /** * Add custom outputs to original ones */ - updateOutputs() { + private updateOutputs() { const originalOutputs = (this.service.resources as ServerlessResources)?.Outputs || {}; const customOutputs = this.generateCustomOutputs(); @@ -90,9 +94,11 @@ class ServerlessExportResources implements ServerlessPlugin { ...customOutputs, }, }; + + this.log.success('Successfully added custom resource exports!'); } - validateResourceOutputRequirements() { + private validateResourceOutputRequirements() { let errors: string[] = []; const { functions: functionNames, stateMachines: stateMachineNames } = @@ -115,12 +121,12 @@ class ServerlessExportResources implements ServerlessPlugin { if (errors.length) { throw new Error( 'Missing Serverless Resource Output requirements\n' + - errors.toString(), + errors.join('\n'), ); } } - prepareResourceOutputs() { + private prepareResourceOutputs() { const { functions: functionNames, stateMachines: stateMachineNames } = this.exportResources; @@ -136,7 +142,7 @@ class ServerlessExportResources implements ServerlessPlugin { }; } - generateCustomOutputs() { + private generateCustomOutputs() { const provider = this.serverless.getProvider('aws'); const stackName = `${this.service.getServiceName()}-${provider.getStage()}`; diff --git a/tsconfig.lib.json b/tsconfig.lib.json index 3fe246b..5bdd111 100644 --- a/tsconfig.lib.json +++ b/tsconfig.lib.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "dist", - "declaration": true, + "declaration": false, "types": ["node"] }, "include": ["src/**/*.ts"],