Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Bug Template
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---

## 어떤 버그인가요?

<!-- 어떤 버그인지 간결하게 설명해주세요 -->

## 어떤 상황에서 발생한 버그인가요?

<!-- (가능하면) Given-When-Then 형식으로 서술해주세요 -->

## 예상 결과

<!-- 예상했던 정상적인 결과가 어떤 것이었는지 설명해주세요 -->

## 참고할만한 자료(선택)
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature Template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

## 이슈에 대해 설명해 주세요.

<!-- 추가하려는 기능에 대해 간결하게 설명해주세요 -->

## 작업 상세 내용

- [ ] TODO

## 참고할만한 자료(선택)
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## #️⃣연관된 이슈

<!-- resolves: #이슈번호, #이슈번호 -->

## 📝작업 내용

<!-- 이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능) -->

### 스크린샷 (선택)

## 💬리뷰 요구사항(선택)

<!-- 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요
ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요? -->
92 changes: 92 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Check

on:
pull_request:
branches:
- '*'

jobs:
check:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js 20.x for corepack
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://npm.pkg.github.com'
scope: '@ummgoban'

- name: Enable Corepack and Set yarn Version
run: |
npm install -g corepack@latest
corepack enable

- name: Setup Node.js 20.x for yarn
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: yarn

- name: Create .env
run: |
echo "NPM_TOKEN=${{ secrets.NPM_TOKEN }}" > .env

- name: Install dependencies
run: |
sh .script/pre-install.sh
yarn install

- name: Lint
id: lint_check
continue-on-error: true
run: |
yarn lint:check
echo $? > lint_result

- name: Format
id: format_check
continue-on-error: true
run: |
yarn format:check
echo $? > format_result

- name: Type Check
id: type_check
continue-on-error: true
run: |
yarn type-check
echo $? > type_result

- name: Test
id: test_check
continue-on-error: true
run: |
yarn test
echo $? > test_result

- name: Build
id: build
continue-on-error: true
run: |
yarn build
echo $? > build_result

- name: Check Lint & Format & Type Check & Test & Build Results
id: check_results
run: |
if [ "$(cat lint_result)" -eq 0 ] && [ "$(cat format_result)" -eq 0 ] && [ "$(cat type_result)" -eq 0 ] && [ "$(cat test_result)" -eq 0 ] && [ "$(cat build_result)" -eq 0 ]; then
echo "all_pass=true" >> $GITHUB_ENV
else
echo "all_pass=false" >> $GITHUB_ENV
fi

- name: post-install
run: sh .script/post-install.sh

- name: Remove .env
run: rm .env
16 changes: 10 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,24 @@ jobs:
yarn test
echo $? > test_result

- name: Check Lint & Format & Type Check & Test Results
- name: Build
id: build
continue-on-error: true
run: |
yarn build
echo $? > build_result

- name: Check Lint & Format & Type Check & Test & Build Results
id: check_results
run: |
if [ "$(cat lint_result)" -eq 0 ] && [ "$(cat format_result)" -eq 0 ] && [ "$(cat type_result)" -eq 0 ] && [ "$(cat test_result)" -eq 0 ]; then
if [ "$(cat lint_result)" -eq 0 ] && [ "$(cat format_result)" -eq 0 ] && [ "$(cat type_result)" -eq 0 ] && [ "$(cat test_result)" -eq 0 ] && [ "$(cat build_result)" -eq 0 ]; then
echo "all_pass=true" >> $GITHUB_ENV
else
echo "all_pass=false" >> $GITHUB_ENV
fi

- name: Build
if: env.all_pass == 'true'
run: yarn build

- name: Publish
if: env.all_pass == 'true'
run: yarn npm publish --access=public

- name: post-install
Expand Down
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# shared

ummgoban 공통 패키지
ummgoban 공통 패키지입니다.

- ummgoban 도메인에서 공용으로 사용하는 type, utils, http client, hook 등을 관리합니다.
- 사장님앱, 고객앱에서만 사용되는 각 코드는 해당 프로젝트에서 관리합니다.

# install

Expand All @@ -11,9 +14,12 @@ yarn add @ummgoban/shared
# exports

- `@ummgoban/shared`
- `@ummgoban/shared/api-client`
- `@ummgoban/shared/utils`
- `@ummgoban/shared/react`
- `@ummgoban/shared/types`
- `@ummgoban/shared/utils`
- `@ummgoban/shared/http`
- `@ummgoban/shared/http/error`
- `@ummgoban/shared/http/api-client`

# dev

Expand Down Expand Up @@ -47,3 +53,14 @@ yarn lint
```bash
yarn format
```

# publish

