Skip to content

worksout/image-cdn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@worksout/image-cdn

Worksout 공용 이미지 유틸리티. CDN 호스트 레지스트리, URL 변환, 헤드리스 컴포넌트.

설치

yarn add 'github:worksout/image-cdn#v0.1.0'

사용

// 1. 부팅 시 1회 — 호스트 등록 (프로젝트별 리전에 맞게)
import { registerHosts } from '@worksout/image-cdn';

registerHosts({
  cdnHosts: ['media.strapi-jp.worksout-labs.com'],
  s3ToCdnMap: {
    'media-worksout-strapi-jp.s3.ap-northeast-1.amazonaws.com':
      'media.strapi-jp.worksout-labs.com'
  }
});
// 2. 어디서든 동일하게
import {
  getStrapiSrc,
  buildStrapiSrcSet,
  Picture,
  fromStrapiMedia
} from '@worksout/image-cdn';

<img src={getStrapiSrc(media, 800)} />
<Picture
  source={fromStrapiMedia(media)}
  pcWidth={1600}
  mobileWidth={828}
  alt="..."
/>

아키텍처

src/
├── core/        # React 의존 0. 순수 도메인 (HostRegistry, transform, types)
├── adapters/    # 외부 응답 → ImageSource 정규화
├── components/  # 헤드리스 React 컴포넌트 (className만 prop)
└── index.ts     # 단일 진입점

빌드

yarn install
yarn build       # tsup → ESM + CJS + .d.ts
yarn typecheck

릴리즈

  1. PR 머지 후 package.json version bump
  2. git tag vX.Y.Z && git push origin vX.Y.Z
  3. 각 사용처에서 package.json#vX.Y.Z 갱신

About

Worksout shared image utilities (CDN host registry, URL transform, headless components)

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors