개인적으로 자주 쓰는 TypeScript 유틸을 공개용 패키지로 정리한 Turborepo 저장소입니다. 서로 성격이 다른 유틸을 작은 라이브러리로 나누어 관리하고 있습니다.
| 패키지 | 설명 | rxjs 필요 |
|---|---|---|
@cp949/registry |
가벼운 key-value 저장소. Registry, ReadableRegistry. |
아니오 |
@cp949/rx-registry |
RxJS 기반 관찰 가능한 저장소. RxRegistry, RxSortableRegistry. |
예 (peer) |
@cp949/rx-extra |
RxJS 보조 operator와 BehaviorSubject helper, SingleValueRxEmitter. |
예 (peer) |
@cp949/utilx |
자잘하지만 실용적인 유틸 모음. DisposableScope, URLCreateRegistry, BoundedBuffer, genId. |
아니오 |
설계 원칙은 다음과 같습니다.
@cp949/registry,@cp949/utilx는 zero 디펜던시입니다.- RxJS가 필요한 기능은
@cp949/rx-registry,@cp949/rx-extra로 분리했습니다.
import { Registry } from "@cp949/registry";
const users = new Registry<string, { name: string }>();
users.add("a", { name: "Alice" });
console.log(users.get("a")); // { name: "Alice" }import { DisposableScope } from "@cp949/utilx";
const scope = new DisposableScope();
scope.use(() => console.log("cleanup"));
scope.dispose();import { URLCreateRegistry } from "@cp949/utilx";
const registry = new URLCreateRegistry();
const url = registry.acquire(new Blob(["hello"], { type: "text/plain" }));
registry.release(url);handy-extras/
├── apps/
│ └── demo/ 사용법 확인용 데모 앱
├── packages/
│ ├── utilx/
│ ├── registry/
│ ├── rx-extra/
│ ├── rx-registry/
│ └── typescript-config/ 각 패키지가 공유하는 tsconfig preset
├── pnpm-workspace.yaml
├── turbo.json
└── biome.json
모든 명령은 루트에서 실행합니다.
pnpm install
pnpm build # 전체 패키지 tsup 빌드 (ESM + CJS + d.ts)
pnpm check-types # 전체 패키지 타입 검사
pnpm test # 전체 패키지 vitest 실행
pnpm lint # 전체 패키지 biome 검사
pnpm lint:fix # 전체 패키지 biome 자동 수정
pnpm format # biome 포맷팅특정 패키지만 실행하려면 -F 필터를 사용합니다.
pnpm -F @cp949/registry test
pnpm -F demo dev패키지별 문서는 각 패키지 디렉터리의 README.md에서 확인하실 수 있습니다.
- Node
>=18 - pnpm
10.26.0(루트packageManager에 고정)
배포 정책과 실제 명령은 RELEASE.md에 정리해두었습니다.
MIT