Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
3 changes: 3 additions & 0 deletions frontend/apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@
"react": "^19.0.0",
"react-dom": "^19.0.0",
"zod": "^3.24.1"
},
"devDependencies": {
"@endolphin/vitest-config": "workspace:*"
}
}
5 changes: 0 additions & 5 deletions frontend/apps/client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ export default defineConfig({
'@components': path.resolve(dirname, 'src/components'),
},
},
test: {
globals: true,
include: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
environment: 'jsdom',
},
ssr: {
noExternal: ['@endolphin/theme', '@endolphin/ui'],
},
Expand Down
16 changes: 16 additions & 0 deletions frontend/apps/client/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createAlias, reactConfig } from '@endolphin/vitest-config';
import path from 'path';
import { fileURLToPath } from 'url';
import { defineProject, mergeConfig } from 'vitest/config';

const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

export default mergeConfig(
reactConfig,
defineProject({
resolve: {
alias: createAlias(dirname),
},
}),
);
4 changes: 3 additions & 1 deletion frontend/apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
},
"devDependencies": {
"@types/express": "^5.0.2",
"typescript": "^5.6.2"
"typescript": "^5.6.2",
"@endolphin/tsup-config": "workspace:^",
"@endolphin/vitest-config": "workspace:^"
}
}
9 changes: 3 additions & 6 deletions frontend/apps/server/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { nodeConfig } from '@endolphin/tsup-config';
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/index.ts'],
platform: 'node',
format: ['esm'],
tsconfig: './tsconfig.json',
clean: true,
...nodeConfig,
dts: false,
bundle: false,
target: 'esnext',
});
7 changes: 7 additions & 0 deletions frontend/apps/server/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { nodeConfig } from '@endolphin/vitest-config';
import { defineProject, mergeConfig } from 'vitest/config';

export default mergeConfig(
nodeConfig,
defineProject({}),
);
17 changes: 17 additions & 0 deletions frontend/configs/tsup-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@endolphin/tsup-config",
"version": "1.0.0",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"files": ["dist"],
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/types/index.d.ts"
}
},
"scripts": {
"build": "tsc"
}
}
2 changes: 2 additions & 0 deletions frontend/configs/tsup-config/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './node.js';
export * from './react.js';
10 changes: 10 additions & 0 deletions frontend/configs/tsup-config/src/node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'tsup';

export const nodeConfig = defineConfig({
format: ['esm'],
entry: ['src/index.ts'],
outDir: 'dist',
dts: true,
clean: true,
tsconfig: './tsconfig.json',
});
12 changes: 12 additions & 0 deletions frontend/configs/tsup-config/src/react.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { vanillaExtractPlugin } from '@vanilla-extract/esbuild-plugin';
import { defineConfig } from 'tsup';

export const reactConfig = defineConfig({
format: ['esm'],
entry: ['src/index.ts'],
outDir: 'dist',
esbuildPlugins: [vanillaExtractPlugin()],
dts: true,
clean: true,
tsconfig: './tsconfig.json',
});
9 changes: 9 additions & 0 deletions frontend/configs/tsup-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"declaration": true,
"declarationDir": "dist/types",
},
"include": ["src"],
}
17 changes: 17 additions & 0 deletions frontend/configs/vitest-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@endolphin/vitest-config",
"version": "1.0.0",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/types/index.d.ts",
"files": ["dist"],
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/types/index.d.ts"
}
},
"scripts": {
"build": "tsc"
}
}
14 changes: 14 additions & 0 deletions frontend/configs/vitest-config/src/createAlias.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import path from 'path';

/**
*
* @param {string} dirname - 현재 패키지의 루트 디렉토리.
* @returns
*/
export const createAlias = (dirname: string) => ({
'@': path.resolve(dirname, 'src'),
'@hooks': path.resolve(dirname, 'src/hooks'),
'@utils': path.resolve(dirname, 'src/utils'),
'@constants': path.resolve(dirname, 'src/constants'),
'@components': path.resolve(dirname, 'src/components'),
});
3 changes: 3 additions & 0 deletions frontend/configs/vitest-config/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './createAlias.js';
export * from './node.js';
export * from './react.js';
10 changes: 10 additions & 0 deletions frontend/configs/vitest-config/src/node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'vitest/config';

export const nodeConfig = defineConfig({
test: {
globals: true,
include: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
environment: 'node',
passWithNoTests: true,
},
});
10 changes: 10 additions & 0 deletions frontend/configs/vitest-config/src/react.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from 'vitest/config';

export const reactConfig = defineConfig({
test: {
globals: true,
include: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
environment: 'jsdom',
passWithNoTests: true,
},
});
9 changes: 9 additions & 0 deletions frontend/configs/vitest-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"declaration": true,
"declarationDir": "dist/types",
},
"include": ["src"],
}
8 changes: 8 additions & 0 deletions frontend/endolphin.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
{
"name": "date-time",
"path": "packages/date-time"
},
{
"name": "tsup-config",
"path": "configs/tsup-config"
},
{
"name": "vitest-config",
"path": "configs/vitest-config"
}
],
"settings": {
Expand Down
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"build": "pnpm -r build",
"dev": "pnpm -r dev",
"test": "pnpm -r test",
"lint": "eslint .",
"setup-git-hook": "bash src/scripts/git-hook-init-command.sh"
},
Expand Down Expand Up @@ -54,7 +55,7 @@
"typescript": "~5.6.2",
"typescript-eslint": "^8.18.2",
"vite": "^6.0.5",
"vitest": "^3.0.4"
"vitest": "^3.2.2"
},
"eslintConfig": {
"extends": [
Expand Down
7 changes: 6 additions & 1 deletion frontend/packages/calendar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
],
"scripts": {
"build": "tsup --clean",
"start": "tsup --watch"
"start": "tsup --watch",
"test": "vitest"
},
"publishConfig": {
"access": "public"
Expand All @@ -20,6 +21,10 @@
"@endolphin/ui": "workspace:^",
"@endolphin/theme": "workspace:^"
},
"devDependencies": {
"@endolphin/tsup-config": "workspace:^",
"@endolphin/vitest-config": "workspace:^"
},
"peerDependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
Expand Down
8 changes: 2 additions & 6 deletions frontend/packages/calendar/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { vanillaExtractPlugin } from '@vanilla-extract/esbuild-plugin';
import { reactConfig } from '@endolphin/tsup-config';
import { defineConfig } from 'tsup';

export default defineConfig({
format: ['esm'],
entry: ['src/index.ts'],
outDir: 'dist',
esbuildPlugins: [vanillaExtractPlugin()],
dts: true,
...reactConfig,
external: ['@endolphin/theme'],
banner: {
js: 'import \'./index.css\';',
Expand Down
16 changes: 16 additions & 0 deletions frontend/packages/calendar/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createAlias, reactConfig } from '@endolphin/vitest-config';
import path from 'path';
import { fileURLToPath } from 'url';
import { defineProject, mergeConfig } from 'vitest/config';

const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

export default mergeConfig(
reactConfig,
defineProject({
resolve: {
alias: createAlias(dirname),
},
}),
);
6 changes: 5 additions & 1 deletion frontend/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"./types": "./dist/src/types/index.js"
},
"scripts": {
"build": "tsc -b && tsc-alias"
"build": "tsc -b && tsc-alias",
"test": "vitest"
},
"devDependencies": {
"@endolphin/vitest-config": "workspace:^"
}
}
2 changes: 1 addition & 1 deletion frontend/packages/core/src/utils/date/date.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WEEK_MAP } from 'src/constants/date';
import { WEEK_MAP } from '@constants/date';

import { formatDateToWeek } from '.';

Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/core/src/utils/date/position.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TIME_HEIGHT } from 'src/constants/date';
import { TIME_HEIGHT } from '@constants/date';

import { getDateParts, setDateOnly } from './date';

Expand Down
16 changes: 16 additions & 0 deletions frontend/packages/core/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createAlias, reactConfig } from '@endolphin/vitest-config';
import path from 'path';
import { fileURLToPath } from 'url';
import { defineProject, mergeConfig } from 'vitest/config';

const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

export default mergeConfig(
reactConfig,
defineProject({
resolve: {
alias: createAlias(dirname),
},
}),
);
7 changes: 6 additions & 1 deletion frontend/packages/date-time/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
"dist"
],
"scripts": {
"build": "tsup --clean"
"build": "tsup --clean",
"test": "vitest"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@endolphin/tsup-config": "workspace:^",
"@endolphin/vitest-config": "workspace:^"
}
}
6 changes: 2 additions & 4 deletions frontend/packages/date-time/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { nodeConfig } from '@endolphin/tsup-config';
import { defineConfig } from 'tsup';

export default defineConfig({
format: ['esm'],
entry: ['src/index.ts'],
outDir: 'dist',
dts: true,
...nodeConfig,
});
16 changes: 16 additions & 0 deletions frontend/packages/date-time/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createAlias, nodeConfig } from '@endolphin/vitest-config';
import path from 'path';
import { fileURLToPath } from 'url';
import { defineProject, mergeConfig } from 'vitest/config';

const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

export default mergeConfig(
nodeConfig,
defineProject({
resolve: {
alias: createAlias(dirname),
},
}),
);
3 changes: 3 additions & 0 deletions frontend/packages/theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"types": "./dist/src/setup.d.ts"
}
},
"devDependencies": {
"@endolphin/tsup-config": "workspace:^"
},
"peerDependencies": {
"@endolphin/core": "workspace:^",
"@vanilla-extract/css": "^1.17.0",
Expand Down
Loading