-
Notifications
You must be signed in to change notification settings - Fork 24
/
.projenrc.ts
132 lines (117 loc) · 3.91 KB
/
.projenrc.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*! Copyright [Amazon.com](http://amazon.com/), Inc. or its affiliates. All Rights Reserved.
PDX-License-Identifier: Apache-2.0 */
import { GalileoCdk, Demo, GalileoSdk, GalileoCli } from './projenrc';
import { GITHUB } from './projenrc/constants';
import { MonorepoProject } from './projenrc/monorepo';
const DEMO_DIR = 'demo';
const monorepo = new MonorepoProject({
repository: `https://github.com/${GITHUB.ORG}/${GITHUB.REPOSITORY}`,
devDeps: [
'@types/clear',
'@types/figlet',
'@types/lodash',
'@types/node-localstorage',
'@types/prompts',
'case',
'chalk',
'clear',
'commander',
'execa',
'figlet',
'lodash',
'node-localstorage',
'prompts',
'tsconfig-paths',
'@pnpm/logger'
],
tsconfig: {
compilerOptions: {
noEmit: true,
rootDir: undefined,
sourceRoot: undefined,
baseUrl: '.',
paths: {
// Map to source files for projen workspace
'@aws/galileo-sdk/*': ['packages/galileo-sdk/src/*'],
'@aws/galileo-cdk/*': ['demo/infra/src/galileo/*'],
},
},
include: ['.projenrc.ts', 'projenrc/**/*.ts'],
},
});
monorepo.package.addField('homepage', `https://${GITHUB.ORG}.github.io/${GITHUB.REPOSITORY}`);
monorepo.tryFindObjectFile('tsconfig.json')?.addOverride('ts-node', {
require: ['tsconfig-paths/register'],
});
monorepo.eslint?.addIgnorePattern(DEMO_DIR + '/**/*.*');
monorepo.eslint?.addIgnorePattern('docs/**/*.*');
// local dir to store files without committing
monorepo.addGitIgnore('.local');
// Just some helper tasks to abstract deployment for consumers
monorepo.addTask('bootstrap-account', {
description: 'Bootstrap aws account with CDK',
receiveArgs: true,
exec: 'pnpm dlx cdk bootstrap --profile ${AWS_PROFILE} aws://$(aws sts get-caller-identity --query Account --output text)/$(aws configure get region) --cloudformation-execution-policies arn:aws:iam::aws:policy/PowerUserAccess --cloudformation-execution-policies arn:aws:iam::aws:policy/IAMFullAccess',
});
monorepo.addNxRunManyTask('deploy:pipeline', {
target: 'deploy:pipeline',
});
monorepo.nx.setTargetDefault('deploy:pipeline', {
dependsOn: ['build', '^deploy:pipeline'],
});
monorepo.addNxRunManyTask('deploy:app', {
target: 'deploy:app',
});
monorepo.nx.setTargetDefault('deploy:app', {
dependsOn: ['build', '^deploy:app'],
});
monorepo.nx.cacheableOperations.push('generated');
monorepo.package.addPackageResolutions(
...[
'nth-check@>=2.0.1',
// https://www.npmjs.com/advisories/1092413
'semver@>=7.5.2',
// https://github.com/advisories/GHSA-m95q-7qp3-xv42
'zod@>=3.22.3',
// https://github.com/advisories/GHSA-7fh5-64p2-3v2j
'postcss@>=8.4.31',
],
);
monorepo.setScript(
'git-clean:keep-configs',
`git clean -xfd ${[
'demo/website/public',
'demo/infra/config*.json',
'packages/galileo-cli/bin/.cache',
'demo/infra/cdk.context.json',
'demo/overrides',
'.local',
]
.map((v) => `-e ${v}`)
.join(' ')}`,
);
//////////////////////////////////////////////////////////
// Docs
//////////////////////////////////////////////////////////
monorepo.addTask('docs:build', { exec: 'docs/scripts/build.sh' });
monorepo.addTask('docs:serve', { exec: 'docs/scripts/serve.sh' });
//////////////////////////////////////////////////////////
// FRAMEWORK
//////////////////////////////////////////////////////////
const galileoSdk = new GalileoSdk(monorepo);
const galileoCdkLib = new GalileoCdk(monorepo);
galileoCdkLib.addBundledDeps(galileoSdk.package.packageName);
const galileoCli = new GalileoCli(monorepo);
// CLI imports a few definitions from CDK package
// adding implicit dependency to force build order
monorepo.addImplicitDependency(galileoCli, galileoCdkLib);
//////////////////////////////////////////////////////////
// DEMOS
//////////////////////////////////////////////////////////
new Demo({
monorepo,
galileoCdkLib,
galileoSdk,
rootOutdir: DEMO_DIR,
});
monorepo.synth();