UNPKG

2.09 kBPlain TextView Raw
1
2import { IConfigParseResult } from '../libs/config-parse-result';
3import {
4 IPlugin, forwardChildWebpackConfigs, forwardChildPostBuilds,
5 forwardChildIamRoleStatements
6} from '../libs/plugin';
7import { isIdentity } from './identity-component';
8import * as deepmerge from 'deepmerge';
9
10/**
11 * Parameters that apply to the whole Plugin, passed by other plugins
12 */
13export interface IIdentityPlugin {
14
15}
16
17/**
18 * We require an IdentityPlugin to forward the configuration from lower level webapps
19 * TODO: refactor so that we don't need such dummy plugins!
20 */
21export const IdentityPlugin = (props: IIdentityPlugin): IPlugin => {
22 const path = require('path');
23
24 const result: IPlugin = {
25 applies: (component):boolean => {
26
27 return isIdentity(component);
28 },
29
30 // convert the component into configuration parts
31 // while the component is of Type `any`, its props must be of type `IDataLayerArgs` | `IDataLayerProps`
32 process: (component:any,
33 childConfigs:Array<IConfigParseResult>,
34 infrastructureMode:string | undefined
35 ):IConfigParseResult => {
36
37
38 return {
39
40 slsConfigs: deepmerge.all(childConfigs.map(config => config.slsConfigs)),
41
42 // add the server config
43 webpackConfigs: forwardChildWebpackConfigs(childConfigs),
44
45 postBuilds: forwardChildPostBuilds(childConfigs),
46
47 iamRoleStatements: forwardChildIamRoleStatements(childConfigs)
48
49 /* THESE VALUES MUST NOT BE PROVIDED BY A CHILD, THEY ARE NOT FORWARED UPWARDS
50
51 environments: environments,
52
53 //stackName: component.stackName,
54
55 assetsPath: component.assetsPath,
56
57 buildPath: component.buildPath,
58
59 region: component.region,
60
61 domain: domain,
62
63 certArn: certArn,
64
65 supportOfflineStart: true,
66
67 supportCreateDomain: true
68 */
69 }
70 }
71 };
72
73
74 return result;
75
76};
\No newline at end of file