Skip to content

๐Ÿ“– ์ธํ‹ฐ๊ทธ๋ ˆ์ด์…˜์—์„œ ์‚ฌ์šฉํ•œ Multi-framework Storybook ์†Œ์Šค์ฝ”๋“œ์ž…๋‹ˆ๋‹ค.

License

Notifications You must be signed in to change notification settings

shinheylynn/storybook-multi-framework

Repository files navigation





Project ์†Œ๊ฐœ

๐Ÿ“Œ ๋ฌธ์ œ์ 

  • Vue.js๋ฅผ ์‚ฌ์šฉํ•˜๋Š” Moreden
  • React.js๋ฅผ ์‚ฌ์šฉํ•˜๋Š” Medistream

๋‘ ์‚ฌ์ดํŠธ ๋ชจ๋‘ ๋™์ผํ•œ UI ์ปดํฌ๋„ŒํŠธ๋“ค์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์œผ๋‚˜, ํ”„๋ ˆ์ž„์›Œํฌ๊ฐ€ ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ๊ธฐ ๋‹ค๋ฅธ ์ €์žฅ์†Œ์—์„œ ๊ด€๋ฆฌ ์ค‘์ด์—ˆ์Œ.

์ปดํฌ๋„ŒํŠธ์— ์—…๋ฐ์ดํŠธ๊ฐ€ ์ƒ๊ธฐ๋ฉด ๋‘ ์ €์žฅ์†Œ์—์„œ ๋ชจ๋‘ ์ˆ˜์ •ํ•ด์•ผ ํ•œ๋‹ค๋Š” ๋ฒˆ๊ฑฐ๋กœ์›€์ด ์žˆ์—ˆ๊ธฐ ๋•Œ๋ฌธ์—, ํšจ์œจ๋„๋ฅผ ๋†’์ด๊ธฐ ์œ„ํ•ด์„œ ๋‹ค์–‘ํ•œ ํ”„๋ ˆ์ž„์›Œํฌ๋“ค์„ ํ•˜๋‚˜์˜ ์ €์žฅ์†Œ์—์„œ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค.

๐Ÿ’ก ๋ชฉํ‘œํ•œ ๋ฐ”๋ฅผ ์ด๋ฃจ๊ณ ์ž Storybook์˜ composition ๊ธฐ๋Šฅ์„ ํ™œ์šฉํ•˜์—ฌ ๊ตฌ์กฐ๋ฅผ ์„ค๊ณ„ํ•œ๋‹ค.


์— ๋Œ€ํ•ด

  1. Storybook ํŠœํ† ๋ฆฌ์–ผ ์ฝ์–ด๋ณด๊ธฐ
  2. UI ์ปดํฌ๋„ŒํŠธ ์ƒ์„ฑ ํ›„ ๋””์ž์ธ ์‹œ์Šคํ…œ์œผ๋กœ ์ œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•
  3. ๊ณต์‹ ๋ฌธ์„œ ์ฝ์–ด๋ณด๊ธฐ
  4. Composition ๊ธฐ๋Šฅ์— ๋Œ€ํ•ด ์ฝ์–ด๋ณด๊ธฐ

Storybook Multi-Framework ์ž‘์—…:

(ํŽธ์˜์ƒ React library๋ฅผ framework๋กœ ์ง€์นญํ•จ.)

2๊ฐœ ์ด์ƒ์˜ ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ํ•˜๋‚˜์˜ Storybook์œผ๋กœ ํ•ฉ์ณ์„œ ํ•˜๋‚˜์˜ ๋ ˆํฌ๋กœ ๊ด€๋ฆฌํ•œ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ๋‹ค์ˆ˜์˜ ํ”„๋ ˆ์ž„์›Œํฌ๋กœ ์ž‘์„ฑ๋œ UI๋“ค์„ ํšจ์œจ์ ์œผ๋กœ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค.


Architecture:

root
ใ„ด .storybook
	 story๋Š” ์—†๊ณ , react์™€ vue๋ฅผ compositionํ•˜๋Š” storybook.
