-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from copiest/feat/react
feat: react 패키지 추가
- Loading branch information
Showing
13 changed files
with
1,198 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@copiest/react": patch | ||
--- | ||
|
||
feat: react 패키지 추가 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
Build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
- name: setup pnpm and install dependencies | ||
uses: pnpm/action-setup@v3 | ||
with: | ||
version: 9.1.4 | ||
run_install: true | ||
- run: pnpm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,3 +128,5 @@ dist | |
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.* | ||
|
||
.turbo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
{ | ||
"name": "@copiest/frontend-libraries", | ||
"name": "copiest-frontend-libraries", | ||
"description": "copiest 공통 라이브러리", | ||
"private": true, | ||
"version": "0.0.0", | ||
"description": "", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/copiest/frontend-libraries.git" | ||
}, | ||
"scripts": { | ||
"build": "turbo run build", | ||
"release:canary": "pnpm build && changeset version --snapshot && pnpm publish --tag canary --no-git-checks" | ||
"build": "turbo run build" | ||
}, | ||
"keywords": [], | ||
"author": "@copiest", | ||
"packageManager": "pnpm@9.1.4", | ||
"devDependencies": { | ||
"turbo": "^1.13.3", | ||
"@changesets/cli": "^2.27.5" | ||
"@changesets/cli": "^2.27.5", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.4.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "@copiest/react", | ||
"version": "0.0.0", | ||
"description": "copiest 공통 react", | ||
"main": "./src/index.ts", | ||
"exports": { | ||
".": { | ||
"require": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
}, | ||
"import": { | ||
"types": "./dist/index.d.mts", | ||
"default": "./dist/index.mjs" | ||
} | ||
} | ||
}, | ||
"scripts": { | ||
"build": "tsc && tsup" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"react": "^18.3.1" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=17.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './useToggle' | ||
export * from './useBoolean' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useCallback, useState } from 'react'; | ||
|
||
export const useBooleanState = (defaultValue = false): readonly [boolean, () => void, () => void, () => void] => { | ||
const [bool, setBool] = useState(defaultValue); | ||
|
||
const setTrue = useCallback(() => { | ||
setBool(true); | ||
}, []); | ||
|
||
const setFalse = useCallback(() => { | ||
setBool(false); | ||
}, []); | ||
|
||
const toggle = useCallback(() => { | ||
setBool(b => !b); | ||
}, []); | ||
|
||
return [bool, setTrue, setFalse, toggle] as const; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useCallback, useState } from 'react'; | ||
|
||
export function useToggle(defaultValue = false): readonly [boolean, () => void] { | ||
const [state, setState] = useState(defaultValue); | ||
|
||
const toggle = useCallback(() => { | ||
setState(prev => !prev); | ||
}, []); | ||
|
||
return [state, toggle] as const; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './hooks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist" | ||
}, | ||
"include": ["src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from 'tsup'; | ||
|
||
export default defineConfig({ | ||
name: 'tsup', | ||
target: 'node16', | ||
format: ['cjs', 'esm'], | ||
outDir: 'dist', | ||
splitting: false, | ||
entry: ['./src/index.ts'], | ||
dts: { | ||
resolve: true, | ||
entry: './src/index.ts', | ||
}, | ||
}); |
Oops, something went wrong.