Skip to content

Commit

Permalink
[DOCS] 깃헙 action workflow (#7)
Browse files Browse the repository at this point in the history
* [FEAT] 경매 카드 구현 (#4)

* feat: next, storybook svg webpack 설정 추가

* feat: AuctionCard  구현 및 스토리북 연동

* feat: hover시 그림자 추가

* fix: api 없음 이슈로 생기는 에러 처리

* feat: image 속성 추가

* feat: 현재가 추가

* docs: github action 추가

* refactor: 폴더명 변경

---------

Co-authored-by: 해진 <86779590+haejinyun@users.noreply.github.com>
  • Loading branch information
kimeodml and haejinyun authored Sep 20, 2024
1 parent ce45f9e commit 1965a8e
Show file tree
Hide file tree
Showing 11 changed files with 772 additions and 4 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/PR_CHECK.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: check tsc and lint
on:
push:
branches:
- main
- develop
- hotfix
pull_request:
branches:
- main
- develop
- hotfix

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install

- name: Check tsc
run: npx tsc

- name: Check eslint
run: npm run lint
20 changes: 19 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config: StorybookConfig = {
docs: {
autodocs: 'tag',
},
webpackFinal(config, options) {
webpackFinal: async config => {
// Add Vanilla-Extract and MiniCssExtract Plugins
config.plugins?.push(new VanillaExtractPlugin(), new MiniCssExtractPlugin());

Expand All @@ -33,6 +33,7 @@ const config: StorybookConfig = {
rule.exclude = /\.vanilla\.css$/i;
}
});

config.module?.rules?.push({
test: /\.vanilla\.css$/i, // Targets only CSS files generated by vanilla-extract
use: [
Expand All @@ -46,7 +47,24 @@ const config: StorybookConfig = {
],
});

// Find existing rule that handles .svg files and exclude .svg from it
const imageRule = config.module?.rules?.find(rule => {
const test = (rule as { test: RegExp }).test;
return test && test.test('.svg');
}) as { [key: string]: any };

if (imageRule) {
imageRule.exclude = /\.svg$/; // Exclude SVG from existing image rule
}

// Add new rule to handle SVGs with @svgr/webpack
config.module?.rules?.push({
test: /\.svg$/,
use: ['@svgr/webpack'], // Use @svgr/webpack for SVG files
});

return config;
},
};

export default config;
4 changes: 4 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
export default content;
}
13 changes: 12 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ import { createVanillaExtractPlugin } from '@vanilla-extract/next-plugin';
const withVanillaExtract = createVanillaExtractPlugin();

/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
webpack: config => {
config.module.rules.push({
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack'],
});
return config;
},
};

export default withVanillaExtract(nextConfig);
Loading

0 comments on commit 1965a8e

Please sign in to comment.