Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(build system): add React tests for loadtest #3703

Merged
merged 111 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from 99 commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
8496a72
test(build system):setup env
0618 Mar 22, 2023
3f0cc3a
test(build system): add cra-template-react-js
0618 Mar 22, 2023
b098755
test(build system): add script/create-react-app
0618 Mar 22, 2023
49b2395
test(build system): add script/create-react-app args
0618 Mar 22, 2023
ae82631
test(build system): create template folder
0618 Mar 22, 2023
de53be0
test(build system): create template components
0618 Mar 22, 2023
3d00368
test(build system): mega-apps folder
0618 Mar 22, 2023
94265c3
test(build system): add react-16-cra-5-js
0618 Mar 22, 2023
5bf4ae3
test(build system): dynamically create react16 and 18 js
0618 Mar 22, 2023
c3c4504
test(build system): refactor create-react-app script
0618 Mar 22, 2023
ee45b9c
test(build system): create-react-app to create react 16 ts
0618 Mar 23, 2023
aa60f6f
test(build system): rename cra-template-react
0618 Mar 23, 2023
a487d7b
test(build system): cleanup template/src
0618 Mar 23, 2023
549a6fb
test(build system): create mega-apps folder
0618 Mar 23, 2023
5fef867
test(build system): rename pkgManager
0618 Mar 24, 2023
4a7a938
PoC: add mega app canary workflow
0618 Mar 24, 2023
8cefbb6
PoC: add mega app canary workflow trigger
0618 Mar 24, 2023
1a0f1cf
revert to build-and-runtime-test
0618 Mar 24, 2023
1bdddf0
use personal amplify app
0618 Mar 24, 2023
6873c9b
use personal amplify app
0618 Mar 25, 2023
537095f
use personal amplify app
0618 Mar 25, 2023
37ec22a
change mega-apps-test trigger by push
0618 Mar 25, 2023
46863a2
change amplify pull envName
0618 Mar 25, 2023
f32b9eb
remove unnecessary steps
0618 Mar 25, 2023
a0b5b1d
try building mega-app
0618 Mar 25, 2023
c4794d5
fix amplify pull
0618 Mar 25, 2023
0ea4f84
install esbuild-register
0618 Mar 25, 2023
aef0207
install esbuild-register
0618 Mar 25, 2023
a22fb8f
fix working-dir
0618 Mar 25, 2023
d0c9ba5
log current dir
0618 Mar 25, 2023
c2ec45f
log dir
0618 Mar 25, 2023
069a5ec
add pull env script
0618 Mar 27, 2023
9b9d571
fix pull env script
0618 Mar 27, 2023
ea4ab4a
add create-react-app
0618 Mar 27, 2023
9a7e5ce
throw cra err
0618 Mar 27, 2023
688f6f9
set TS version to 4
0618 Mar 27, 2023
9e2ec8e
add all cra apps
0618 Mar 27, 2023
d68287f
fix stderr
0618 Mar 27, 2023
bb48084
make nodeJS and npm/yarn dynamic
0618 Mar 28, 2023
55471b5
add node and package params
0618 Mar 28, 2023
41d10cf
use multi-dimension matrix
0618 Mar 28, 2023
8fd7bee
fix matrix
0618 Mar 28, 2023
d450b3f
react use include
0618 Mar 28, 2023
c5ea445
Revert "react use include"
0618 Mar 28, 2023
5b5fbe7
rename mega-app-tests to mega-app-tests-cra
0618 Mar 28, 2023
8e1f6f4
test(build system): use default CRA
0618 Apr 4, 2023
a6314ce
test(build system): use default CRA fix working-dir
0618 Apr 4, 2023
8503afc
test(build system): add MEGA_APP_NAME and ts
0618 Apr 4, 2023
64f973e
test(build system): add ts and 16
0618 Apr 4, 2023
e7ae2d8
test(build system): add react 16
0618 Apr 4, 2023
63be58b
test(build system): fix typescript
0618 Apr 4, 2023
add5e00
test(build system): fix typescript
0618 Apr 4, 2023
3603565
test(build system): change 18 to latest and remove App.tsx
0618 Apr 4, 2023
dfbc9ee
test(build system): add GH workflow matrix include to reduce the numb…
0618 Apr 4, 2023
2ad6fe9
test(build system): add mega-app name to step
0618 Apr 4, 2023
aab93af
test(build system): clean up cra template
0618 Apr 4, 2023
16b9809
test(build system): add account-setting component
0618 Apr 4, 2023
601d138
test(build system): add next11 megaapp
0618 Apr 4, 2023
e149c7b
test(build system): move CRA toGH matrix include
0618 Apr 4, 2023
825084e
test(build system): add next
0618 Apr 5, 2023
483007a
test(build system): add next latest mega-app
0618 Apr 6, 2023
a95adab
test(build system): add next 11 mega-app
0618 Apr 6, 2023
6222e9c
test(build system): add next 11 mega-app exclude node 18
0618 Apr 6, 2023
89169e4
test(build system): fix gatsby
0618 Apr 6, 2023
8af6262
test(build system): add vite latest mega-app
0618 Apr 7, 2023
eaeca4e
test(build system): add vite 2 mega-app
0618 Apr 7, 2023
40e1ea6
test(build system): rename mega-app-tests workflow and cleanup
0618 Apr 7, 2023
4498428
test(build system): cleanup custom template script
0618 Apr 7, 2023
9d008c6
test(build system): add node version to app names
0618 Apr 7, 2023
346309b
test(build system): remove react-16-cra-5-node-16-ts
0618 Apr 7, 2023
2ce99b8
test(build system): remove environment
0618 Apr 11, 2023
40a4c96
test(build system): add storageManager and deleteUser
0618 Apr 11, 2023
d890948
test(build system): set yarn version
0618 Apr 11, 2023
e1d6e90
test(build system): remove pkg.json and yarn.lock
0618 Apr 11, 2023
2ffed94
test(build system): add gatsby comment
0618 Apr 11, 2023
bb82b25
test(build system): run test every 15 min
0618 Apr 10, 2023
ba89b5d
test(build system): rename build system
0618 Apr 10, 2023
9c1f0f6
test(build system): add comments
0618 Apr 11, 2023
57f96fd
test(build system): revert canary package.json
0618 Apr 11, 2023
a18e62f
test(build system): GH workflow action use commit hash
0618 Apr 11, 2023
bf0c576
Merge branch 'mega-app-canary' into mega-app-canary-react
0618 Apr 11, 2023
5b6bd75
test(build system): change schecule time
0618 Apr 11, 2023
818a822
Update .github/workflows/build-system-test-react.yml
0618 Apr 11, 2023
6813234
test(build system): change GH workflow hash, next pkg template
0618 Apr 11, 2023
f58003a
test(build system): remove handleSuccess
0618 Apr 11, 2023
f7b85b2
Merge branch 'mega-app-canary' into mega-app-canary-react
0618 Apr 11, 2023
28e260a
test(build system): add create-mega-app script
0618 Apr 12, 2023
5980a04
test(build system): add copy-mega-app-files script
0618 Apr 12, 2023
e0030b6
test(build system): add install and build script
0618 Apr 12, 2023
5f8f02b
Merge branch 'mega-app-canary' into mega-app-canary-react
0618 Apr 12, 2023
df2f057
test(build system): change shell formatter
0618 Apr 12, 2023
3b8c871
test(build system): add comments and misc changes
0618 Apr 12, 2023
e8516b7
test(build system): remove gatsby
0618 Apr 12, 2023
ce15ddf
Merge branch 'mega-app-canary' into mega-app-canary-react
0618 Apr 12, 2023
d977d5c
test(build system): set yarn version to 1
0618 Apr 12, 2023
42fbf13
Merge branch 'mega-app-canary' into mega-app-canary-react
0618 Apr 12, 2023
00f3cc2
test(build system): move build-tools to matrix
0618 Apr 12, 2023
6848a58
Merge branch 'mega-app-canary' into mega-app-canary-react
0618 Apr 12, 2023
445a021
Merge branch 'main' into mega-app-canary-react
0618 Apr 12, 2023
9c6662a
test(build system): add angular app and template
0618 Apr 13, 2023
44b2e08
test(build system): remove install-with-retries
0618 Apr 13, 2023
86ea30a
Merge branch 'mega-app-canary' into mega-app-canary-react
0618 Apr 13, 2023
16b8f00
Merge branch 'main' into mega-app-canary-react
0618 Apr 13, 2023
578fbea
Revert "test(build system): add angular app and template"
0618 Apr 13, 2023
223e7a2
test(build system): fix install build build-tool-version
0618 Apr 14, 2023
4433be9
test(build system): fix install-build path
0618 Apr 14, 2023
ac7253d
test(build system): echo log
0618 Apr 15, 2023
49ddde9
test(build system): reaname build system test
0618 Apr 17, 2023
8a10691
test(build system): add merge to main trigger
0618 Apr 18, 2023
6a010a1
test(build system): log data to BuildSystemTestFailure metric
0618 Apr 18, 2023
35a17df
Merge branch 'main' into mega-app-canary-react
0618 Apr 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/scripts/mega-app-copy-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

