1 | import { IConfigParseResult } from './config-parse-result';
|
2 | import * as deepmerge from 'deepmerge';
|
3 |
|
4 |
|
5 | export interface IPlugin {
|
6 |
|
7 | |
8 |
|
9 |
|
10 |
|
11 |
|
12 | applies: (component) => boolean,
|
13 |
|
14 | |
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | process: (
|
24 | component: any,
|
25 | childConfigs: Array<IConfigParseResult>,
|
26 | infrastructureMode: string | undefined,
|
27 | stage: string | undefined) => IConfigParseResult,
|
28 | }
|
29 |
|
30 |
|
31 | export const forwardChildPostBuilds = (childConfigs: Array<IConfigParseResult>) => (
|
32 | childConfigs.reduce((result, config) => result.concat(config.postBuilds), [])
|
33 | );
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | export const forwardChildWebpackConfigs = (childConfigs: Array<IConfigParseResult>) => {
|
40 | return childConfigs.reduce((result, config) => result.concat(...config.webpackConfigs), []);
|
41 | }
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | export const forwardChildIamRoleStatements = (childConfigs: Array<IConfigParseResult>) => {
|
48 |
|
49 | return childConfigs.reduce((result, config) => {
|
50 |
|
51 |
|
52 | const statements = (config.iamRoleStatements !== undefined && Array.isArray(config.iamRoleStatements)) ?
|
53 | config.iamRoleStatements : [];
|
54 |
|
55 |
|
56 |
|
57 | return result.concat(statements);
|
58 | }, [])
|
59 | };
|
60 |
|
61 |
|
62 |
|
63 |
|
\ | No newline at end of file |