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

[SMH-89] design-system 모듈 불러오기 실패하는 문제 해결 작업 #30

Merged
merged 6 commits into from
Jun 14, 2024
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint:fix:all
pnpm lint:fix:all
pnpm type-check
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"stylelint:fix": "stylelint './packages/**/src/**/*.{tsx,ts,js}' --fix",
"lint:all": "pnpm lint && pnpm prettier && pnpm stylelint",
"lint:fix:all": "pnpm lint:fix && pnpm prettier:fix && pnpm stylelint:fix",
"type-check": "tsc --noEmit -p packages/design-system && tsc --noEmit -p packages/missionary-admin && tsc --noEmit -p packages/missionary-app",
"dev:admin": "pnpm --filter missionary-admin dev",
"dev:app": "pnpm --filter missionary-app dev",
"dev:ds": "pnpm --filter design-system dev",
Expand Down
4 changes: 2 additions & 2 deletions packages/design-system/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const nextConfig = {
emotion: true,
},
webpack: (config) => {
config.module.rules.push({ // 웹팩설정에 로더 추가함
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
});
return config
return config;
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from '@emotion/styled/macro';
import styled from '@emotion/styled';
import { css } from '@emotion/react';
import { colors } from '@styles/color';
import type { ButtonProps } from '.';
Expand Down
3 changes: 2 additions & 1 deletion packages/design-system/src/components/button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { type ButtonHTMLAttributes } from 'react';
import type { ButtonColorMap } from './ButtonLayout';
import { ButtonWrapper } from './ButtonLayout';
Expand All @@ -7,7 +9,6 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
width: React.CSSProperties['width'];
size: 'sm' | 'md' | 'lg' | 'xlg' | 'xxlg';
color?: keyof typeof ButtonColorMap;
children?: React.ReactNode;
}

export function Button({
Expand Down
1 change: 1 addition & 0 deletions packages/design-system/src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export { Checkbox } from './checkbox';
export { CheckboxGroup } from './checkbox-group';
export { Radio } from './radio';
export { RadioGroup } from './radio-group';
export { Button } from './button';
2 changes: 2 additions & 0 deletions packages/design-system/src/components/input/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React from 'react';
import type { InputHTMLAttributes } from 'react';
import { InputLayout, InputBox, InputError } from './InputLayout';
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/components/modal/Modals.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { useContext } from 'react';
import { ModalStateContext } from '@context/ModalStateContext';
import { ModalDispatchContext } from '@context/ModalDispatchContext';
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/components/switch/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React, { createContext, type Ref, useMemo } from 'react';
import styled from '@emotion/styled';
import { useControllableState } from '@hooks';
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/components/tab/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React from 'react';
import { TabLayout, TabList } from './TabLayout';

Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/components/tooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import React from 'react';
import { TooltipWrapper } from './TooltipLayout';

Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/context/ModalDispatchContext.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import type { ComponentProps } from 'react';
import { createContext } from 'react';

Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/context/ModalProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import type { ComponentProps, ComponentType } from 'react';
import { useMemo, useState, type ReactNode } from 'react';
import { ModalDispatchContext } from './ModalDispatchContext';
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/context/ModalStateContext.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import type { ComponentProps, ElementType } from 'react';
import { createContext } from 'react';

Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/hooks/useContextAction.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import type { Context } from 'react';
import { useContext } from 'react';

Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/hooks/useContextData.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import type { Context } from 'react';
import { useContext } from 'react';

Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/hooks/useControllableState.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { useRef, useState } from 'react';
import { useEvent } from './useEvent';

Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/hooks/useEvent.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use client';

import React from 'react';
import { useLatestValue } from './useLatestValue';

export let useEvent =
// TODO: Add React.useEvent ?? once the useEvent hook is available
function useEvent<
F extends (...args: any[]) => any,

Check warning on line 9 in packages/design-system/src/hooks/useEvent.tsx

View workflow job for this annotation

GitHub Actions / setup-and-lint

Unexpected any. Specify a different type
P extends any[] = Parameters<F>,

Check warning on line 10 in packages/design-system/src/hooks/useEvent.tsx

View workflow job for this annotation

GitHub Actions / setup-and-lint

Unexpected any. Specify a different type
R = ReturnType<F>,
>(fn: (...args: P) => R) {
let cache = useLatestValue(fn);
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/hooks/useLatestValue.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { useEffect, useRef } from 'react';

export const useLatestValue = <T,>(value: T) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/hooks/useModals.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { useContext } from 'react';
import { ModalDispatchContext } from '@context/ModalDispatchContext';

Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/hooks/useSafeContext.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import type { Context } from 'react';
import { useContext } from 'react';

Expand Down
1 change: 1 addition & 0 deletions packages/design-system/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './styles/_global.scss';

export * from './components';
export * from './utils';
export * from './hooks';
2 changes: 2 additions & 0 deletions packages/design-system/src/utils/forwardRefWithAs.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { forwardRef } from 'react';

/**
Expand Down
33 changes: 30 additions & 3 deletions packages/design-system/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"baseUrl": "./src",
"paths": {
"@*": [
"./*"
]
}
},
"types": [
"@emotion/react/types/css-prop"
]
},
"extends": "../../tsconfig.base.json",
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
}
1 change: 1 addition & 0 deletions packages/missionary-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"preview": "next preview"
},
"dependencies": {
"@samilhero/design-system": "workspace:*",
"axios": "^1.6.8"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/missionary-admin/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@styles/_global.scss';
import type { Metadata } from 'next';

import { EmotionProvider } from '../lib/EmotionProvider';
import { EmotionProvider } from 'lib/EmotionProvider';

const RootLayout = ({ children }: { children: React.ReactNode }) => {
return (
Expand Down
11 changes: 10 additions & 1 deletion packages/missionary-admin/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import { Button, Checkbox } from '@samilhero/design-system';

export default function Home() {
return <main>선교 상륙 작전1</main>;
return (
<main>
<Checkbox>체크박스입니다.</Checkbox>
<Button size="md" width={100}>
버튼입니다.
</Button>
</main>
);
}
1 change: 0 additions & 1 deletion packages/missionary-admin/src/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/missionary-admin/src/lib/EmotionProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { ThemeProvider } from '@emotion/react';

import { theme } from '@styles/theme';
import { theme } from 'styles/theme';

export function EmotionProvider({ children }: { children: React.ReactNode }) {
return <ThemeProvider theme={theme}>{children}</ThemeProvider>;
Expand Down
7 changes: 5 additions & 2 deletions packages/missionary-admin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@*": [
"./*"
"../../design-system/src/*"
]
}
},
"extends": "../../tsconfig.base.json",
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
3 changes: 3 additions & 0 deletions packages/missionary-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"start": "next start",
"preview": "next preview"
},
"dependencies": {
"@samilhero/design-system": "workspace:*"
},
"devDependencies": {
"sass": "^1.75.0"
}
Expand Down
5 changes: 4 additions & 1 deletion packages/missionary-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"baseUrl": "./src",
"paths": {
"@*": [
"./*"
"../../design-system/src/*"
]
}
},
Expand All @@ -13,5 +13,8 @@
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}
Loading