cd build-system-tests
if [ "$BUILD_TOOL" == 'cra' ]; then
cp templates/template-aws-exports.js mega-apps/${MEGA_APP_NAME}/src/aws-exports.js
if [ "$LANGUAGE" == 'js' ]; then
cp templates/components/react/cra/App.js mega-apps/${MEGA_APP_NAME}/src/App.js
else
cp templates/components/react/cra/App.js mega-apps/${MEGA_APP_NAME}/src/App.tsx
if [ "$FRAMEWORK_VERSION" == '16' ]; then
# We have to customize the index.tsx file for React 16 because the render API changed since React 18.
# See more: https://legacy.reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html
cp templates/components/react/cra/index-react-${FRAMEWORK_VERSION}.js mega-apps/${MEGA_APP_NAME}/src/index.tsx
wlee221 marked this conversation as resolved.
Show resolved Hide resolved
fi
fi
fi

if [ "$BUILD_TOOL" == 'next' ]; then
mkdir mega-apps/${MEGA_APP_NAME}/data
cp templates/template-aws-exports.js mega-apps/${MEGA_APP_NAME}/data/aws-exports.js
cp templates/components/react/next/App.js mega-apps/${MEGA_APP_NAME}/pages/index.tsx
if [ "$BUILD_TOOL_VERSION" == '11' ]; then
# We have to customize the package.json and tsconfig.json for Next.js 11,
# because create-next-app only creates the app with the latest version
cp templates/components/react/next/template-package-${BUILD_TOOL_VERSION}.json mega-apps/${MEGA_APP_NAME}/package.json
cp templates/components/react/next/template-tsconfig-${BUILD_TOOL_VERSION}.json mega-apps/${MEGA_APP_NAME}/tsconfig.json
fi
fi

