-
Notifications
You must be signed in to change notification settings - Fork 3
/
.projenrc.js
108 lines (92 loc) · 2.44 KB
/
.projenrc.js
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
const { AwsCdkTypeScriptApp, web, NodePackageManager } = require('projen');
const cdkProject = new AwsCdkTypeScriptApp({
name: 'cdk-appsync-react-demo',
packageManager: NodePackageManager.NPM,
cdkVersion: '1.79.0',
cdkDependencies: [
'@aws-cdk/aws-appsync',
'@aws-cdk/aws-cognito',
'@aws-cdk/aws-iam',
'@aws-cdk/core',
],
deps: [
'cdk-appsync-transformer',
],
gitignore: [
'appsync/',
],
// Disable GitHub
mergify: false,
buildWorkflow: false,
releaseWorkflow: false,
rebuildBot: false,
dependabot: false,
pullRequestTemplate: false,
});
cdkProject.synth();
const reactProject = new web.ReactTypeScriptProject({
name: 'cdk-appsync-react-demo-frontend',
parent: cdkProject,
outdir: 'frontend',
deps: [
'@aws-amplify/auth',
'@aws-amplify/ui-components',
'@aws-amplify/ui-react',
'aws-amplify',
'react-query@^2', // I have an open PR for react-query v3 support
'react-router',
'react-router-dom',
],
devDeps: [
'@graphql-codegen/cli',
'@graphql-codegen/typescript',
'@graphql-codegen/typescript-operations',
'@graphql-codegen/typescript-react-query@alpha',
'amplify-graphql-docs-generator',
'aws-sdk@^2',
'graphql',
],
gitignore: [
'aws-exports.js',
],
tsconfig: {
compilerOptions: {
allowJs: true,
skipLibCheck: true,
esModuleInterop: true,
allowSyntheticDefaultImports: true,
forceConsistentCasingInFileNames: false,
module: 'esnext',
moduleResolution: 'node',
isolatedModules: true,
noEmit: true,
jsx: 'react-jsx',
},
},
// Disable GitHub
mergify: false,
buildWorkflow: false,
releaseWorkflow: false,
rebuildBot: false,
dependabot: false,
pullRequestTemplate: false,
});
reactProject.addTask('dev', {
description: 'Runs the application locally',
exec: 'react-scripts start',
});
reactProject.addTask('generate-exports', {
description: 'Generates aws-exports.js',
exec: 'node bin/generateExports.js',
});
reactProject.addTask('copy-schema', {
exec: 'cp ../appsync/schema.graphql ./schema.graphql',
});
reactProject.addTask('generate-statements', {
exec: 'node bin/generateStatements.js',
});
reactProject.addTask('codegen', {
description: 'Copies the backend schema and generates frontend code',
exec: 'yarn run copy-schema && yarn run generate-statements && graphql-codegen --config codegen.yml && rm schema.graphql',
});
reactProject.synth();