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

Task3.0 prepare.1 #12

Merged
merged 3 commits into from
Oct 17, 2022
Merged
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
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

15 changes: 7 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
echo "NPM_DIR=$(npm config get cache)" >> $GITHUB_ENV
- uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
path: ${{ env.NPM_DIR }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
Expand All @@ -43,11 +43,10 @@ jobs:
run: |
# slugify branch ref
slug=$(echo ${{ github.event.pull_request.head.ref || 'stg' }} | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9]+/-/g' | sed -E 's/^-+\|-+$//g')
body="$(npm run deploy -- --stage $slug 2>&1)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=result::$body"
npm run deploy -- --stage $slug
echo 'COMMENT_BODY<<EOF' >> $GITHUB_ENV
cat ./.serverless/compose.log >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Find Comment
uses: peter-evans/find-comment@v2
if: ${{ github.event_name == 'pull_request' }}
Expand All @@ -65,5 +64,5 @@ jobs:
issue-number: ${{ github.event.pull_request.number }}
body: |
Build output
${{ steps.deploy.outputs.result }}
${{ env.COMMENT_BODY }}
edit-mode: replace
1 change: 1 addition & 0 deletions commons/constants/api-paths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const PRODUCTS_API_PATH = "products";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { OrderStatus } from "~/constants/order";
import { CartItem } from "~/models/CartItem";
import { Order } from "~/models/Order";
import { AvailableProduct, Product } from "~/models/Product";
import { OrderStatus } from "../models/Order";
import { CartItem } from "../models/CartItem";
import { Order } from "../models/Order";
import { AvailableProduct, Product } from "../models/Product";

export const products: Product[] = [
{
Expand All @@ -24,7 +24,7 @@ export const products: Product[] = [
},
{
description: "Short Product Description4",
id: "7567ec4b-b10c-48c5-9345-fc73348a80a1",
id: "7567ec4b-b10c-48c5-9345-fc73348a80a4",
price: 15,
title: "ProductTest",
},
Expand All @@ -36,7 +36,7 @@ export const products: Product[] = [
},
{
description: "Short Product Description7",
id: "7567ec4b-b10c-45c5-9345-fc73c48a80a1",
id: "7567ec4b-b10c-45c5-9345-fc73c48a80a5",
price: 15,
title: "ProductName",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Product } from "~/models/Product";
import { Product } from "./Product";

export type CartItem = {
product: Product;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import * as Yup from "yup";
import { OrderStatus } from "~/constants/order";

export enum OrderStatus {
Open = "OPEN",
Approved = "APPROVED",
Confirmed = "CONFIRMED",
Sent = "SENT",
Completed = "COMPLETED",
Cancelled = "CANCELLED",
}

export const ORDER_STATUS_FLOW = Object.values(OrderStatus);

export const AddressSchema = Yup.object({
firstName: Yup.string().required().default(""),
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions commons/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@guria.dev/aws-js-practitioner-commons",
"version": "1.0.0",
"engines": {
"node": ">=16.0.0"
},
"dependencies": {
"yup": "^0.32.11"
}
}
17 changes: 17 additions & 0 deletions commons/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"moduleResolution": "node",
"noUnusedLocals": true,
"noUnusedParameters": true,
"removeComments": true,
"sourceMap": true,
"target": "ES2020",
"outDir": "lib"
},
"include": ["serverless.ts", "*.ts", "mocks/*", "models/*", "constants/*"],
"exclude": [
"node_modules/**/*",
".serverless/**/*"
]
}
Loading