Skip to content

Commit

Permalink
MICRO-41: added some log
Browse files Browse the repository at this point in the history
  • Loading branch information
kai-nguyen-aligent committed Nov 21, 2023
1 parent 8d56636 commit d006978
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ServerlessExportResources implements ServerlessPlugin {
};
}

initialize() {
private initialize() {
this.exportResources = {
...this.service.custom.exportResources,
prefix:
Expand All @@ -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();
Expand All @@ -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 } =
Expand All @@ -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;

Expand All @@ -136,7 +142,7 @@ class ServerlessExportResources implements ServerlessPlugin {
};
}

generateCustomOutputs() {
private generateCustomOutputs() {
const provider = this.serverless.getProvider('aws');
const stackName = `${this.service.getServiceName()}-${provider.getStage()}`;

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"declaration": true,
"declaration": false,
"types": ["node"]
},
"include": ["src/**/*.ts"],
Expand Down

0 comments on commit d006978

Please sign in to comment.