From 068465414a3a4f6be1e8fa14ccd0f24da65c1b83 Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 1 Apr 2024 15:02:40 +1100 Subject: [PATCH 1/6] add vercel deployment details --- .gitignore | 4 +++- aapc-backend/.gitignore | 1 + aapc-backend/.vercelignore | 1 + aapc-backend/package-lock.json | 16 ++++------------ aapc-backend/package.json | 6 +++--- .../src/repositories/memory/MemoryRepository.ts | 3 +-- aapc-backend/vercel.json | 14 ++++++++++++++ 7 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 aapc-backend/.vercelignore create mode 100644 aapc-backend/vercel.json diff --git a/.gitignore b/.gitignore index c42e25dd..8cda4828 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .idea +*/.env.* */.env +!*/.env.example */node_modules ### JetBrains ### @@ -138,7 +140,7 @@ yarn-error.log* .pnpm-debug.log* # local env files -.env*.local +*/.env.* # vercel .vercel diff --git a/aapc-backend/.gitignore b/aapc-backend/.gitignore index 53f1d342..57f7d40b 100644 --- a/aapc-backend/.gitignore +++ b/aapc-backend/.gitignore @@ -19,3 +19,4 @@ # typescript *.tsbuildinfo next-env.d.ts +.vercel diff --git a/aapc-backend/.vercelignore b/aapc-backend/.vercelignore new file mode 100644 index 00000000..3615120b --- /dev/null +++ b/aapc-backend/.vercelignore @@ -0,0 +1 @@ +.env.* diff --git a/aapc-backend/package-lock.json b/aapc-backend/package-lock.json index 82b1d1a9..6bdb2f3e 100644 --- a/aapc-backend/package-lock.json +++ b/aapc-backend/package-lock.json @@ -8,6 +8,7 @@ "name": "aapc-backend", "version": "0.1.1", "dependencies": { + "aapc-types": "file:../aapc-types/aapc-types-0.2.0.tgz", "dotenv": "^16.4.5", "express": "^4.19.2", "mongodb": "^6.5.0" @@ -15,21 +16,11 @@ "devDependencies": { "@types/express": "^4.17.21", "@types/node": "^20.12.2", - "aapc-types": "file:../aapc-types", "nodemon": "^3.1.0", "tsx": "^4.7.1", "typescript": "^5.4.3" } }, - "../aapc-types": { - "version": "0.1.0", - "dev": true, - "devDependencies": { - "@vitest/coverage-v8": "^1.4.0", - "typescript": "^5.4.3", - "vitest": "^1.4.0" - } - }, "node_modules/@esbuild/aix-ppc64": { "version": "0.19.12", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", @@ -517,8 +508,9 @@ } }, "node_modules/aapc-types": { - "resolved": "../aapc-types", - "link": true + "version": "0.2.0", + "resolved": "file:../aapc-types/aapc-types-0.2.0.tgz", + "integrity": "sha512-/4MZTEMHUooFfxAOhjy+SftTlavzZ7iJpVsSqSuDJPywj9558VobgBgv7yGKeXp46/JHDnE1cSnw/e4VnTrG8A==" }, "node_modules/abbrev": { "version": "1.1.1", diff --git a/aapc-backend/package.json b/aapc-backend/package.json index aa08f9b9..e2dbf9ab 100644 --- a/aapc-backend/package.json +++ b/aapc-backend/package.json @@ -4,11 +4,12 @@ "private": true, "description": "The backend of the AAPC website.", "scripts": { - "dev": "nodemon -x tsx src/index.ts", + "dev": "nodemon -x tsx ./src/index.ts", "build": "tsc --build", - "start": "tsc --build && node ./dist/index.js" + "start": "node ./dist/index.js" }, "dependencies": { + "aapc-types": "file:../aapc-types/aapc-types-0.2.0.tgz", "dotenv": "^16.4.5", "express": "^4.19.2", "mongodb": "^6.5.0" @@ -16,7 +17,6 @@ "devDependencies": { "@types/express": "^4.17.21", "@types/node": "^20.12.2", - "aapc-types": "file:../aapc-types", "nodemon": "^3.1.0", "tsx": "^4.7.1", "typescript": "^5.4.3" diff --git a/aapc-backend/src/repositories/memory/MemoryRepository.ts b/aapc-backend/src/repositories/memory/MemoryRepository.ts index b98c96f0..7f10ef12 100644 --- a/aapc-backend/src/repositories/memory/MemoryRepository.ts +++ b/aapc-backend/src/repositories/memory/MemoryRepository.ts @@ -1,9 +1,8 @@ -import { Article, User } from "aapc-types"; +import { Article, User, IArticle } from "aapc-types"; import IRepository from "../IRepository"; import users from "./data/users.json" import news from "./data/news.json" import researches from "./data/researches.json" -import { IArticle } from "aapc-types/src/Article"; import { Nullable } from "../../util/types"; export default class MemoryRepository implements IRepository { diff --git a/aapc-backend/vercel.json b/aapc-backend/vercel.json new file mode 100644 index 00000000..ae833786 --- /dev/null +++ b/aapc-backend/vercel.json @@ -0,0 +1,14 @@ +{ + "builds": [ + { + "src": "dist/index.js", + "use": "@vercel/node" + } + ], + "rewrites": [ + { + "source": "/(.*)", + "destination": "dist/index.js" + } + ] +} \ No newline at end of file From b2b3750f941335975c51ff1d4f1c151096eb1f98 Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 1 Apr 2024 15:08:39 +1100 Subject: [PATCH 2/6] update types package.json, reorganize project --- {aapc-backend => backend}/.gitignore | 0 {aapc-backend => backend}/.vercelignore | 0 {aapc-backend => backend}/README.md | 0 {aapc-backend => backend}/package-lock.json | 0 {aapc-backend => backend}/package.json | 0 {aapc-backend => backend}/src/config/mongo.config.ts | 0 {aapc-backend => backend}/src/controllers/news.controller.ts | 0 .../src/controllers/research.controller.ts | 0 {aapc-backend => backend}/src/index.ts | 0 {aapc-backend => backend}/src/repositories/IRepository.ts | 0 .../src/repositories/memory/MemoryRepository.ts | 0 .../src/repositories/memory/data/news.json | 0 .../src/repositories/memory/data/researches.json | 0 .../src/repositories/memory/data/users.json | 0 {aapc-backend => backend}/src/repositories/repository.ts | 0 {aapc-backend => backend}/src/routes/news.router.ts | 0 {aapc-backend => backend}/src/routes/research.router.ts | 0 {aapc-backend => backend}/src/util/types.ts | 0 {aapc-backend => backend}/tsconfig.json | 0 {aapc-backend => backend}/vercel.json | 0 {aapc-frontend => frontend}/.eslintrc.json | 0 {aapc-frontend => frontend}/.gitignore | 0 {aapc-frontend => frontend}/README.md | 0 {aapc-frontend => frontend}/app/(cms)/layout.tsx | 0 {aapc-frontend => frontend}/app/(cms)/news/[id]/edit/page.tsx | 0 {aapc-frontend => frontend}/app/(cms)/news/create/page.tsx | 0 .../app/(cms)/research/[id]/edit/page.tsx | 0 {aapc-frontend => frontend}/app/(cms)/research/create/page.tsx | 0 {aapc-frontend => frontend}/app/(content)/about/page.tsx | 0 {aapc-frontend => frontend}/app/(content)/layout.tsx | 0 {aapc-frontend => frontend}/app/(content)/news/[id]/page.tsx | 0 .../app/(content)/research/[id]/page.tsx | 0 {aapc-frontend => frontend}/app/(homepage)/layout.tsx | 0 {aapc-frontend => frontend}/app/(homepage)/page.tsx | 0 {aapc-frontend => frontend}/app/components/nav.tsx | 0 {aapc-frontend => frontend}/app/globals.css | 0 {aapc-frontend => frontend}/app/layout.tsx | 0 {aapc-frontend => frontend}/next.config.mjs | 0 {aapc-frontend => frontend}/package-lock.json | 0 {aapc-frontend => frontend}/package.json | 0 {aapc-frontend => frontend}/postcss.config.js | 0 {aapc-frontend => frontend}/tailwind.config.ts | 0 {aapc-frontend => frontend}/tsconfig.json | 0 {aapc-types => types}/.gitignore | 0 {aapc-types => types}/dist/main.d.mts | 0 {aapc-types => types}/dist/main.d.ts | 0 {aapc-types => types}/dist/main.js | 0 {aapc-types => types}/dist/main.js.map | 0 {aapc-types => types}/dist/main.mjs | 0 {aapc-types => types}/dist/main.mjs.map | 0 {aapc-types => types}/main.ts | 0 {aapc-types => types}/package-lock.json | 0 {aapc-types => types}/package.json | 3 +-- {aapc-types => types}/src/Article.ts | 0 {aapc-types => types}/src/User.ts | 0 {aapc-types => types}/tests/Article.test.ts | 0 {aapc-types => types}/tests/User.test.ts | 0 {aapc-types => types}/tsconfig.json | 0 {aapc-types => types}/tsup.config.ts | 0 {aapc-types => types}/vitest.config.ts | 0 60 files changed, 1 insertion(+), 2 deletions(-) rename {aapc-backend => backend}/.gitignore (100%) rename {aapc-backend => backend}/.vercelignore (100%) rename {aapc-backend => backend}/README.md (100%) rename {aapc-backend => backend}/package-lock.json (100%) rename {aapc-backend => backend}/package.json (100%) rename {aapc-backend => backend}/src/config/mongo.config.ts (100%) rename {aapc-backend => backend}/src/controllers/news.controller.ts (100%) rename {aapc-backend => backend}/src/controllers/research.controller.ts (100%) rename {aapc-backend => backend}/src/index.ts (100%) rename {aapc-backend => backend}/src/repositories/IRepository.ts (100%) rename {aapc-backend => backend}/src/repositories/memory/MemoryRepository.ts (100%) rename {aapc-backend => backend}/src/repositories/memory/data/news.json (100%) rename {aapc-backend => backend}/src/repositories/memory/data/researches.json (100%) rename {aapc-backend => backend}/src/repositories/memory/data/users.json (100%) rename {aapc-backend => backend}/src/repositories/repository.ts (100%) rename {aapc-backend => backend}/src/routes/news.router.ts (100%) rename {aapc-backend => backend}/src/routes/research.router.ts (100%) rename {aapc-backend => backend}/src/util/types.ts (100%) rename {aapc-backend => backend}/tsconfig.json (100%) rename {aapc-backend => backend}/vercel.json (100%) rename {aapc-frontend => frontend}/.eslintrc.json (100%) rename {aapc-frontend => frontend}/.gitignore (100%) rename {aapc-frontend => frontend}/README.md (100%) rename {aapc-frontend => frontend}/app/(cms)/layout.tsx (100%) rename {aapc-frontend => frontend}/app/(cms)/news/[id]/edit/page.tsx (100%) rename {aapc-frontend => frontend}/app/(cms)/news/create/page.tsx (100%) rename {aapc-frontend => frontend}/app/(cms)/research/[id]/edit/page.tsx (100%) rename {aapc-frontend => frontend}/app/(cms)/research/create/page.tsx (100%) rename {aapc-frontend => frontend}/app/(content)/about/page.tsx (100%) rename {aapc-frontend => frontend}/app/(content)/layout.tsx (100%) rename {aapc-frontend => frontend}/app/(content)/news/[id]/page.tsx (100%) rename {aapc-frontend => frontend}/app/(content)/research/[id]/page.tsx (100%) rename {aapc-frontend => frontend}/app/(homepage)/layout.tsx (100%) rename {aapc-frontend => frontend}/app/(homepage)/page.tsx (100%) rename {aapc-frontend => frontend}/app/components/nav.tsx (100%) rename {aapc-frontend => frontend}/app/globals.css (100%) rename {aapc-frontend => frontend}/app/layout.tsx (100%) rename {aapc-frontend => frontend}/next.config.mjs (100%) rename {aapc-frontend => frontend}/package-lock.json (100%) rename {aapc-frontend => frontend}/package.json (100%) rename {aapc-frontend => frontend}/postcss.config.js (100%) rename {aapc-frontend => frontend}/tailwind.config.ts (100%) rename {aapc-frontend => frontend}/tsconfig.json (100%) rename {aapc-types => types}/.gitignore (100%) rename {aapc-types => types}/dist/main.d.mts (100%) rename {aapc-types => types}/dist/main.d.ts (100%) rename {aapc-types => types}/dist/main.js (100%) rename {aapc-types => types}/dist/main.js.map (100%) rename {aapc-types => types}/dist/main.mjs (100%) rename {aapc-types => types}/dist/main.mjs.map (100%) rename {aapc-types => types}/main.ts (100%) rename {aapc-types => types}/package-lock.json (100%) rename {aapc-types => types}/package.json (91%) rename {aapc-types => types}/src/Article.ts (100%) rename {aapc-types => types}/src/User.ts (100%) rename {aapc-types => types}/tests/Article.test.ts (100%) rename {aapc-types => types}/tests/User.test.ts (100%) rename {aapc-types => types}/tsconfig.json (100%) rename {aapc-types => types}/tsup.config.ts (100%) rename {aapc-types => types}/vitest.config.ts (100%) diff --git a/aapc-backend/.gitignore b/backend/.gitignore similarity index 100% rename from aapc-backend/.gitignore rename to backend/.gitignore diff --git a/aapc-backend/.vercelignore b/backend/.vercelignore similarity index 100% rename from aapc-backend/.vercelignore rename to backend/.vercelignore diff --git a/aapc-backend/README.md b/backend/README.md similarity index 100% rename from aapc-backend/README.md rename to backend/README.md diff --git a/aapc-backend/package-lock.json b/backend/package-lock.json similarity index 100% rename from aapc-backend/package-lock.json rename to backend/package-lock.json diff --git a/aapc-backend/package.json b/backend/package.json similarity index 100% rename from aapc-backend/package.json rename to backend/package.json diff --git a/aapc-backend/src/config/mongo.config.ts b/backend/src/config/mongo.config.ts similarity index 100% rename from aapc-backend/src/config/mongo.config.ts rename to backend/src/config/mongo.config.ts diff --git a/aapc-backend/src/controllers/news.controller.ts b/backend/src/controllers/news.controller.ts similarity index 100% rename from aapc-backend/src/controllers/news.controller.ts rename to backend/src/controllers/news.controller.ts diff --git a/aapc-backend/src/controllers/research.controller.ts b/backend/src/controllers/research.controller.ts similarity index 100% rename from aapc-backend/src/controllers/research.controller.ts rename to backend/src/controllers/research.controller.ts diff --git a/aapc-backend/src/index.ts b/backend/src/index.ts similarity index 100% rename from aapc-backend/src/index.ts rename to backend/src/index.ts diff --git a/aapc-backend/src/repositories/IRepository.ts b/backend/src/repositories/IRepository.ts similarity index 100% rename from aapc-backend/src/repositories/IRepository.ts rename to backend/src/repositories/IRepository.ts diff --git a/aapc-backend/src/repositories/memory/MemoryRepository.ts b/backend/src/repositories/memory/MemoryRepository.ts similarity index 100% rename from aapc-backend/src/repositories/memory/MemoryRepository.ts rename to backend/src/repositories/memory/MemoryRepository.ts diff --git a/aapc-backend/src/repositories/memory/data/news.json b/backend/src/repositories/memory/data/news.json similarity index 100% rename from aapc-backend/src/repositories/memory/data/news.json rename to backend/src/repositories/memory/data/news.json diff --git a/aapc-backend/src/repositories/memory/data/researches.json b/backend/src/repositories/memory/data/researches.json similarity index 100% rename from aapc-backend/src/repositories/memory/data/researches.json rename to backend/src/repositories/memory/data/researches.json diff --git a/aapc-backend/src/repositories/memory/data/users.json b/backend/src/repositories/memory/data/users.json similarity index 100% rename from aapc-backend/src/repositories/memory/data/users.json rename to backend/src/repositories/memory/data/users.json diff --git a/aapc-backend/src/repositories/repository.ts b/backend/src/repositories/repository.ts similarity index 100% rename from aapc-backend/src/repositories/repository.ts rename to backend/src/repositories/repository.ts diff --git a/aapc-backend/src/routes/news.router.ts b/backend/src/routes/news.router.ts similarity index 100% rename from aapc-backend/src/routes/news.router.ts rename to backend/src/routes/news.router.ts diff --git a/aapc-backend/src/routes/research.router.ts b/backend/src/routes/research.router.ts similarity index 100% rename from aapc-backend/src/routes/research.router.ts rename to backend/src/routes/research.router.ts diff --git a/aapc-backend/src/util/types.ts b/backend/src/util/types.ts similarity index 100% rename from aapc-backend/src/util/types.ts rename to backend/src/util/types.ts diff --git a/aapc-backend/tsconfig.json b/backend/tsconfig.json similarity index 100% rename from aapc-backend/tsconfig.json rename to backend/tsconfig.json diff --git a/aapc-backend/vercel.json b/backend/vercel.json similarity index 100% rename from aapc-backend/vercel.json rename to backend/vercel.json diff --git a/aapc-frontend/.eslintrc.json b/frontend/.eslintrc.json similarity index 100% rename from aapc-frontend/.eslintrc.json rename to frontend/.eslintrc.json diff --git a/aapc-frontend/.gitignore b/frontend/.gitignore similarity index 100% rename from aapc-frontend/.gitignore rename to frontend/.gitignore diff --git a/aapc-frontend/README.md b/frontend/README.md similarity index 100% rename from aapc-frontend/README.md rename to frontend/README.md diff --git a/aapc-frontend/app/(cms)/layout.tsx b/frontend/app/(cms)/layout.tsx similarity index 100% rename from aapc-frontend/app/(cms)/layout.tsx rename to frontend/app/(cms)/layout.tsx diff --git a/aapc-frontend/app/(cms)/news/[id]/edit/page.tsx b/frontend/app/(cms)/news/[id]/edit/page.tsx similarity index 100% rename from aapc-frontend/app/(cms)/news/[id]/edit/page.tsx rename to frontend/app/(cms)/news/[id]/edit/page.tsx diff --git a/aapc-frontend/app/(cms)/news/create/page.tsx b/frontend/app/(cms)/news/create/page.tsx similarity index 100% rename from aapc-frontend/app/(cms)/news/create/page.tsx rename to frontend/app/(cms)/news/create/page.tsx diff --git a/aapc-frontend/app/(cms)/research/[id]/edit/page.tsx b/frontend/app/(cms)/research/[id]/edit/page.tsx similarity index 100% rename from aapc-frontend/app/(cms)/research/[id]/edit/page.tsx rename to frontend/app/(cms)/research/[id]/edit/page.tsx diff --git a/aapc-frontend/app/(cms)/research/create/page.tsx b/frontend/app/(cms)/research/create/page.tsx similarity index 100% rename from aapc-frontend/app/(cms)/research/create/page.tsx rename to frontend/app/(cms)/research/create/page.tsx diff --git a/aapc-frontend/app/(content)/about/page.tsx b/frontend/app/(content)/about/page.tsx similarity index 100% rename from aapc-frontend/app/(content)/about/page.tsx rename to frontend/app/(content)/about/page.tsx diff --git a/aapc-frontend/app/(content)/layout.tsx b/frontend/app/(content)/layout.tsx similarity index 100% rename from aapc-frontend/app/(content)/layout.tsx rename to frontend/app/(content)/layout.tsx diff --git a/aapc-frontend/app/(content)/news/[id]/page.tsx b/frontend/app/(content)/news/[id]/page.tsx similarity index 100% rename from aapc-frontend/app/(content)/news/[id]/page.tsx rename to frontend/app/(content)/news/[id]/page.tsx diff --git a/aapc-frontend/app/(content)/research/[id]/page.tsx b/frontend/app/(content)/research/[id]/page.tsx similarity index 100% rename from aapc-frontend/app/(content)/research/[id]/page.tsx rename to frontend/app/(content)/research/[id]/page.tsx diff --git a/aapc-frontend/app/(homepage)/layout.tsx b/frontend/app/(homepage)/layout.tsx similarity index 100% rename from aapc-frontend/app/(homepage)/layout.tsx rename to frontend/app/(homepage)/layout.tsx diff --git a/aapc-frontend/app/(homepage)/page.tsx b/frontend/app/(homepage)/page.tsx similarity index 100% rename from aapc-frontend/app/(homepage)/page.tsx rename to frontend/app/(homepage)/page.tsx diff --git a/aapc-frontend/app/components/nav.tsx b/frontend/app/components/nav.tsx similarity index 100% rename from aapc-frontend/app/components/nav.tsx rename to frontend/app/components/nav.tsx diff --git a/aapc-frontend/app/globals.css b/frontend/app/globals.css similarity index 100% rename from aapc-frontend/app/globals.css rename to frontend/app/globals.css diff --git a/aapc-frontend/app/layout.tsx b/frontend/app/layout.tsx similarity index 100% rename from aapc-frontend/app/layout.tsx rename to frontend/app/layout.tsx diff --git a/aapc-frontend/next.config.mjs b/frontend/next.config.mjs similarity index 100% rename from aapc-frontend/next.config.mjs rename to frontend/next.config.mjs diff --git a/aapc-frontend/package-lock.json b/frontend/package-lock.json similarity index 100% rename from aapc-frontend/package-lock.json rename to frontend/package-lock.json diff --git a/aapc-frontend/package.json b/frontend/package.json similarity index 100% rename from aapc-frontend/package.json rename to frontend/package.json diff --git a/aapc-frontend/postcss.config.js b/frontend/postcss.config.js similarity index 100% rename from aapc-frontend/postcss.config.js rename to frontend/postcss.config.js diff --git a/aapc-frontend/tailwind.config.ts b/frontend/tailwind.config.ts similarity index 100% rename from aapc-frontend/tailwind.config.ts rename to frontend/tailwind.config.ts diff --git a/aapc-frontend/tsconfig.json b/frontend/tsconfig.json similarity index 100% rename from aapc-frontend/tsconfig.json rename to frontend/tsconfig.json diff --git a/aapc-types/.gitignore b/types/.gitignore similarity index 100% rename from aapc-types/.gitignore rename to types/.gitignore diff --git a/aapc-types/dist/main.d.mts b/types/dist/main.d.mts similarity index 100% rename from aapc-types/dist/main.d.mts rename to types/dist/main.d.mts diff --git a/aapc-types/dist/main.d.ts b/types/dist/main.d.ts similarity index 100% rename from aapc-types/dist/main.d.ts rename to types/dist/main.d.ts diff --git a/aapc-types/dist/main.js b/types/dist/main.js similarity index 100% rename from aapc-types/dist/main.js rename to types/dist/main.js diff --git a/aapc-types/dist/main.js.map b/types/dist/main.js.map similarity index 100% rename from aapc-types/dist/main.js.map rename to types/dist/main.js.map diff --git a/aapc-types/dist/main.mjs b/types/dist/main.mjs similarity index 100% rename from aapc-types/dist/main.mjs rename to types/dist/main.mjs diff --git a/aapc-types/dist/main.mjs.map b/types/dist/main.mjs.map similarity index 100% rename from aapc-types/dist/main.mjs.map rename to types/dist/main.mjs.map diff --git a/aapc-types/main.ts b/types/main.ts similarity index 100% rename from aapc-types/main.ts rename to types/main.ts diff --git a/aapc-types/package-lock.json b/types/package-lock.json similarity index 100% rename from aapc-types/package-lock.json rename to types/package-lock.json diff --git a/aapc-types/package.json b/types/package.json similarity index 91% rename from aapc-types/package.json rename to types/package.json index a501abb9..368a5947 100644 --- a/aapc-types/package.json +++ b/types/package.json @@ -1,7 +1,6 @@ { - "name": "aapc-types", + "name": "@aapc/types", "version": "0.2.0", - "private": true, "description": "Types definitions for the AAPC website.", "main": "./dist/main.js", "module": "./dist/main.mjs", diff --git a/aapc-types/src/Article.ts b/types/src/Article.ts similarity index 100% rename from aapc-types/src/Article.ts rename to types/src/Article.ts diff --git a/aapc-types/src/User.ts b/types/src/User.ts similarity index 100% rename from aapc-types/src/User.ts rename to types/src/User.ts diff --git a/aapc-types/tests/Article.test.ts b/types/tests/Article.test.ts similarity index 100% rename from aapc-types/tests/Article.test.ts rename to types/tests/Article.test.ts diff --git a/aapc-types/tests/User.test.ts b/types/tests/User.test.ts similarity index 100% rename from aapc-types/tests/User.test.ts rename to types/tests/User.test.ts diff --git a/aapc-types/tsconfig.json b/types/tsconfig.json similarity index 100% rename from aapc-types/tsconfig.json rename to types/tsconfig.json diff --git a/aapc-types/tsup.config.ts b/types/tsup.config.ts similarity index 100% rename from aapc-types/tsup.config.ts rename to types/tsup.config.ts diff --git a/aapc-types/vitest.config.ts b/types/vitest.config.ts similarity index 100% rename from aapc-types/vitest.config.ts rename to types/vitest.config.ts From dce155d449eddbc67cd131d72f69b6d8db85e980 Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 1 Apr 2024 15:53:45 +1100 Subject: [PATCH 3/6] fix imports after changing types module name, create deployment scripts --- backend/package-lock.json | 12 ++++++------ backend/package.json | 6 ++++-- backend/src/repositories/IRepository.ts | 2 +- backend/src/repositories/memory/MemoryRepository.ts | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/backend/package-lock.json b/backend/package-lock.json index 6bdb2f3e..119f0228 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -8,7 +8,7 @@ "name": "aapc-backend", "version": "0.1.1", "dependencies": { - "aapc-types": "file:../aapc-types/aapc-types-0.2.0.tgz", + "@aapc/types": "^0.2.0", "dotenv": "^16.4.5", "express": "^4.19.2", "mongodb": "^6.5.0" @@ -21,6 +21,11 @@ "typescript": "^5.4.3" } }, + "node_modules/@aapc/types": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@aapc/types/-/types-0.2.0.tgz", + "integrity": "sha512-Eh/6+7G4I2yvgsItDls6PQrUyPw/qT76HEXTkI08IJ9zi3Sucb9aZTSqQCmWDMZrhbi/k/xXc0gte/TLVfgGXQ==" + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.19.12", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", @@ -507,11 +512,6 @@ "@types/webidl-conversions": "*" } }, - "node_modules/aapc-types": { - "version": "0.2.0", - "resolved": "file:../aapc-types/aapc-types-0.2.0.tgz", - "integrity": "sha512-/4MZTEMHUooFfxAOhjy+SftTlavzZ7iJpVsSqSuDJPywj9558VobgBgv7yGKeXp46/JHDnE1cSnw/e4VnTrG8A==" - }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", diff --git a/backend/package.json b/backend/package.json index e2dbf9ab..d4d9266c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -6,10 +6,12 @@ "scripts": { "dev": "nodemon -x tsx ./src/index.ts", "build": "tsc --build", - "start": "node ./dist/index.js" + "start": "node ./dist/index.js", + "deploy:development": "npm run build && vercel build && vercel deploy --prebuilt", + "deploy:production": "npm run build && vercel build --prod && vercel --prod deploy --prebuilt" }, "dependencies": { - "aapc-types": "file:../aapc-types/aapc-types-0.2.0.tgz", + "@aapc/types": "^0.2.0", "dotenv": "^16.4.5", "express": "^4.19.2", "mongodb": "^6.5.0" diff --git a/backend/src/repositories/IRepository.ts b/backend/src/repositories/IRepository.ts index 64b11dd1..6ee5632f 100644 --- a/backend/src/repositories/IRepository.ts +++ b/backend/src/repositories/IRepository.ts @@ -1,4 +1,4 @@ -import { Article, User } from "aapc-types"; +import { Article, User } from "@aapc/types"; import { Nullable } from "../util/types"; export default interface IRepository { diff --git a/backend/src/repositories/memory/MemoryRepository.ts b/backend/src/repositories/memory/MemoryRepository.ts index 7f10ef12..ad5ce3b0 100644 --- a/backend/src/repositories/memory/MemoryRepository.ts +++ b/backend/src/repositories/memory/MemoryRepository.ts @@ -1,4 +1,4 @@ -import { Article, User, IArticle } from "aapc-types"; +import { Article, User, IArticle } from "@aapc/types"; import IRepository from "../IRepository"; import users from "./data/users.json" import news from "./data/news.json" From abb2deccc98de7f3af07c2c05a0ec6407978be95 Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 1 Apr 2024 17:30:51 +1100 Subject: [PATCH 4/6] add github workflow for backend deployment --- .github/workflows/backend-dev-preview.yml | 24 +++++++++++++++++++++ .github/workflows/backend-dev.yml | 26 +++++++++++++++++++++++ .github/workflows/backend-prod.yml | 26 +++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 .github/workflows/backend-dev-preview.yml create mode 100644 .github/workflows/backend-dev.yml create mode 100644 .github/workflows/backend-prod.yml diff --git a/.github/workflows/backend-dev-preview.yml b/.github/workflows/backend-dev-preview.yml new file mode 100644 index 00000000..1c6f152e --- /dev/null +++ b/.github/workflows/backend-dev-preview.yml @@ -0,0 +1,24 @@ +name: Backend - Deploy (Development Preview) +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_BACKEND_DEV_ID }} +on: + push: + paths: + - "backend/**" + +jobs: + Deploy-Development-Preview: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Vercel CLI + run: npm install --global vercel@canary + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Javascript Files + run: npm run build + - name: Build Project Artifacts + run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/backend-dev.yml b/.github/workflows/backend-dev.yml new file mode 100644 index 00000000..cea915ee --- /dev/null +++ b/.github/workflows/backend-dev.yml @@ -0,0 +1,26 @@ +name: Backend - Deploy (Development) +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_BACKEND_DEV_ID }} +on: + push: + branches: + - dev + paths: + - "backend/**" + +jobs: + Deploy-Development: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Vercel CLI + run: npm install --global vercel@canary + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Javascript Files + run: npm run build + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} diff --git a/.github/workflows/backend-prod.yml b/.github/workflows/backend-prod.yml new file mode 100644 index 00000000..2eefe4fe --- /dev/null +++ b/.github/workflows/backend-prod.yml @@ -0,0 +1,26 @@ +name: Backend - Deploy (Production) +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_BACKEND_DEV_ID }} +on: + push: + branches: + - main + paths: + - "backend/**" + +jobs: + Deploy-Production: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Vercel CLI + run: npm install --global vercel@canary + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Javascript Files + run: npm run build + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} From f6f670f5d9ba80fed8ec5ede5d239c9a8ebeac7e Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 1 Apr 2024 17:45:44 +1100 Subject: [PATCH 5/6] add github workflow for types publishing --- .github/workflows/backend-dev-preview.yml | 2 +- .github/workflows/backend-dev.yml | 2 +- .github/workflows/backend-prod.yml | 2 +- .github/workflows/types-publish.yml | 24 +++++++++++++++++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/types-publish.yml diff --git a/.github/workflows/backend-dev-preview.yml b/.github/workflows/backend-dev-preview.yml index 1c6f152e..e277b73e 100644 --- a/.github/workflows/backend-dev-preview.yml +++ b/.github/workflows/backend-dev-preview.yml @@ -5,7 +5,7 @@ env: on: push: paths: - - "backend/**" + - 'backend/**' jobs: Deploy-Development-Preview: diff --git a/.github/workflows/backend-dev.yml b/.github/workflows/backend-dev.yml index cea915ee..9df95744 100644 --- a/.github/workflows/backend-dev.yml +++ b/.github/workflows/backend-dev.yml @@ -7,7 +7,7 @@ on: branches: - dev paths: - - "backend/**" + - 'backend/**' jobs: Deploy-Development: diff --git a/.github/workflows/backend-prod.yml b/.github/workflows/backend-prod.yml index 2eefe4fe..87b84022 100644 --- a/.github/workflows/backend-prod.yml +++ b/.github/workflows/backend-prod.yml @@ -7,7 +7,7 @@ on: branches: - main paths: - - "backend/**" + - 'backend/**' jobs: Deploy-Production: diff --git a/.github/workflows/types-publish.yml b/.github/workflows/types-publish.yml new file mode 100644 index 00000000..229b916c --- /dev/null +++ b/.github/workflows/types-publish.yml @@ -0,0 +1,24 @@ +name: Types - Publish to npm + +on: + push: + branches: + - main + paths: + - 'types/**' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + - name: Install Dependencies + run: npm ci + - name: Build package artifacts + run: npm run build + - name: Publish to npm + run: npm publish --access public From 1e748d7fe4ec96a9a214391b8f2db4c8c2941da4 Mon Sep 17 00:00:00 2001 From: Hunter Date: Mon, 1 Apr 2024 17:47:44 +1100 Subject: [PATCH 6/6] bump types version --- types/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/package.json b/types/package.json index 368a5947..af0446c8 100644 --- a/types/package.json +++ b/types/package.json @@ -1,6 +1,6 @@ { "name": "@aapc/types", - "version": "0.2.0", + "version": "0.2.1", "description": "Types definitions for the AAPC website.", "main": "./dist/main.js", "module": "./dist/main.mjs",