Skip to content

Commit

Permalink
chore: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
artechventure authored and raon0211 committed Oct 8, 2022
0 parents commit eca0325
Show file tree
Hide file tree
Showing 2,988 changed files with 110,617 additions and 0 deletions.
229 changes: 229 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
version: 2.1

parameters:
pull_request:
type: boolean
default: false

orbs:
slack: circleci/[email protected]

commands:
setup:
steps:
- run:
name: Install yarn
command: |
COREPACK_PATH=$HOME/.local/bin
mkdir -p $COREPACK_PATH
eval "$(echo PATH=$COREPACK_PATH:\$PATH | tee -a $BASH_ENV)"
corepack enable --install-directory $COREPACK_PATH
yarn install --immutable --immutable-cache
- run:
name: Setup git
command: |
export GITHUB_TOKEN="$GITHUB_TOKEN"
git remote set-url origin https://${GITHUB_TOKEN}@github.com/toss/slash.git
git fetch --all --tags
git fetch --force --progress -- origin +refs/heads/main:refs/remotes/origin/main
git config user.email "[email protected]"
git config user.name "Toss Frontend Chapter"
export_published_version:
description: Export Publised Version Environment Variable
steps:
- run:
name: Export PUBLISHED_VERSION
command: echo "export PUBLISHED_VERSION=$(node -p "require('./lerna.json').version")" >> $BASH_ENV
export_commit_message:
description: Export Commit Message
steps:
- run:
name: Export COMMIT_MESSAGE
command: echo "export COMMIT_MESSAGE=\"$(printf "%s\n" "$(git log --format=%B -n 1 "$CIRCLE_SHA1" | head -n 1)")\"" >> $BASH_ENV

jobs:
lint:
docker:
- image: cimg/node:16.17
steps:
- checkout
- setup
- run:
name: Lint
command: yarn eslint -c .eslintrc.js $(git diff --name-only --diff-filter=ACMRUXB origin/main | grep -E "(.js$|.ts$|.tsx$)")
typecheck:
parallelism: 2
docker:
- image: cimg/node:16.17
steps:
- checkout
- setup
- run:
name: Typecheck
command: |
WORKSPACES_TO_TEST=$(
yarn workspaces since list origin/main HEAD |
circleci tests split
)
echo $WORKSPACES_TO_TEST
INCLUDE=$(
echo $WORKSPACES_TO_TEST |
# 띄어쓰기로 연결된 문자열을 콤마로 연결
sed 's/ /,/g'
)
yarn workspaces since run "typecheck" remotes/origin/main --include="{$INCLUDE}"
pre-pack:
parallelism: 2
docker:
- image: cimg/node:16.17
steps:
- checkout
- setup
- run:
name: Prepack
command: |
WORKSPACES_TO_TEST=$(
yarn workspaces since list origin/main HEAD |
circleci tests split
)
echo $WORKSPACES_TO_TEST
INCLUDE=$(
echo $WORKSPACES_TO_TEST |
# 띄어쓰기로 연결된 문자열을 콤마로 연결
sed 's/ /,/g'
)
yarn workspaces since run "prepack" remotes/origin/main --include="{$INCLUDE}"
check-peer:
docker:
- image: cimg/node:16.17
steps:
- checkout
- setup
- run:
name: Check Peer Dependency
command: ./.scripts/check-peer.sh || (echo "Peer Dependency 오류가 발생했습니다."; exit -1)

test:
docker:
- image: cimg/node:16.17
parallelism: 2
steps:
- checkout
- setup
- run:
name: Jest
command: |
UPDATED_PACKAGES=$(yarn workspaces since list origin/main HEAD)
echo "updated packages:"
echo $UPDATED_PACKAGES
UPDATED_DIRS=$(echo $UPDATED_PACKAGES | tr ' ' ',')
if [[ -z $UPDATED_DIRS ]]; then
echo "업데이트된 패키지가 없습니다."
exit 0
fi
# 테스트 파일이 없는 경우 아래 오류 발생
# panic: runtime error: index out of range [0] with length 0
if [[ -z $(circleci tests glob "{$UPDATED_DIRS}/**/*.{test,spec}.{ts,tsx}") ]]; then
echo "업데이트된 패키지에 실행할 테스트 파일이 없습니다."
exit 0
fi
TESTS=$(
circleci tests glob "{$UPDATED_DIRS}/**/*.{test,spec}.{ts,tsx}" | \
awk '!/__manual__/' | \
circleci tests split --split-by=timings
)
echo "tests to run:"
echo $TESTS | xargs -n 1 echo
if [[ -z $TESTS ]]; then
echo "실행할 테스트가 없습니다."
exit 0
fi
yarn jest $TESTS --passWithNoTests --runInBand
environment:
YARN_ENABLE_IMMUTABLE_INSTALLS: 'false'
JEST_JUNIT_OUTPUT_DIR: ./.test-reports/junit/
- store_test_results:
path: ./.test-reports/junit/
- store_artifacts:
path: ./.test-reports/junit