if [ "$BUILD_TOOL" == 'vite' ]; then
cp templates/template-aws-exports.js mega-apps/${MEGA_APP_NAME}/src/aws-exports.js
cp templates/components/react/cra/App.js mega-apps/${MEGA_APP_NAME}/src/App.tsx
cp templates/components/react/vite/index.html mega-apps/${MEGA_APP_NAME}/index.html
cp templates/components/react/vite/template-tsconfig.json mega-apps/${MEGA_APP_NAME}/tsconfig.json
cp templates/components/react/vite/vite.config.ts mega-apps/${MEGA_APP_NAME}/vite.config.ts
fi
21 changes: 21 additions & 0 deletions .github/scripts/mega-app-create-app.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

cd build-system-tests
mkdir -p mega-apps/
cd mega-apps

if [[ "$BUILD_TOOL" == 'cra' && "$LANGUAGE" == 'js' ]]; then
npx create-react-app ${MEGA_APP_NAME}
fi

if [[ "$BUILD_TOOL" == 'cra' && "$LANGUAGE" == 'ts' ]]; then
npx create-react-app ${MEGA_APP_NAME} --template typescript
fi

if [ "$BUILD_TOOL" == 'next' ]; then
npx create-next-app ${MEGA_APP_NAME} --ts --no-src-dir --no-experimental-app --no-eslint
fi

if [ "$BUILD_TOOL" == 'vite' ]; then
npm create vite@${BUILD_TOOL_VERSION} $MEGA_APP_NAME -- --template react-ts
fi
29 changes: 29 additions & 0 deletions .github/scripts/mega-app-install-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

cd build-system-tests/mega-apps/${MEGA_APP_NAME}
if [ "$PKG_MANAGER" == 'yarn' ]; then
echo "yarn version"
yarn -v
echo "yarn set version $PKG_MANAGER_VERSION"
yarn set version $PKG_MANAGER_VERSION
echo "yarn version"
yarn -v
if [[ "$BUILD_TOOL" == 'cra' && "$LANGUAGE" == 'ts' ]]; then
yarn add $DEP_TYPES
fi
yarn add $DEPENDENCIES
yarn build
else
if [[ "$BUILD_TOOL" == 'cra' && "$LANGUAGE" == 'ts' ]]; then
# If not testing the latest React, we need to download its types.
# CRA is the only framework that we test React 16.
npm install $DEP_TYPES
fi
if [[ "$BUILD_TOOL" == 'next' && "$LANGUAGE" == '11' ]]; then
# We have to remove the initial downloaded node_modules for Next.js 11,
# because create-next-app only creates the app with the latest version
rm -rf node_modules
fi
npm install $DEPENDENCIES
npm run build
fi
116 changes: 116 additions & 0 deletions .github/workflows/build-system-test-react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Description: this workflow runs build mega-apps that have all the connected components.

