React - TypeScript와 recoil, styled-components, craco를 이용한 절대경로 설정 등이 적용 되어 있는 템플릿입니다.
Installations
npm install cra-template-lasbe
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
16.17.0
NPM Version
8.15.0
Score
70.4
Supply Chain
99.3
Quality
75.6
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (51.81%)
HTML (36.65%)
JavaScript (11.54%)
Developer
LasBe-code
Download Statistics
Total Downloads
1,038
Last Day
1
Last Week
20
Last Month
23
Last Year
183
GitHub Statistics
9 Commits
1 Watching
1 Branches
1 Contributors
Bundle Size
937.00 B
Minified
487.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.0.6
Package Id
cra-template-lasbe@1.0.6
Unpacked Size
35.59 kB
Size
23.22 kB
File Count
17
NPM Version
8.15.0
Node Version
16.17.0
Publised On
09 Sept 2023
Total Downloads
Cumulative downloads
Total Downloads
1,038
Last day
0%
1
Compared to previous day
Last week
1,900%
20
Compared to previous week
Last month
666.7%
23
Compared to previous month
Last year
-78.6%
183
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
No dependencies detected.
⚡ cra-template-lasbe
React - TypeScript와 recoil, styled-components, craco를 이용한 절대경로 설정 등이 적용 되어 있는 템플릿입니다. 오류를 발견하신 분은 devlasbe@gmail.com으로 연락 바랍니다.📌 git repository
📌 npm
📌 프로젝트 생성
1$ npx create-react-app my-app --template lasbe
📌 템플릿 적용 목록
- React (^18.2.0)
- TypeScript (^4.9.5)
- .prettierrc
- Craco
- Axios
- styled-components
- @types/styled-components (dev)
- react-spinners
- react-router-dom
- recoil
- @tanstack/react-query
- @tanstack/react-query-devtools (dev)
🔎 index.tsx
1import React from 'react'; 2import ReactDOM from 'react-dom/client'; 3import App from './App'; 4import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; 5import { RecoilRoot } from 'recoil'; 6import { BrowserRouter } from 'react-router-dom'; 7import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; 8 9const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement); 10 11const queryClient = new QueryClient({ 12 defaultOptions: { 13 queries: { 14 suspense: true, 15 staleTime: 5 * 60 * 1000, 16 cacheTime: 5 * 60 * 1000, 17 }, 18 }, 19}); 20 21root.render( 22 <React.StrictMode> 23 <QueryClientProvider client={queryClient}> 24 <RecoilRoot> 25 <BrowserRouter> 26 <App /> 27 </BrowserRouter> 28 </RecoilRoot> 29 <ReactQueryDevtools initialIsOpen={false} /> 30 </QueryClientProvider> 31 </React.StrictMode>, 32);
- react-router-dom -
<BrowserRouter />
in index.tsx - recoil -
<RecoilRoot />
in index.tsx - @tanstack/react-query -
<QueryClientProvider />
in index.tsx - @tanstack/react-query-devtools (dev) -
<ReactQueryDevtools />
in index.tsx
🔎 절대 경로
절대 경로와 관련 된 설정은 /craco.config.js
, /tsconfig.paths.json
파일에 위치합니다.
- craco.config.js
1const path = require('path'); 2module.exports = { 3 webpack: { 4 alias: { 5 '@apis': path.resolve(__dirname, 'src/apis'), 6 '@components': path.resolve(__dirname, 'src/components'), 7 '@constants': path.resolve(__dirname, 'src/constants'), 8 '@hooks': path.resolve(__dirname, 'src/hooks'), 9 '@pages': path.resolve(__dirname, 'src/pages'), 10 '@states': path.resolve(__dirname, 'src/states'), 11 '@styles': path.resolve(__dirname, 'src/styles'), 12 '@utils': path.resolve(__dirname, 'src/utils'), 13 }, 14 }, 15};
- tsconfig.paths.json
1{ 2 "compilerOptions": { 3 "baseUrl": "./src", 4 "paths": { 5 "@apis": ["./apis/index.ts"], 6 "@apis/*": ["./apis/*"], 7 8 "@components": ["./components/index.ts"], 9 "@components/*": ["./components/*"], 10 11 "@constants": ["./constants/index.ts"], 12 "@constants/*": ["./constants/*"], 13 14 "@hooks": ["./hooks/index.ts"], 15 "@hooks/*": ["./hooks/*"], 16 17 "@pages": ["./pages/index.ts"], 18 "@pages/*": ["./pages/*"], 19 20 "@states": ["./states/index.ts"], 21 "@states/*": ["./states/*"], 22 23 "@styles": ["./styles/index.ts"], 24 "@styles/*": ["./styles/*"], 25 26 "@utils": ["./utils/index.ts"], 27 "@utils/*": ["./utils/*"] 28 } 29 } 30}
제가 주로 사용하는 구조에 맞게 @xxx
형태로 절대 경로를 설정해 주었으며, tsconfig에는 폴더 인덱스까지 적용되어 있습니다.
만약 다른 구조를 사용한다면 두 파일에서 수정하시면 됩니다.
🔎 .prettierrc
1{ 2 "Semicolons": true, 3 "singleQuote": true, 4 "trailingComma": "all", 5 "Tabs": true, 6 "tabWidth": 2, 7 "printWidth": 140 8}
입맛에 맞게 수정하시면 됩니다.
No vulnerabilities found.
No security vulnerabilities found.
Gathering detailed insights and metrics for cra-template-lasbe