test-all:
docker:
- image: cimg/node:16.17
parallelism: 4
steps:
- checkout
- setup
- run:
name: Jest
command: |
yarn jest --runInBand
environment:
JEST_JUNIT_OUTPUT_DIR: ./.test-reports/junit/
- store_test_results:
path: ./.test-reports/junit/
- store_artifacts:
path: ./.test-reports/junit

save-git-cache:
docker:
- image: cimg/node:16.17
steps:
- checkout
- setup
- save_checkout_cache

workflows:
main:
jobs:
- test:
context:
- github-com-fe
- npm-public
filters:
branches:
ignore: main
- test-all:
context:
- github-com-fe
- npm-public
filters:
branches:
only: main
- lint:
context:
- github-com-fe
filters:
branches:
ignore: main
- typecheck:
context:
- github-com-fe
filters:
branches:
ignore: main
- pre-pack:
context:
- github-com-fe
filters:
branches:
ignore: main
- check-peer:
context:
- github-com-fe
filters:
branches:
ignore: main
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
84 changes: 84 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
module.exports = {
root: true,

env: {
es6: true,
node: true,
browser: true,
jest: true,
'shared-node-browser': true,
},

parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: { jsx: true },
},

extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'prettier',
],
plugins: ['@typescript-eslint', 'import', 'react', 'react-hooks', '@emotion'],
settings: { 'import/resolver': { typescript: {} }, react: { version: 'detect' } },
rules: {
'no-implicit-coercion': 'error',
'no-warning-comments': [
'warn',
{
terms: ['TODO', 'FIXME', 'XXX', 'BUG'],
location: 'anywhere',
},
],
curly: ['error', 'all'],
eqeqeq: ['error', 'always', { null: 'ignore' }],

'@emotion/pkg-renaming': 'error',

// Hoisting을 전략적으로 사용한 경우가 많아서
'@typescript-eslint/no-use-before-define': 'off',
// 모델 정의 부분에서 class와 interface를 합치기 위해 사용하는 용법도 잡고 있어서
'@typescript-eslint/no-empty-interface': 'off',
// 모델 정의 부분에서 파라미터 프로퍼티를 잘 쓰고 있어서
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-var-requires': 'warn',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
'@typescript-eslint/no-inferrable-types': 'warn',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/naming-convention': [
'error',
{ format: ['camelCase', 'UPPER_CASE', 'PascalCase'], selector: 'variable', leadingUnderscore: 'allow' },
{ format: ['camelCase', 'PascalCase'], selector: 'function' },
{ format: ['PascalCase'], selector: 'interface' },
{ format: ['PascalCase'], selector: 'typeAlias' },
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
'@typescript-eslint/member-ordering': [
'error',
{
default: [
'public-static-field',
'private-static-field',
'public-instance-field',
'private-instance-field',
'public-constructor',
'private-constructor',
'public-instance-method',
'private-instance-method',
],
},
],

'react/prop-types': 'off',
// React.memo, React.forwardRef에서 사용하는 경우도 막고 있어서
'react/display-name': 'off',
'react-hooks/exhaustive-deps': 'error',
'react/react-in-jsx-scope': 'off',
'react/no-unknown-property': ['error', { ignore: ['css'] }],
},
};
38 changes: 38 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Contributor Covenant Code of Conduct
Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
Our Standards

Examples of behavior that contributes to creating a positive environment include:

Using welcoming and inclusive language
Being respectful of differing viewpoints and experiences
Gracefully accepting constructive criticism
Focusing on what is best for the community
Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

The use of sexualized language or imagery and unwelcome sexual attention or advances
Trolling, insulting/derogatory comments, and personal or political attacks
Public or private harassment
Publishing others' private information, such as a physical or electronic address, without explicit permission
Other conduct which could reasonably be considered inappropriate in a professional setting

Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4
17 changes: 17 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contributing to Slash libraries

We welcome contribution from everyone in the community.

## How to contribute

You can contribute to Slash libraries via:

- Improving our [docs](https://slash.page)
- [Reporting a bug in our issues tab](https://github.com/toss/slash/issues/new)
- [Requesting a new feature or package](https://github.com/toss/slash/issues/new)
- [Having a look at our issue list](https://github.com/toss/slash/issues) to see what's to be fixed
- [Opening a pull request](https://github.com/toss/slash/compare) by yourself

## [Code of conduct](./CODE_OF_CONDUCT.md)

Every contributor to Slash libraries should adhere to our Code of Conduct. Please read the [full text](./CODE_OF_CONDUCT.md) to understand what actions will and will not be tolerated.
Loading

0 comments on commit eca0325

Please sign in to comment.