name: Build System Test Canary - React

on:
schedule:
- cron: '*/15 * * * *' # Run every 15 minutes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't run every 15 minutes since it's not merged to the default branch (main) yet. (doc)


jobs:
build:
runs-on: ubuntu-latest
environment: ci
strategy:
fail-fast: false
matrix:
framework: [react]
framework-version: [latest]
build-tool: [cra, next, vite]
build-tool-version: [latest]
pkg-manager: [npm]
language: [ts]
node-version: [18]
include:
- framework: react
framework-version: latest
build-tool: cra
build-tool-version: latest
pkg-manager: npm
language: ts
node-version: 16
- framework: react
framework-version: 16
build-tool: cra
build-tool-version: latest
pkg-manager: npm
language: ts
node-version: 18
- framework: react
framework-version: latest
build-tool: cra
build-tool-version: latest
pkg-manager: npm
language: js
node-version: 18
- framework: react
framework-version: latest
build-tool: cra
build-tool-version: latest
pkg-manager: yarn
pkg-manager-version: 1
language: ts
node-version: 18
- framework: react
framework-version: 17
build-tool: next
build-tool-version: 11
pkg-manager: npm
language: ts
node-version: 16
- framework: react
framework-version: latest
build-tool: vite
build-tool-version: 2
pkg-manager: npm
language: ts
node-version: 18

env:
MEGA_APP_NAME: ${{ matrix.framework }}-${{ matrix.framework-version }}-${{ matrix.build-tool }}-${{ matrix.build-tool-version }}-node-${{ matrix.node-version }}-${{ matrix.language }}
DEPENDENCIES: react@${{ matrix.framework-version }} react-dom@${{ matrix.framework-version }} @aws-amplify/ui-react aws-amplify @aws-amplify/ui-react-storage
DEP_TYPES: '@types/react@${{ matrix.framework-version }} @types/react-dom@${{ matrix.framework-version }}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love the simplification here!


steps:
- name: Checkout Amplify UI
uses: actions/checkout@24cb9080177205b6e8c946b17badbe402adc938f # v3.4.0 https://github.com/actions/checkout/commit/24cb9080177205b6e8c946b17badbe402adc938f
with:
persist-credentials: false
- name: Setup Node.js ${{ matrix.node-version }} with ${{ matrix.pkg-manager }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 https://github.com/actions/setup-node/commit/64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: ${{ matrix.node-version }}
cache: ${{ matrix.pkg-manager }}
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2
- name: Install build-system-tests package
uses: ./.github/actions/install-with-retries
with:
working-directory: ./build-system-tests
- name: Create MegaApp ${{ env.MEGA_APP_NAME }}
run: ./.github/scripts/mega-app-create-app.sh
shell: bash
env:
BUILD_TOOL: ${{ matrix.build-tool }}
LANGUAGE: ${{ matrix.language }}
MEGA_APP_NAME: ${{ env.MEGA_APP_NAME }}
BUILD_TOOL_VERSION: ${{ matrix.build-tool-version }}
- name: Copy aws_export and App.js
run: ./.github/scripts/mega-app-copy-files.sh
shell: bash
env:
BUILD_TOOL: ${{ matrix.build-tool }}
LANGUAGE: ${{ matrix.language }}
MEGA_APP_NAME: ${{ env.MEGA_APP_NAME }}
BUILD_TOOL_VERSION: ${{ matrix.build-tool-version }}
FRAMEWORK_VERSION: ${{ matrix.framework-version }}
- name: Install Packages and Build
run: ./.github/scripts/mega-app-copy-files.sh
shell: bash
env:
BUILD_TOOL: ${{ matrix.build-tool }}
LANGUAGE: ${{ matrix.language }}
MEGA_APP_NAME: ${{ env.MEGA_APP_NAME }}
PKG_MANAGER: ${{ matrix.pkg-manager }}
PKG_MANAGER_VERSION: ${{ matrix.pkg-manager-version }}
DEPENDENCIES: ${{ env.DEPENDENCIES }}
DEP_TYPES: ${{ env.DEP_TYPES }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, we'll have to set up CW alarms against this test -- when do you expect to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good point...Let me cut a ticket for that

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"typescript.tsdk": "node_modules/typescript/lib",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
}
}
1 change: 1 addition & 0 deletions build-system-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mega-apps
51 changes: 51 additions & 0 deletions build-system-tests/templates/components/react/cra/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useEffect } from 'react';
import { Amplify, Notifications } from 'aws-amplify';
import {
AccountSettings,
Authenticator,
FileUploader,
MapView,
Text,
InAppMessagingProvider,
InAppMessageDisplay,
} from '@aws-amplify/ui-react';
import { StorageManager } from '@aws-amplify/ui-react-storage';
import '@aws-amplify/ui-react/styles.css';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);

