From 7a5fea397f0e35e8e63a4768276ef134a6e3aaf1 Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Tue, 12 Nov 2024 21:01:12 +0900 Subject: [PATCH 1/7] =?UTF-8?q?build:=20CRDT=EC=9A=A9=20pnpm=20=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EB=B0=8F=20workspace=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - package.json 등록 - tsconfig.json 빌드 설정 #098 --- @noctaCrdt/Crdt.ts | 0 @noctaCrdt/Interfaces.ts | 0 @noctaCrdt/LinkedList.ts | 0 @noctaCrdt/Node.ts | 0 @noctaCrdt/package.json | 27 +++++++++++++++++++++++++++ @noctaCrdt/tsconfig.json | 14 ++++++++++++++ pnpm-workspace.yaml | 5 +++-- 7 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 @noctaCrdt/Crdt.ts create mode 100644 @noctaCrdt/Interfaces.ts create mode 100644 @noctaCrdt/LinkedList.ts create mode 100644 @noctaCrdt/Node.ts create mode 100644 @noctaCrdt/package.json create mode 100644 @noctaCrdt/tsconfig.json diff --git a/@noctaCrdt/Crdt.ts b/@noctaCrdt/Crdt.ts new file mode 100644 index 00000000..e69de29b diff --git a/@noctaCrdt/Interfaces.ts b/@noctaCrdt/Interfaces.ts new file mode 100644 index 00000000..e69de29b diff --git a/@noctaCrdt/LinkedList.ts b/@noctaCrdt/LinkedList.ts new file mode 100644 index 00000000..e69de29b diff --git a/@noctaCrdt/Node.ts b/@noctaCrdt/Node.ts new file mode 100644 index 00000000..e69de29b diff --git a/@noctaCrdt/package.json b/@noctaCrdt/package.json new file mode 100644 index 00000000..8abfc264 --- /dev/null +++ b/@noctaCrdt/package.json @@ -0,0 +1,27 @@ +{ + "name": "@noctaCrdt", + "version": "1.0.0", + "main": "dist/Crdt.js", + "types": "dist/Crdt.d.ts", + "scripts": { + "build": "tsc -b" + }, + "exports": { + ".": { + "types": "./dist/Crdt.d.ts", + "default": "./dist/Crdt.js" + }, + "./Node": { + "types": "./dist/Node.d.ts", + "default": "./dist/Node.js" + }, + "./LinkedList": { + "types": "./dist/LinkedList.d.ts", + "default": "./dist/LinkedList.js" + }, + "./Interfaces": { + "types": "./dist/Interfaces.d.ts", + "default": "./dist/Interfaces.js" + } + } +} diff --git a/@noctaCrdt/tsconfig.json b/@noctaCrdt/tsconfig.json new file mode 100644 index 00000000..f1f0224a --- /dev/null +++ b/@noctaCrdt/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": ".", + "composite": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "isolatedModules": true + }, + "include": ["**/*.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index c43375c8..340a2a67 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,4 @@ packages: - - 'client' - - 'server' + - "client" + - "server" + - "@noctaCrdt" From 14a27f05034c43bca0c17aa89103af4409082b3b Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Tue, 12 Nov 2024 21:04:41 +0900 Subject: [PATCH 2/7] =?UTF-8?q?chore:=20dist=20=ED=8F=B4=EB=8D=94=20git?= =?UTF-8?q?=EC=97=90=20=EB=B0=98=EC=98=81=ED=95=98=EC=A7=80=20=EC=95=8A?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8140d698..07237331 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /node_modules **/node_modules -/dist +*/dist /build .DS_Store .env \ No newline at end of file From 4395c6117c22b4522664789a76e0243d473a4495 Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Tue, 12 Nov 2024 21:10:45 +0900 Subject: [PATCH 3/7] =?UTF-8?q?build:=20CRDT=20=EB=9D=BC=EC=9D=B4=EB=B8=8C?= =?UTF-8?q?=EB=9F=AC=EB=A6=AC=20pnpm=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=A3=BC=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + pnpm-lock.yaml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/package.json b/package.json index 9914e855..64822fa6 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "author": "", "license": "ISC", "devDependencies": { + "@noctaCrdt": "workspace:*", "@eslint/js": "^9.14.0", "@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^7.18.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 789a39b5..014832a3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,6 +11,9 @@ importers: '@eslint/js': specifier: ^9.14.0 version: 9.14.0 + '@noctaCrdt': + specifier: workspace:* + version: link:@noctaCrdt '@typescript-eslint/eslint-plugin': specifier: ^7.18.0 version: 7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.3.3))(eslint@8.57.1)(typescript@5.3.3) @@ -54,6 +57,8 @@ importers: specifier: ~5.3.3 version: 5.3.3 + '@noctaCrdt': {} + client: dependencies: '@pandabox/panda-plugins': From ab75cea66649d6b1573ef1c11859c61f2dd17e4f Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Tue, 12 Nov 2024 21:11:37 +0900 Subject: [PATCH 4/7] =?UTF-8?q?build:=20client=20CRDT=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=A3=BC=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - tsconfig 설정 - vite 설정 추가 --- client/package.json | 1 + client/tsconfig.json | 5 ++++- client/vite.config.ts | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/package.json b/client/package.json index 29a4a505..7381caeb 100644 --- a/client/package.json +++ b/client/package.json @@ -11,6 +11,7 @@ "prepare": "panda codegen" }, "dependencies": { + "@noctaCrdt": "workspace:*", "@pandabox/panda-plugins": "^0.0.8", "react": "^18.3.1", "react-dom": "^18.3.1", diff --git a/client/tsconfig.json b/client/tsconfig.json index d0a90532..daf6a7b6 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -23,9 +23,12 @@ "@components/*": ["src/components/*"], "@assets/*": ["src/assets/*"], "@features/*": ["src/features/*"], - "@styles/*": ["src/styles/*"] + "@styles/*": ["src/styles/*"], + "@noctaCrdt": ["../@noctaCrdt/dist"], + "@noctaCrdt/*": ["../@noctaCrdt/dist/*"] } }, + "references": [{ "path": "../@noctaCrdt" }], "include": ["src", "*.ts", "*.tsx", "vite.config.ts", "styled-system"], "exclude": ["node_modules"] } diff --git a/client/vite.config.ts b/client/vite.config.ts index 338943d5..5f5414bc 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -1,7 +1,13 @@ import { defineConfig } from "vite"; +import path from "path"; import react from "@vitejs/plugin-react"; import tsconfigPaths from "vite-tsconfig-paths"; export default defineConfig({ plugins: [react(), tsconfigPaths()], + resolve: { + alias: { + "@noctaCrdt": path.resolve(__dirname, "../@noctaCrdt"), + }, + }, }); From 281b5c9c2f4d55482f8795610690bfaa88a7940d Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Tue, 12 Nov 2024 21:15:27 +0900 Subject: [PATCH 5/7] =?UTF-8?q?build:=20server=20CRDT=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=A3=BC=EC=9E=85=20=EB=B0=8F=20webpack=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - nest-cli webpack으로 빌드되도록 설정 추가 - tsconfig 경로를 읽을 수 있도록 설정 --- server/nest-cli.json | 15 ++++++++++++++- server/package.json | 1 + server/tsconfig.json | 7 ++++++- server/webpack.config.js | 25 +++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 server/webpack.config.js diff --git a/server/nest-cli.json b/server/nest-cli.json index f9aa683b..5e07d508 100644 --- a/server/nest-cli.json +++ b/server/nest-cli.json @@ -3,6 +3,19 @@ "collection": "@nestjs/schematics", "sourceRoot": "src", "compilerOptions": { - "deleteOutDir": true + "deleteOutDir": true, + "webpack": true, + "tsConfigPath": "tsconfig.json" + }, + "projects": { + "crdt": { + "type": "library", + "root": "../@noctaCrdt", + "entryFile": "Crdt", + "sourceRoot": "../@noctaCrdt", + "compilerOptions": { + "tsConfigPath": "../@noctaCrdt/tsconfig.json" + } + } } } diff --git a/server/package.json b/server/package.json index 62ffcad0..decccfd3 100644 --- a/server/package.json +++ b/server/package.json @@ -22,6 +22,7 @@ "test:e2e": "jest --config ./test/jest-e2e.json" }, "dependencies": { + "@noctaCrdt": "workspace:*", "@nestjs/common": "^10.0.0", "@nestjs/core": "^10.0.0", "@nestjs/mongoose": "^10.1.0", diff --git a/server/tsconfig.json b/server/tsconfig.json index 9d70f891..5b93a0ad 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -1,4 +1,6 @@ { + "extend": "../tsconfig.base.json", + "references": [{ "path": "../@noctaCrdt" }], "compilerOptions": { // 기본 설정 "module": "commonjs", @@ -18,7 +20,10 @@ "strictNullChecks": false, "noImplicitAny": false, "strictBindCallApply": false, - + "paths": { + "@Nocta/crdt": ["../@noctaCrdt/dist"], + "@Nocta/crdt/*": ["../@noctaCrdt/dist/*"] + }, "forceConsistentCasingInFileNames": false, "noFallthroughCasesInSwitch": false, diff --git a/server/webpack.config.js b/server/webpack.config.js new file mode 100644 index 00000000..f45982f9 --- /dev/null +++ b/server/webpack.config.js @@ -0,0 +1,25 @@ +const path = require("path"); + +module.exports = { + mode: "development", + resolve: { + extensions: [".ts", ".js"], + alias: { + "@noctaCrdt": path.resolve(__dirname, "../@noctaCrdt"), + }, + }, + module: { + rules: [ + { + test: /\.ts$/, + use: { + loader: "ts-loader", + options: { + configFile: "tsconfig.json", + }, + }, + exclude: /node_modules/, + }, + ], + }, +}; From 251e6d294c78804d069ea972cf615520ed9afd58 Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Tue, 12 Nov 2024 21:20:25 +0900 Subject: [PATCH 6/7] =?UTF-8?q?build:=20server=EC=99=80=20root=EC=97=90=20?= =?UTF-8?q?build=20=EA=B4=80=EB=A0=A8=20scripts=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - server build - webpack으로 빌드되도록 추가 - CRDT라이브러리가 먼저 빌드 되어야 client와 server가 안정적으로 빌드되어 root package의 build 멘트에 cd명령어 추가 --- package.json | 4 ++++ server/package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 64822fa6..01ce7c5f 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,10 @@ "lint": "eslint . --fix", "lint:client": "eslint \"client/src/**/*.{ts,tsx}\" --fix", "lint:server": "eslint \"server/src/**/*.{ts,tsx}\" --fix", + "build": "cd @noctaCrdt && pnpm build && cd .. && pnpm -r build", + "build:lib": "cd @noctaCrdt && pnpm build", + "build:client": "cd client && pnpm build", + "build:server": "cd server && pnpm build", "dev": "pnpm -r --parallel dev" }, "keywords": [], diff --git a/server/package.json b/server/package.json index decccfd3..f13fb011 100644 --- a/server/package.json +++ b/server/package.json @@ -7,7 +7,7 @@ "license": "UNLICENSED", "type": "commonjs", "scripts": { - "build": "nest build", + "build": "nest build --webpack --webpackPath webpack.config.js", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "start": "nest start", "start:dev": "nest start --watch", From 196771a14d3bb65348f92ae9132031f00e01b6ea Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Tue, 12 Nov 2024 21:28:27 +0900 Subject: [PATCH 7/7] =?UTF-8?q?chore:=20pnpm-lock=EC=97=90=20CRDT=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pnpm-lock.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 014832a3..21ab87e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -61,6 +61,9 @@ importers: client: dependencies: + '@noctaCrdt': + specifier: workspace:* + version: link:../@noctaCrdt '@pandabox/panda-plugins': specifier: ^0.0.8 version: 0.0.8 @@ -137,6 +140,9 @@ importers: '@nestjs/websockets': specifier: ^10.4.7 version: 10.4.7(@nestjs/common@10.4.6(reflect-metadata@0.2.2)(rxjs@7.8.1))(@nestjs/core@10.4.6)(@nestjs/platform-socket.io@10.4.7)(reflect-metadata@0.2.2)(rxjs@7.8.1) + '@noctaCrdt': + specifier: workspace:* + version: link:../@noctaCrdt mongoose: specifier: ^8.8.0 version: 8.8.0