- `package.json`의 버전을 증가시킵니다. (`v[x].[y].[z]` 또는 `v[x].[y].[z]-[alpha|candy|rc].[n]`)
- `main` 브랜치에 머지 후 `git tag`로 버전을 생성한 후 `git push`를 실행합니다.

# ummgoban productions

- apps
- [client](https://github.com/ummgoban/client-app)
- [admin](https://github.com/ummgoban/admin-client-app)
1 change: 1 addition & 0 deletions jest-dom.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/jest-dom';
27 changes: 24 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,39 @@
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"./react": {
"types": "./dist/ummgoban-react/index.d.ts"
},
"./types": {
"types": "./dist/lib/types/index.d.ts"
},
"./utils": {
"types": "./dist/lib/utils/index.d.ts"
},
"./http": {
"types": "./dist/ummgoban-http/index.d.ts"
},
"./error": {
"types": "./dist/ummgoban-http/error/index.d.ts"
},
"./api-client": {
"types": "./dist/lib/api-client/index.d.ts"
"types": "./dist/ummgoban-http/api-client/index.d.ts"
}
},
"files": [
"dist"
],
"scripts": {
"ci": "./.script/ci.sh",
"build": "rollup -c",
"build": "rm -rf dist && rollup -c",
"test": "vitest run",
"dev": "vite",
"type-check": "tsc --noEmit",
"lint": "eslint src --ext .ts,.tsx --fix",
"lint:check": "eslint src --ext .ts,.tsx",
"format": "prettier --write src",
"format:check": "prettier --check src"
"format:check": "prettier --check src",
"test:all": "yarn lint:check && yarn format:check && yarn type-check && yarn test"
},
"repository": {
"type": "git",
Expand All @@ -49,9 +59,15 @@
"react": ">=18.0.0"
},
"devDependencies": {
"@rollup/plugin-alias": "^5.1.1",
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-typescript": "^12.0.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
"@types/axios": "^0.14.4",
"@types/react": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^8.23.0",
"@typescript-eslint/parser": "^8.23.0",
Expand All @@ -66,10 +82,15 @@
"jiti": "^2.4.2",
"jsdom": "^26.1.0",
"prettier": "^3.5.3",
"react-dom": "^18.0.0",
"rollup": "^4.41.1",
"tslib": "^2.8.1",
"typescript": "^5.0.0",
"vite": "^6.3.5",
"vitest": "^3.1.4"
},
"dependencies": {
"axios": "^1.7.4",
"react": "^18.0.0"
}
}
10 changes: 10 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import alias from '@rollup/plugin-alias';
import path from 'path';
import {fileURLToPath} from 'url';

import pkg from './package.json' assert {type: 'json'};

const __dirname = path.dirname(fileURLToPath(import.meta.url));

export default {
input: 'src/index.ts',
output: [
Expand All @@ -19,6 +25,9 @@ export default {
],
external: [...Object.keys(pkg.peerDependencies || {}), ...Object.keys(pkg.dependencies || {})],
plugins: [
alias({
entries: [{find: '@', replacement: path.resolve(__dirname, 'src')}],
}),
nodeResolve({extensions: ['.js', '.jsx', '.ts', '.tsx']}),
commonjs(),
typescript({
Expand All @@ -29,6 +38,7 @@ export default {
sourceMap: true,
rootDir: 'src',
jsx: 'react-jsx',
exclude: ['**/*.{spec,test}.{ts,tsx}'],
}),
],
};
2 changes: 0 additions & 2 deletions src/api-client/api-client.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/api-client/index.ts

This file was deleted.

7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// api-client
export * from './api-client';
// http
export * from './ummgoban-http';

// lib
export * from './lib';

// react
export * from './ummgoban-react';
16 changes: 14 additions & 2 deletions src/lib/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
// product
export * from './product.type';

// http error
export * from './http-error.type';
// order
export * from './order.type';

// market
export * from './market.type';

// user
export * from './user.type';

// review
export * from './review.type';

// session
export * from './session.type';

// storage
export * from './storage.type';
24 changes: 24 additions & 0 deletions src/lib/types/market.type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {ProductType} from './product.type';

export type MarketType = {
id: number;
name: string;
/** 픽업 시작 시간 (ISO 8601) */
pickupStartAt: string;
/** 픽업 종료 시간 (ISO 8601) */
pickupEndAt: string;
/** 영업 시작 시간 (ISO 8601) */
openAt: string;
/** 영업 종료 시간 (ISO 8601) */
closeAt: string;
/** 주소 */
address: string;
/** 구체적인 주소 */
specificAddress: string;
products: ProductType[];
/** 위도 */
latitude: number;
/** 경도 */
longitude: number;
images: string[];
};
Loading