Skip to content

Commit 62012b5

Browse files
author
Dane Pilcher
authored
Merge pull request #825 from aws-amplify/feature/gen2-release
Merge feature/gen2-release to main
2 parents f217f56 + e7320a9 commit 62012b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+11410
-78
lines changed

.codebuild/e2e_workflow.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,25 +145,25 @@ batch:
145145
depend-on:
146146
- publish_to_local_registry
147147
- identifier: >-
148-
l_build_app_ts_push_codegen_admin_modelgen_uninitialized_project_codegen_js_uninitialized_project_modelgen_android
148+
l_build_app_ts_graphql_generator_app_push_codegen_admin_modelgen_uninitialized_project_codegen_js
149149
buildspec: .codebuild/run_e2e_tests.yml
150150
env:
151151
compute-type: BUILD_GENERAL1_LARGE
152152
variables:
153153
TEST_SUITE: >-
154-
src/__tests__/build-app-ts.test.ts|src/__tests__/push-codegen-admin-modelgen.test.ts|src/__tests__/uninitialized-project-codegen-js.test.ts|src/__tests__/uninitialized-project-modelgen-android.test.ts
154+
src/__tests__/build-app-ts.test.ts|src/__tests__/graphql-generator-app.test.ts|src/__tests__/push-codegen-admin-modelgen.test.ts|src/__tests__/uninitialized-project-codegen-js.test.ts
155155
CLI_REGION: ap-southeast-1
156156
DISABLE_ESLINT_PLUGIN: true
157157
depend-on:
158158
- publish_to_local_registry
159159
- identifier: >-
160-
l_uninitialized_project_modelgen_flutter_uninitialized_project_modelgen_ios_uninitialized_project_modelgen_js
160+
l_uninitialized_project_modelgen_android_uninitialized_project_modelgen_flutter_uninitialized_project_modelgen_ios_uninitialize
161161
buildspec: .codebuild/run_e2e_tests.yml
162162
env:
163163
compute-type: BUILD_GENERAL1_LARGE
164164
variables:
165165
TEST_SUITE: >-
166-
src/__tests__/uninitialized-project-modelgen-flutter.test.ts|src/__tests__/uninitialized-project-modelgen-ios.test.ts|src/__tests__/uninitialized-project-modelgen-js.test.ts
166+
src/__tests__/uninitialized-project-modelgen-android.test.ts|src/__tests__/uninitialized-project-modelgen-flutter.test.ts|src/__tests__/uninitialized-project-modelgen-ios.test.ts|src/__tests__/uninitialized-project-modelgen-js.test.ts
167167
CLI_REGION: ap-southeast-2
168168
depend-on:
169169
- publish_to_local_registry
@@ -252,30 +252,30 @@ batch:
252252
- publish_to_local_registry
253253
- build_windows
254254
- identifier: >-
255-
w_build_app_ts_push_codegen_admin_modelgen_uninitialized_project_codegen_js_uninitialized_project_modelgen_android
255+
w_build_app_ts_graphql_generator_app_push_codegen_admin_modelgen_uninitialized_project_codegen_js
256256
buildspec: .codebuild/run_e2e_tests_windows.yml
257257
env:
258258
compute-type: BUILD_GENERAL1_LARGE
259259
image: $WINDOWS_IMAGE_2019
260260
type: WINDOWS_SERVER_2019_CONTAINER
261261
variables:
262262
TEST_SUITE: >-
263-
src/__tests__/build-app-ts.test.ts|src/__tests__/push-codegen-admin-modelgen.test.ts|src/__tests__/uninitialized-project-codegen-js.test.ts|src/__tests__/uninitialized-project-modelgen-android.test.ts
263+
src/__tests__/build-app-ts.test.ts|src/__tests__/graphql-generator-app.test.ts|src/__tests__/push-codegen-admin-modelgen.test.ts|src/__tests__/uninitialized-project-codegen-js.test.ts
264264
CLI_REGION: us-east-1
265265
DISABLE_ESLINT_PLUGIN: true
266266
depend-on:
267267
- publish_to_local_registry
268268
- build_windows
269269
- identifier: >-
270-
w_uninitialized_project_modelgen_flutter_uninitialized_project_modelgen_ios_uninitialized_project_modelgen_js
270+
w_uninitialized_project_modelgen_android_uninitialized_project_modelgen_flutter_uninitialized_project_modelgen_ios_uninitialize
271271
buildspec: .codebuild/run_e2e_tests_windows.yml
272272
env:
273273
compute-type: BUILD_GENERAL1_LARGE
274274
image: $WINDOWS_IMAGE_2019
275275
type: WINDOWS_SERVER_2019_CONTAINER
276276
variables:
277277
TEST_SUITE: >-
278-
src/__tests__/uninitialized-project-modelgen-flutter.test.ts|src/__tests__/uninitialized-project-modelgen-ios.test.ts|src/__tests__/uninitialized-project-modelgen-js.test.ts
278+
src/__tests__/uninitialized-project-modelgen-android.test.ts|src/__tests__/uninitialized-project-modelgen-flutter.test.ts|src/__tests__/uninitialized-project-modelgen-ios.test.ts|src/__tests__/uninitialized-project-modelgen-js.test.ts
279279
CLI_REGION: us-east-1
280280
depend-on:
281281
- publish_to_local_registry
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { DEFAULT_JS_CONFIG, craInstall, craBuild, cypressRun, isWindows } from '@aws-amplify/amplify-codegen-e2e-core';
2+
import path from 'path';
3+
4+
describe('GraphQL documents generator e2e tests', () => {
5+
let apiName: string;
6+
const projectRoot = path.resolve('test-apps', 'graphql-generator-app');
7+
const config = DEFAULT_JS_CONFIG;
8+
9+
beforeAll(async () => {
10+
await craInstall(projectRoot, { ...config });
11+
});
12+
13+
// skip cypress test on windows
14+
(isWindows() ? it.skip : it)('graphql generator does not crash in browser', async () => {
15+
await cypressRun(projectRoot, { componentsTesting: true });
16+
});
17+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
13+
14+
The page will reload if you make edits.\
15+
You will also see any lint errors in the console.
16+
17+
### `npm test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `npm run build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `npm run eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
35+
36+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37+
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
39+
40+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const path = require('path');
2+
const webpack = require('webpack');
3+
4+
module.exports = function override(config) {
5+
const alias = config.resolve.alias || {};
6+
Object.assign(alias, {
7+
'fs-extra': path.resolve(__dirname, 'src/polyfills/fs-extra.js'),
8+
});
9+
config.resolve.alias = alias;
10+
const fallback = config.resolve.fallback || {};
11+
Object.assign(fallback, {
12+
path: require.resolve('path-browserify'),
13+
os: require.resolve('os-browserify/browser'),
14+
stream: require.resolve('stream-browserify'),
15+
crypto: require.resolve('crypto-browserify'),
16+
assert: require.resolve('assert'),
17+
'fs-extra': false,
18+
vm: false,
19+
fs: false,
20+
module: false,
21+
constants: false,
22+
});
23+
config.resolve.fallback = fallback;
24+
config.plugins = (config.plugins || []).concat([
25+
new webpack.ProvidePlugin({
26+
Buffer: ['buffer', 'Buffer'],
27+
}),
28+
new webpack.ProvidePlugin({
29+
process: 'process/browser',
30+
}),
31+
new webpack.ProvidePlugin({
32+
'process.hrtime': [path.resolve(__dirname, 'src/polyfills/process-shim.js'), 'default'],
33+
}),
34+
]);
35+
config.ignoreWarnings = [/Failed to parse source map/];
36+
config.module.rules.push({
37+
test: /\.(js|mjs|jsx)$/,
38+
enforce: 'pre',
39+
loader: require.resolve('source-map-loader'),
40+
resolve: {
41+
fullySpecified: false,
42+
},
43+
});
44+
return config;
45+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { defineConfig } from 'cypress';
2+
3+
process.env.NODE_ENV = 'test';
4+
process.env.BABEL_ENV = 'test';
5+
require('react-app-rewired/config/webpack.config')('development');
6+
export default defineConfig({
7+
component: {
8+
devServer: {
9+
framework: 'create-react-app',
10+
bundler: 'webpack',
11+
},
12+
},
13+
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="cypress" />
2+
// This file needs to exist for cypress tests to function
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<title>Components App</title>
8+
</head>
9+
<body>
10+
<div data-cy-root></div>
11+
</body>
12+
</html>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// ***********************************************************
2+
// This example support/component.ts is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')
21+
22+
import { mount } from 'cypress/react18'
23+
24+
// Augment the Cypress namespace to include type definitions for
25+
// your custom command.
26+
// Alternatively, can be defined in cypress/support/component.d.ts
27+
// with a <reference path="./component" /> at the top of your spec.
28+
declare global {
29+
namespace Cypress {
30+
interface Chainable {
31+
mount: typeof mount
32+
}
33+
}
34+
}
35+
36+
Cypress.Commands.add('mount', mount)
37+
38+
// Example use:
39+
// cy.mount(<MyComponent />)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "graphql-generator-app",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@aws-amplify/appsync-modelgen-plugin": "file:../../../appsync-modelgen-plugin",
7+
"@aws-amplify/graphql-generator": "file:../../../graphql-generator",
8+
"@testing-library/jest-dom": "^5.17.0",
9+
"@testing-library/react": "^13.4.0",
10+
"@testing-library/user-event": "^13.5.0",
11+
"@types/jest": "^27.5.2",
12+
"@types/node": "^16.18.91",
13+
"@types/react": "^18.2.67",
14+
"@types/react-dom": "^18.2.22",
15+
"assert": "^2.1.0",
16+
"crypto-browserify": "^3.12.0",
17+
"os-browserify": "^0.3.0",
18+
"path-browserify": "^1.0.1",
19+
"process": "^0.11.10",
20+
"react": "^18.2.0",
21+
"react-dom": "^18.2.0",
22+
"react-scripts": "5.0.1",
23+
"typescript": "^4.9.5",
24+
"web-vitals": "^2.1.4"
25+
},
26+
"scripts": {
27+
"start": "react-app-rewired start",
28+
"build": "react-app-rewired build",
29+
"test": "react-app-rewired test",
30+
"eject": "react-scripts eject"
31+
},
32+
"eslintConfig": {
33+
"extends": [
34+
"react-app",
35+
"react-app/jest"
36+
]
37+
},
38+
"browserslist": {
39+
"production": [
40+
">0.2%",
41+
"not dead",
42+
"not op_mini all"
43+
],
44+
"development": [
45+
"last 1 chrome version",
46+
"last 1 firefox version",
47+
"last 1 safari version"
48+
]
49+
},
50+
"devDependencies": {
51+
"cypress": "^13.7.1",
52+
"react-app-rewired": "^2.2.1"
53+
}
54+
}

0 commit comments

Comments
 (0)