Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
raon0211 committed May 31, 2024
0 parents commit 7203b56
Show file tree
Hide file tree
Showing 279 changed files with 16,835 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
version: 2.1

parameters:
pull_request:
type: boolean
default: false

orbs:
slack: circleci/slack@4.5.0

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
jobs:
lint:
docker:
- image: cimg/node:20.12
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:
docker:
- image: cimg/node:20.12
steps:
- checkout
- setup
- run:
name: Typecheck
command: yarn tsc --noEmit
pre-pack:
docker:
- image: cimg/node:20.12
steps:
- checkout
- setup
- run:
name: Build
command: yarn build
check-peer:
docker:
- image: cimg/node:20.12
steps:
- checkout
- setup
- run:
name: Check Peer Dependency
command: ./.scripts/check-peer.sh || (echo "Peer Dependency 오류가 발생했습니다."; exit -1)
test:
docker:
- image: cimg/node:20.12
steps:
- checkout
- setup
- run:
name: vitest
command: yarn vitest --reporter=junit > ./.junit
- store_test_results:
path: ./.junit
- store_artifacts:
path: ./.junit

workflows:
main:
jobs:
- test:
filters:
branches:
ignore: main
- lint:
filters:
branches:
ignore: main
- typecheck:
filters:
branches:
ignore: main
- pre-pack:
filters:
branches:
ignore: main
- check-peer:
filters:
branches:
ignore: main
65 changes: 65 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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', 'prettier'],
plugins: ['@typescript-eslint'],
rules: {
'no-implicit-coercion': 'error',
'no-warning-comments': [
'warn',
{
terms: ['TODO', 'FIXME', 'XXX', 'BUG'],
location: 'anywhere',
},
],
curly: ['error', 'all'],
eqeqeq: ['error', 'always', { null: 'ignore' }],

'@typescript-eslint/no-use-before-define': 'off',
'@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',
],
},
],
},
};
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 frontend.devops@toss.im. 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
78 changes: 78 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Contributing to es-toolkit

We welcome contribution from everyone in the community. All communications in this repository will be in English.

> Every contributor to es-toolkit 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.
## 1. Our Design Priniciples

Note that we value performance, simplicity of implementation, and detailed documentations. We do not aim for supporting a variety of features and options. Our goal is to provide a small set of performant and well-functioning utilities.

### 1.1 Performance

All functions es-toolkit provides should be more performant than or similar with that of alternative libraries provide.

We measure the performance of our library every time our code is edited. We are using [vitest's benchmark feature](https://vitest.dev/api/#bench). For our benchmark code, please refer to our [benchmark directory](https://github.com/toss/es-toolkit/tree/main/benchmarks).

When a new functionality is added, a benchmark code should be added. Please add screenshots of the benchmarks when opening a pull request for easy reference and history tracking.

### 1.2 Simplicity

We value implementation and interface simplicity over a variety of features for performance, code readability, and easy maintenance. Our functions will not provide complex options to suit every usecase.

In this manner, instead of having complex options of making full use of overloading, etc, to support edge cases, we aim to provide the most simplest interface and implementation for the most common 85% usecases.

### 1.3 Documentation

All of our functions should be documented in detail for easy reference. All functions should have the jsdoc and corresponding documents [in our documentation directory](https://github.com/toss/es-toolkit/tree/main/docs) for all of their features.

We use English as our primary language, but we aim to support Korean documents in our best effort. If you have difficulties writing Korean documents, please let our contributors know so that we can provide the corresponding Korean documents for you.

## 2. Issues

You can contribute to es-toolkit via:

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

## 3. Pull Requests

> [Opening a pull request](https://github.com/toss/es-toolkit/compare) <br/>
You can raise your own pull request. The title of your pull request should match the following format:

```
<type>[function names]: <description>
```

> We do not care about the number, or style of commits in your history, because we squash merge every PR into main. <br/>
> Feel free to commit in whatever style you feel comfortable with.
### 3.1 Type

**Type must be one of those**

if you changed shipped code :

- feat - for any new functionality additions
- fix - for any fixes that don't add new functionality

if you haven't changed shipped code :

- docs - if you only change documentation
- test - if you only change tests

other :

- chore - anything else

### 3.2 Function Names

The name of function that you made changes. (ex: debounce, throttle)<br/>
If you made changes across multiple packages, writing package scope is optional.

### 3.3 Description

A clear and concise description of what the pr is about.
21 changes: 21 additions & 0 deletions .github/workflows/broken-link-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Broken link checker

on:
schedule:
- cron: '0 5 * * 1-5'
workflow_dispatch:
inputs: { url: { description: 'URL to check', required: false, default: 'https://es-toolkit.slash.page' } }

jobs:
broken-link-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: "yarn"
cache-dependency-path: "yarn.lock"
node-version-file: ".nvmrc"
- run: yarn install
- run: yarn blc ${{ github.event.inputs.url }} --ro
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Release

on:
push:
branches:
- "*"
tags:
- "v*.*.*"

jobs:
release:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
cache: "yarn"
cache-dependency-path: "yarn.lock"
node-version-file: ".nvmrc"
- if: github.ref_type == 'branch'
run: |
jq \
--arg build "$GITHUB_RUN_NUMBER" \
--arg commit "${GITHUB_SHA::8}" \
'.version = .version + "-dev." + $build + "+" + $commit' \
package.json > package.json.tmp
mv package.json.tmp package.json
- run: yarn install
- run: 'mkdir -p out && yarn pack --out out/%s-%v.tgz'
- id: extract-changelog
uses: dahlia/submark@5a5ff0a58382fb812616a5801402f5aef00f90ce
with:
input-file: CHANGELOG.md
heading-level: 2
heading-title-text: version ${{ github.ref_name }}
ignore-case: true
omit-heading: true
- run: "cat ${{ steps.extract-changelog.outputs.output-file }}"
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ steps.extract-changelog.outputs.output-file }}
repository: toss/es-toolkit
generate_release_notes: false
token: ${{ secrets.GITHUB_TOKEN }}
files: out/*.tgz
- if: |
github.event_name == 'push' &&
(github.ref_type == 'tag' || github.ref == 'refs/heads/main')
run: |
set -ex
npm config set //registry.npmjs.org/:_authToken "$NPM_AUTH_TOKEN"
npm whoami
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then
npm publish --access public *.tgz
else
npm publish --access public --tag dev *.tgz
fi
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
working-directory: ${{ github.workspace }}/out/
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.DS_Store

.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

.pnp.cjs
.pnp.loader.mjs

node_modules
coverage
dist
esm
.junit
out
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.nvmrc
Loading

0 comments on commit 7203b56

Please sign in to comment.