Skip to content

Commit

Permalink
feat: vite 초기세팅
Browse files Browse the repository at this point in the history
  • Loading branch information
nmc2711 committed Nov 24, 2023
0 parents commit 2e7c84a
Show file tree
Hide file tree
Showing 42 changed files with 12,475 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.config.*
56 changes: 56 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"airbnb",
"airbnb-typescript",
"airbnb/hooks",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:testing-library/react",
"plugin:jest-dom/recommended",
"plugin:prettier/recommended",
"plugin:storybook/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module",
"project": "tsconfig.json"
},
"plugins": ["react", "@typescript-eslint", "prettier"],
"rules": {
"react/react-in-jsx-scope": 0,
"import/prefer-default-export": 0,
"jsx-a11y/label-has-associated-control": 0,
"react/jsx-props-no-spreading": 0,
"no-param-reassign": 0,
"react/require-default-props": 0,
"react/button-has-type": 0,
"@typescript-eslint/no-shadow": 0,
"@typescript-eslint/no-unused-vars": 1,
"no-restricted-syntax": 0,
"prettier/prettier": [
0,
{
"endOfLine": "auto"
}
],
"import/extensions": [
0,
"never",
{
".js": "never",
".jsx": "never",
".ts": "never",
".tsx": "never"
}
]
}
}
20 changes: 20 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: friday
commit-message:
prefix: chore
labels: [chore]

- package-ecosystem: npm
directory: /
schedule:
interval: weekly
day: friday
commit-message:
prefix: chore
labels: [chore]
versioning-strategy: increase
40 changes: 40 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches: ['main']
pull_request:
branches: ['main']

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout
uses: actions/[email protected]

- name: Install PNPM
uses: pnpm/action-setup@v2
with:
version: 8.9.2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build project
run: pnpm build

- name: Run Tests
run: pnpm test:ci
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

coverage

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
17 changes: 17 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

echo 'Styling your project before committing'
echo 'please be patient, this may take a while...'

# Check ESLint Standards
pnpm lint ||
(
echo 'you have a problem in your code. Check linter
Run yarn lint, add changes and try commit again.';
false;
)

echo '🎉 No error found: committing this now.... ✨🚀🏄‍♂️🍻'

pnpm lint-staged
11 changes: 11 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
// Type check TypeScript files
'**/*.(ts|tsx)': () => 'pnpm tsc --noEmit',

// Lint & Prettify TS and JS files
'**/*.(ts|tsx|js)': () => [`pnpm lint --fix`, `pnpm format`],

// Prettify only Markdown and JSON files
'**/*.(md|json)': (filenames) =>
`pnpm prettier --write ${filenames.join(' ')}`,
};
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
public
yarn.lock
pnpm-lock.yaml
package-lock.json
vite.config.ts
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"endOfLine": "lf",
"plugins": [
"prettier-plugin-tailwindcss"
]
}
21 changes: 21 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
'storybook-addon-react-router-v6',
'@storybook/addon-themes'
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
};
export default config;
16 changes: 16 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Preview } from '@storybook/react';
import '../src/index.css';

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"yoavbls.pretty-ts-errors",
"formulahendry.auto-rename-tag",
"usernamehw.errorlens"
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Hans Tanawi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 로케지송. 프론트엔드 저장소

작업자: 황상한, 김미정, 박우림 <br />

pnpm , vite, react, jotai, typescript, react, emotion, scss, axios etc..
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/react.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>로켓지송 프론트엔드</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
48 changes: 48 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
setupFiles: ['whatwg-fetch'],
// The test environment that will be used for testing, jsdom for browser environment
// https://jestjs.io/docs/configuration#testenvironment-string
testEnvironment: 'jsdom',
// A list of paths to directories that Jest should use to search for files in
// https://jestjs.io/docs/configuration#roots-arraystring
roots: ['<rootDir>/src/'],
// The glob patterns Jest uses to detect test files.
// https://jestjs.io/docs/configuration#testmatch-arraystring
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
// Jest transformations
// https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object
transform: {
'^.+\\.tsx?$': 'ts-jest', // Transform TypeScript files using ts-jest
},
// A list of paths to modules that run some code to configure or set up the testing framework before each test file in the suite is executed
// https://jestjs.io/docs/configuration#setupfilesafterenv-array
setupFilesAfterEnv: ['<rootDir>/test/jest.setup.ts'],
// Code coverage config
// https://jestjs.io/docs/configuration#collectcoveragefrom-array
coverageDirectory: '<rootDir>/coverage/',
collectCoverageFrom: [
'<rootDir>/src/**/*.{ts,tsx}',
'!**/__mocks__/**',
'!**/node_modules/**',
'!**/*.d.ts',
],
// Important: order matters, specific rules should be defined first
// https://jestjs.io/fr/docs/configuration#modulenamemapper-objectstring-string--arraystring
moduleNameMapper: {
// Handle svg files
'^.+\\.svg$': 'jest-svg-transformer',
// Handle CSS imports (with CSS modules)
// https://jestjs.io/docs/webpack#mocking-css-modules
'^.+\\.module\\.(css|sass|scss|less)$': 'identity-obj-proxy',
// Handle CSS imports (without CSS modules)
'^.+\\.(css|sass|scss|less)$': '<rootDir>/__mocks__/styleMock.js',
// Handle static assets
// https://jestjs.io/docs/webpack#handling-static-assets
'^.+\\.(jpg|jpeg|png|gif|webp|avif|svg|ttf|woff|woff2)$': `<rootDir>/__mocks__/fileMock.js`,
// Handle TypeScript path aliases
'^@/(.*)$': '<rootDir>/src/$1',
},
verbose: true,
testTimeout: 30000,
};
Loading

0 comments on commit 2e7c84a

Please sign in to comment.