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

Improve monorepo builds #457

Merged
merged 18 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"header-max-length": [2, "always", 60]
"header-max-length": [2, "always", 72]
Copy link
Member Author

Choose a reason for hiding this comment

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

그냥 이참에 commitlint 최대자 제한을 72자로 늘렸어요

72자가 recommended length더라고요
https://github.com/conventional-changelog/commitlint/blob/master/docs/reference-rules.md

}
}
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
},
"import/resolver": {
"typescript": {
"project": ["./tsconfig.json"]
"project": ["./packages/*/tsconfig.json", "./tsconfig.json"]
}
},
"react": {
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
"web": "pnpm -F @biseo/web",
"api": "dotenv -- pnpm -F @biseo/api",
"interface": "pnpm -F @biseo/interface",
"dev": "dotenv -- pnpm -r --stream dev",
"dev": "dotenv -- pnpm -r --stream --parallel dev",
Copy link
Member Author

Choose a reason for hiding this comment

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

@biseo/interfacedev(build watch) script가 추가됨에 따라 이 명령이 끝나지 않으므로 --parallel 옵션을 주어 동시에 실행되도록 함

"db": "dotenv -- pnpm -F @biseo/api db",
"migrate": "dotenv -- pnpm -F @biseo/api migrate",
"typegen": "pnpm -F @biseo/api typegen",
"studio": "dotenv -- pnpm -F @biseo/api studio",
"typecheck": "pnpm -r typecheck",
"lint": "pnpm eslint . && pnpm prettier --config ./.prettierrc --check -u .",
"build": "pnpm -r build"
"build": "pnpm -r build",
"clean": "pnpm -r clean"
},
"lint-staged": {
"*.{ts,tsx}": [
Expand Down
8 changes: 5 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@biseo/api",
"private": true,
"version": "2.0.0",
"main": "src/index.ts",
"license": "MIT",
Expand All @@ -11,8 +12,9 @@
"typegen": "prisma generate",
"migrate:dev": "pnpm db up --wait && prisma migrate dev",
"studio": "pnpm db up --wait && prisma studio",
"build": "prisma generate && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
"env": "echo $NODE_ENV"
"build": "prisma generate && tsc && tsc-alias",
"env": "echo $NODE_ENV",
"clean": "rm -rf dist"
},
"files": [
"dist",
Expand Down Expand Up @@ -40,6 +42,6 @@
"nodemon": "^2.0.20",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.7",
"tsconfig-paths": "^4.1.2"
"tsconfig-paths": "^4.2.0"
}
}
2 changes: 1 addition & 1 deletion packages/api/src/auth/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const getUserFromToken = async (token: string): Promise<User | null> => {
try {
const { username, iat } = decoded.parse(jwt.verify(token, env.SECRET_KEY));
if (iat < Math.floor(Date.now() / 1000) - MAX_AGE) return null;
return await prisma.user.findUnique({ where: { username } });
return prisma.user.findUnique({ where: { username } });
} catch {
return null;
}
Expand Down
10 changes: 0 additions & 10 deletions packages/api/tsconfig.build.json

This file was deleted.

11 changes: 10 additions & 1 deletion packages/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"extends": "../../tsconfig.json"
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"baseUrl": "./src",
"paths": {
"@biseo/api/*": ["./*"]
// TODO: change to @/*
}
},
"include": ["./src/**/*.ts"]
}
9 changes: 7 additions & 2 deletions packages/interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
"main": "dist/index.js",
"types": "src/index.ts",
"devDependencies": {
"concurrently": "^8.2.2",
"tsc-alias": "^1.8.7",
"zod": "^3.21.4"
},
"files": [
"dist",
"src"
],
"scripts": {
"typecheck": "tsc --noEmit",
"build": "tsc -p tsconfig.build.json"
"prepare": "pnpm build",
"dev": "tsc && (concurrently \"tsc -w\" \"tsc-alias -w\")",
"typecheck": "tsc",
"build": "tsc && tsc-alias",
"clean": "rm -rf dist"
},
"exports": {
".": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/interface/src/admin/agenda/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-redeclare -- A Zod schema name and type should have the same names */
import { z } from "zod";
import { AgendaStatus } from "@biseo/interface/agenda";
import { AgendaStatus } from "@/agenda";
import { AdminAgenda, AdminAgendaCreate, AdminAgendaUpdate } from "./common";

/**
Expand Down
8 changes: 2 additions & 6 deletions packages/interface/src/admin/agenda/common.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
/* eslint-disable @typescript-eslint/no-redeclare -- A Zod schema name and type should have the same names */
import { z } from "zod";
import {
AgendaBase,
AgendaStatus,
ChoiceWithResult,
} from "@biseo/interface/agenda";
import { User } from "@biseo/interface/user";
import { AgendaBase, AgendaStatus, ChoiceWithResult } from "@/agenda";
import { User } from "@/user";

/**
* AdminAgendaStatus
Expand Down
4 changes: 2 additions & 2 deletions packages/interface/src/admin/agenda/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-redeclare -- A Zod schema name and type should have the same names */
import { z } from "zod";
import { User } from "@biseo/interface/user";
import { AgendaStatus, ChoiceWithResult } from "@biseo/interface/agenda";
import { User } from "@/user";
import { AgendaStatus, ChoiceWithResult } from "@/agenda";
import { AdminAgenda } from "./common";

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/interface/src/admin/user/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-redeclare -- A Zod schema name and type should have the same names */
import { z } from "zod";
import { User } from "@biseo/interface/user";
import { User } from "@/user";

/**
* AdminUser
Expand Down
2 changes: 1 addition & 1 deletion packages/interface/src/chat/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-redeclare -- A Zod schema name and type should have the same names */
import { z } from "zod";
import { ChatUser } from "@biseo/interface/user";
import { ChatUser } from "@/user";

/**
* Message
Expand Down
12 changes: 0 additions & 12 deletions packages/interface/tsconfig.build.json

This file was deleted.

12 changes: 11 additions & 1 deletion packages/interface/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
{
"extends": "../../tsconfig.json"
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"declaration": true,
"declarationMap": true,
"baseUrl": "./src",
"paths": {
"@/*": ["./*"]
}
},
"include": ["./src/**/*.ts"]
}
11 changes: 6 additions & 5 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"build": "tsc && vite build",
"typecheck": "tsc --noEmit",
"preview": "vite preview",
"env": "echo $NODE_ENV"
"env": "echo $NODE_ENV",
"clean": "rm -rf dist"
},
"dependencies": {
"@emotion/react": "^11.11.1",
Expand All @@ -27,12 +28,12 @@
"zustand": "^4.3.2"
},
"devDependencies": {
"@biseo/interface": "*",
"@biseo/interface": "workspace:*",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@vitejs/plugin-react": "^3.0.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.13",
"vite": "^4.0.0",
"vite-plugin-svgr": "^3.2.0"
"vite": "^5.0.0",
"vite-plugin-svgr": "^4.2.0"
}
}
20 changes: 10 additions & 10 deletions packages/web/src/assets/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export { ReactComponent as CloseIcon } from "./close.svg";
export { ReactComponent as CloseSmallIcon } from "./closeSmall.svg";
export { ReactComponent as EmoticonIcon } from "./emoticon.svg";
export { ReactComponent as LogoIcon } from "./logo.svg";
export { ReactComponent as LogoLargeIcon } from "./logoLarge.svg";
export { ReactComponent as SelectIcon } from "./select.svg";
export { ReactComponent as SendIcon } from "./send.svg";
export { ReactComponent as PlusIcon } from "./plus.svg";
export { ReactComponent as DownArrowIcon } from "./downarrow.svg";
export { ReactComponent as TrashIcon } from "./trash.svg";
export { default as CloseIcon } from "./close.svg?react";
export { default as CloseSmallIcon } from "./closeSmall.svg?react";
export { default as EmoticonIcon } from "./emoticon.svg?react";
export { default as LogoIcon } from "./logo.svg?react";
export { default as LogoLargeIcon } from "./logoLarge.svg?react";
export { default as SelectIcon } from "./select.svg?react";
export { default as SendIcon } from "./send.svg?react";
export { default as PlusIcon } from "./plus.svg?react";
export { default as DownArrowIcon } from "./downarrow.svg?react";
export { default as TrashIcon } from "./trash.svg?react";
1 change: 1 addition & 0 deletions packages/web/src/vite-plugin-svgr.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite-plugin-svgr/client" />
10 changes: 7 additions & 3 deletions packages/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Node",
"target": "ESNext",
"moduleResolution": "Bundler",
"useDefineForClassFields": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"esModuleInterop": false,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"types": ["vite-plugin-svgr/client"]
"types": ["vite-plugin-svgr/client"],
"baseUrl": "./src",
"paths": {
"@biseo/web/*": ["./*"]
// TODO: change to @/*
}
},
"include": ["src", "vite.config.ts"],
"references": [
Expand Down
2 changes: 0 additions & 2 deletions packages/web/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"compilerOptions": {
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
Expand Down
Loading
Loading