ใ„ด stories
	 root-storybook์ด ๋™์ž‘ํ•˜๊ธฐ ์œ„ํ•œ ์ตœ์†Œ ํ•˜๋‚˜ ์ด์ƒ์˜ story๊ฐ€ ์กด์žฌํ•œ๋‹ค.
ใ„ด components
	 UI ์ปดํฌ๋„ŒํŠธ ๊ตฌ์„ฑํ•˜๋Š” jsx, vue ํŒŒ์ผ๋“ค์ด ๋ชจ์—ฌ์žˆ๋‹ค.
ใ„ด [+] react-storybook
	components ๋‚ด jsx๋ฅผ importํ•˜๋Š” story๋“ค์ด ๋ชจ์—ฌ์žˆ๋‹ค.
ใ„ด [+] vue-storybook
	components ๋‚ด vue๋ฅผ importํ•˜๋Š” story๋“ค์ด ๋ชจ์—ฌ์žˆ๋‹ค.

& ๋ฐฐํฌ:

๋ณธ ํ”„๋กœ์ ํŠธ๋Š” root storybook์„ ์ œ์™ธํ•œ ๊ฐ Framework Storybook๋“ค์„ Chromatic์„ ์ด์šฉํ•˜์—ฌ ๋ฐฐํฌํ•œ๋‹ค.

  • root storybook์€ ํšŒ์‚ฌ ๋‚ด ๊ทœ์ •๋Œ€๋กœ AWS S3๋ฅผ ์ด์šฉํ•˜์—ฌ ๋ฐฐํฌํ•จ.

Pipeline

pipelines:
  branches:
    develop:
      - step:
          name: Build
          deployment: Production
          image: node:18
          script:
            - npm install
            - npm run build-storybook
          artifacts:
            - storybook-static/**
      - step:
          name: Deploy to S3
          image: atlassian/pipelines-awscli
          script:
            - aws s3 sync --delete ./storybook-static s3://ui.integrationcorp.co.kr
            - aws cloudfront create-invalidation --distribution-id E2J4QL6EK16P4D --paths "/*"
    react:
      - step:
          name: Build & Deploy
          deployment: Production
          image: node:18
          script:
            - npm install
            - cd storybook-react
            - npm install
            - npm run build-storybook 
            - npx chromatic --project-token $REACT_STORYBOOK_TOKEN --exit-zero-on-changes
          artifacts:
            - storybook-react/storybook-static/**
    vue:
      - step:
          name: Build & Deploy
          deployment: Production
          image: node:16
          script:
            - npm install
            - cd storybook-vue
            - npm install
            - npm run build-storybook 
            - npx chromatic --project-token $VUE_STORYBOOK_TOKEN --exit-zero-on-changes
          artifacts:
            - storybook-vue/storybook-static/**
  tags:
    production-*:
      - step:
          name: Build
          deployment: Production
          image: node:18
          script:
            - npm install
            - npm run build-storybook
          artifacts:
            - storybook-static/**
      - step:
          name: Deploy to S3
          image: atlassian/pipelines-awscli
          script:
            - aws s3 sync --delete ./storybook-static s3://ui.integrationcorp.co.kr
            - aws cloudfront create-invalidation --distribution-id E2J4QL6EK16P4D --paths "/*"

package.json scripts:

npm scripts commands
"storybook" "storybook dev -p 6006"
"storybook:react" "cd storybook-react && npm install && npm run storybook"
"storybook:vue" "cd storybook-vue && npm install && npm run storybook"
"build-storybook" "storybook build"
"build-storybook:react" "cd storybook-react && npm install && npm run build-storybook"
"build-storybook:vue" "cd storybook-vue && npm install && npm run build-storybook"

About

๐Ÿ“– ์ธํ‹ฐ๊ทธ๋ ˆ์ด์…˜์—์„œ ์‚ฌ์šฉํ•œ Multi-framework Storybook ์†Œ์Šค์ฝ”๋“œ์ž…๋‹ˆ๋‹ค.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published