Skip to content

Task 2 #554

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
41 changes: 28 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
# Logs
logs
# ───── Node.js General ─────
node_modules/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.serverless
coverage
dist
dist-ssr
*.local
# ───── TypeScript / JavaScript ─────
*.js
!jest.config.js
*.d.ts

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
# ───── Build / Coverage ─────
dist/
dist-ssr/
build/
coverage/
cdk.out/
.cdk.staging/
.serverless/

# ───── Environment / Local / Temp ─────
*.local
.env
.env.*
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
package-lock.json
# ───── IDEs and Editors ─────
.vscode/
!.vscode/extensions.json
.idea/
.DS_Store

# ───── OS Artifacts ─────
Thumbs.db
72 changes: 2 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,3 @@
# React-shop-cloudfront
CloudFront distribution domain name=https://d38ux1ekhnj0rd.cloudfront.net

This is frontend starter project for nodejs-aws mentoring program. It uses the following technologies:

- [Vite](https://vitejs.dev/) as a project bundler
- [React](https://beta.reactjs.org/) as a frontend framework
- [React-router-dom](https://reactrouterdotcom.fly.dev/) as a routing library
- [MUI](https://mui.com/) as a UI framework
- [React-query](https://react-query-v3.tanstack.com/) as a data fetching library
- [Formik](https://formik.org/) as a form library
- [Yup](https://github.com/jquense/yup) as a validation schema
- [Serverless](https://serverless.com/) as a serverless framework
- [Vitest](https://vitest.dev/) as a test runner
- [MSW](https://mswjs.io/) as an API mocking library
- [Eslint](https://eslint.org/) as a code linting tool
- [Prettier](https://prettier.io/) as a code formatting tool
- [TypeScript](https://www.typescriptlang.org/) as a type checking tool

## Available Scripts

### `start`

Starts the project in dev mode with mocked API on local environment.

### `build`

Builds the project for production in `dist` folder.

### `preview`

Starts the project in production mode on local environment.

### `test`, `test:ui`, `test:coverage`

Runs tests in console, in browser or with coverage.

### `lint`, `prettier`

Runs linting and formatting for all files in `src` folder.

### `client:deploy`, `client:deploy:nc`

Deploy the project build from `dist` folder to configured in `serverless.yml` AWS S3 bucket with or without confirmation.

### `client:build:deploy`, `client:build:deploy:nc`

Combination of `build` and `client:deploy` commands with or without confirmation.

### `cloudfront:setup`

Deploy configured in `serverless.yml` stack via CloudFormation.

### `cloudfront:domainInfo`

Display cloudfront domain information in console.

### `cloudfront:invalidateCache`

Invalidate cloudfront cache.

### `cloudfront:build:deploy`, `cloudfront:build:deploy:nc`

Combination of `client:build:deploy` and `cloudfront:invalidateCache` commands with or without confirmation.

### `cloudfront:update:build:deploy`, `cloudfront:update:build:deploy:nc`

Combination of `cloudfront:setup` and `cloudfront:build:deploy` commands with or without confirmation.

### `serverless:remove`

Remove an entire stack configured in `serverless.yml` via CloudFormation.
index.html Object URL= https://deploywebappstack-deploymentfrontendbucket67ceb713-tujnl4btndol.s3.us-east-1.amazonaws.com/index.html
26 changes: 26 additions & 0 deletions frontend/.__gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.serverless
coverage
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
File renamed without changes.
File renamed without changes.
File renamed without changes.
73 changes: 73 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"name": "my-store-app",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "vite",
"build": "tsc && vite build",
"preview": "npm run build && vite preview",
"test": "vitest",
"test:ui": "vitest --ui",
"test:coverage": "vitest run --coverage",
"lint": "eslint --ignore-path .gitignore --fix src",
"prettier": "prettier src --write",
"client:deploy": "sls client deploy --no-config-change --no-policy-change --no-cors-change",
"client:deploy:nc": "npm run client:deploy -- --no-confirm",
"client:build:deploy": "npm run build && npm run client:deploy",
"client:build:deploy:nc": "npm run build && npm run client:deploy:nc",
"cloudfront:setup": "sls deploy",
"cloudfront:domainInfo": "sls domainInfo",
"cloudfront:invalidateCache": "sls invalidateCloudFrontCache",
"cloudfront:build:deploy": "npm run client:build:deploy && npm run cloudfront:invalidateCache",
"cloudfront:build:deploy:nc": "npm run client:build:deploy:nc && npm run cloudfront:invalidateCache",
"cloudfront:update:build:deploy": "npm run cloudfront:setup && npm run cloudfront:build:deploy",
"cloudfront:update:build:deploy:nc": "npm run cloudfront:setup && npm run cloudfront:build:deploy:nc",
"serverless:remove": "sls remove"
},
"dependencies": {
"@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3",
"@mui/icons-material": "^5.8.4",
"@mui/material": "^5.8.7",
"@mui/styles": "^5.8.7",
"@types/yup": "^0.29.14",
"axios": "^0.27.2",
"formik": "^2.2.9",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-query": "^3.39.1",
"react-router-dom": "^6.3.0",
"yup": "^0.32.11"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.2.1",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"@vitejs/plugin-react": "^1.3.2",
"@vitest/ui": "^0.18.0",
"c8": "^7.11.3",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"jsdom": "^20.0.0",
"msw": "^0.43.1",
"prettier": "2.7.1",
"serverless": "^3.20.0",
"serverless-finch": "^4.0.0",
"serverless-s3-cleaner": "^2.0.1",
"typescript": "^4.7.4",
"vite": "^2.9.13",
"vitest": "^0.17.1"
},
"msw": {
"workerDirectory": "public"
},
"engines": {
"node": ">=14.0.0"
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion serverless.yml → frontend/serverless.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service: my-store-app
service: my-toy-store-app

frameworkVersion: "3"

Expand Down
Binary file added frontend/src/assets/images/banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/images/banner__.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Link from "@mui/material/Link";
import Container from "@mui/material/Container";
import Header from "~/components/MainLayout/components/Header";
import Box from "@mui/material/Box";
import Banner from "../../assets/images/banner.jpg";

function Copyright() {
return (
Expand All @@ -24,6 +25,10 @@ const MainLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
<Header />
<main>
<Container sx={{ pb: 8 }} maxWidth="md">
<div style={{ textAlign: "center" }}>
{" "}
<img src={Banner} alt="image" />
</div>
{children}
</Container>
</main>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function Header() {
underline="none"
to="/"
>
My Store!
My Toys Store!
</Link>
</Typography>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions infra/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.js
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
cdk.out
6 changes: 6 additions & 0 deletions infra/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
Loading