const { InAppMessaging } = Notifications;

export default function Home() {
useEffect(() => {
// sync remote in-app messages
InAppMessaging.syncMessages();
}, []);

return (
<>
<InAppMessagingProvider>
<InAppMessageDisplay />
<Text>In-App Messaging Example</Text>
</InAppMessagingProvider>
<FileUploader acceptedFileTypes={['image/*']} accessLevel="public" />
<Authenticator>
{({ signOut, user = { username: '' } }) => (
<main>
<h1>Hello {user.username}</h1>
Comment on lines +33 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

Suggested change
{({ signOut, user = { username: '' } }) => (
<main>
<h1>Hello {user.username}</h1>
{({ signOut, user }) => (
<main>
<h1>Hello {user.username}</h1>

to mimic our documentation code?

Copy link
Contributor

@wlee221 wlee221 Apr 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or user?.username if above isn't TS strict compliant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our docs would have a type error. We have to either set a default value or add a question mark like user?.username 😂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a question mark for now. Let's add a ticket for updating our docs for TS strict customers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 3f68159

<button onClick={signOut}>Sign out</button>
</main>
)}
</Authenticator>
<AccountSettings.ChangePassword onSuccess={() => {}} />
<AccountSettings.DeleteUser onSuccess={() => {}} />
<StorageManager
acceptedFileTypes={['image/*']}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, but spacing seems off. Can you run prettier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 3f68159

accessLevel="public"
maxFileCount={1}
isResumable
/>
<MapView />
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-nocheck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is @ts-nocheck necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise there would be a lot of red marks in VS Code.

That might be a good point. Would that prevent some necessary build failures if there's any TS issue?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we're interested in catching TS errors, let's remove it.

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
51 changes: 51 additions & 0 deletions build-system-tests/templates/components/react/next/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import React, { useEffect } from 'react';
import { Amplify, Notifications } from 'aws-amplify';
import {
AccountSettings,
Authenticator,
FileUploader,
MapView,
Text,
InAppMessagingProvider,
InAppMessageDisplay,
} from '@aws-amplify/ui-react';
import { StorageManager } from '@aws-amplify/ui-react-storage';
import '@aws-amplify/ui-react/styles.css';
import awsconfig from '@/data/aws-exports';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use relative path instead of @/?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@/ was from the auto-generated config. Since we try to mimic the users behavior, it might be better not change it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, not blocking then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with leaving tsconfig as-is then, but let's use relative path in the import statement, since that's what we use in docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good catch. The newer version of Next.js auto generated the relative path as default, so I kept it here

Amplify.configure(awsconfig);

const { InAppMessaging } = Notifications;

export default function Home() {
useEffect(() => {
// sync remote in-app messages
InAppMessaging.syncMessages();
}, []);

return (
<>
<InAppMessagingProvider>
<InAppMessageDisplay />
<Text>In-App Messaging Example</Text>
</InAppMessagingProvider>
<FileUploader acceptedFileTypes={['image/*']} accessLevel="public" />
<Authenticator>
{({ signOut, user = { username: '' } }) => (
<main>
<h1>Hello {user.username}</h1>
<button onClick={signOut}>Sign out</button>
</main>
)}
</Authenticator>
<AccountSettings.ChangePassword onSuccess={() => {}} />
<AccountSettings.DeleteUser onSuccess={() => {}} />
<StorageManager
acceptedFileTypes={['image/*']}
accessLevel="public"
maxFileCount={1}
isResumable
/>
<MapView />
</>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "react-17-next-11-ts",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@types/node": "^15.12.4",
"@types/react": "17.0.47",
"@types/react-dom": "17",
"next": "^11.1.3",
"react": "17",
"react-dom": "17",
"typescript": "5.0.3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is typescript meant to be pinned?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I'll test and address it in the real PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 3f68159

}
}
Loading