diff --git a/.codeclimate.yml b/.codeclimate.yml
new file mode 100644
index 0000000..0ebf530
--- /dev/null
+++ b/.codeclimate.yml
@@ -0,0 +1,7 @@
+version: "2"
+exclude_patterns:
+ - "scripts/"
+ - "**/*test.js"
+ - "**/*test.ts"
+ - "**/*spec.js"
+ - "**/*spec.ts"
diff --git a/.commitlintrc.cjs b/.commitlintrc.cjs
new file mode 100644
index 0000000..595b9b9
--- /dev/null
+++ b/.commitlintrc.cjs
@@ -0,0 +1 @@
+module.exports = require('./configs/commitlintrc.cjs');
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
new file mode 100644
index 0000000..84b637c
--- /dev/null
+++ b/.eslintrc.cjs
@@ -0,0 +1 @@
+module.exports = require('./configs/eslintrc.cjs');
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..0890a08
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,65 @@
+name: ci
+
+# 当推送到 main分支 时 触发此工作流
+on:
+ push:
+ branches:
+ - main
+permissions:
+ contents: write
+
+jobs:
+ build-and-deploy:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: checkout
+ uses: actions/checkout@main
+
+ # 全局安装 pnpm
+ - name: install pnpm
+ run: npm install -g pnpm
+
+ # 使用 pnpm 安装依赖
+ - name: install dependencies
+ run: pnpm install
+
+ # 使用 pnpm 执行测试
+ - name: run tests
+ run: pnpm test:ci
+
+ # 上传覆盖率报告到 Coveralls
+ - name: Upload coverage reports to Codecov
+ uses: codecov/codecov-action@main
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+
+ # 使用 pnpm 构建
+ - name: build
+ run: pnpm build
+
+ # 自动发布
+ - name: Auto Release
+ run: npx cvlar -r
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ # 同步到 Gitee
+ - name: Sync to Gitee
+ uses: wearerequired/git-mirror-action@master
+ env:
+ SSH_PRIVATE_KEY: ${{ secrets.GITEE_PRIVATE_KEY }}
+ with:
+ source-repo: 'git@github.com:kwooshung/algorithm-sorts.git'
+ destination-repo: 'git@gitee.com:kwooshung/algorithm-sorts.git'
+
+ # 自动发布到 npm
+ - name: Sync to Npm.js
+ uses: actions/setup-node@main
+ with:
+ node-version: '14.0.0'
+ registry-url: https://registry.npmjs.org/
+ - name: Publish to Npm.js
+ run: npm publish --access public
+ env:
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0dc1dc4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,24 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+lerna-debug.log*
+.eslintcache
+.stylelintcache
+node_modules
+dist
+dist-ssr
+coverage
+*.local
+# Editor directories and files
+.idea
+.DS_Store
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?
+.cvlar-commit-message-*.tmp
\ No newline at end of file
diff --git a/.husky/commit-msg b/.husky/commit-msg
new file mode 100644
index 0000000..0d30cdf
--- /dev/null
+++ b/.husky/commit-msg
@@ -0,0 +1,3 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+npx --no-install commitlint --edit $1
\ No newline at end of file
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100644
index 0000000..2542566
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1,3 @@
+#!/usr/bin/env sh
+. "$(dirname -- "$0")/_/husky.sh"
+npx lint-staged
\ No newline at end of file
diff --git a/.ks-cvlarrc.cjs b/.ks-cvlarrc.cjs
new file mode 100644
index 0000000..9a8e6ac
--- /dev/null
+++ b/.ks-cvlarrc.cjs
@@ -0,0 +1 @@
+module.exports = require('./configs/.ks-cvlarrc.cjs');
diff --git a/.lintstagedrc b/.lintstagedrc
new file mode 100644
index 0000000..e3c5700
--- /dev/null
+++ b/.lintstagedrc
@@ -0,0 +1,4 @@
+{
+ "*.{js,jsx,ts,tsx}": ["npx prettier --write", "npx eslint --fix"],
+ "*.json": ["npx prettier --write"]
+}
diff --git a/.prettierrc.cjs b/.prettierrc.cjs
new file mode 100644
index 0000000..770cbce
--- /dev/null
+++ b/.prettierrc.cjs
@@ -0,0 +1,41 @@
+module.exports = {
+ eslintInter: true,
+ // 一行最多 200 字符
+ printWidth: 200,
+ // 使用 2 个空格缩进
+ tabWidth: 2,
+ // 不使用缩进符,而使用空格
+ useTabs: false,
+ // 行尾分号
+ semi: true,
+ // 使用单引号
+ singleQuote: true,
+ // 对象的 key 仅在必要时用引号
+ quoteProps: 'as-needed',
+ // jsx 使用单引号
+ jsxSingleQuote: true,
+ // 尾随逗号
+ trailingComma: 'all',
+ // 大括号内的首尾需要空格
+ bracketSpacing: true,
+ // jsx 标签的反尖括号需要换行
+ jsxBracketSameLine: true,
+ // 箭头函数,只有一个参数的时候,也需要括号
+ arrowParens: 'always',
+ // 每个文件格式化的范围是文件的全部内容
+ rangeStart: 0,
+ // 需要格式化和检查的代码结束偏移值(从尾部开始)
+ rangeEnd: Infinity,
+ // 不需要写文件开头的 @prettier
+ requirePragma: false,
+ // 不需要自动在文件开头插入 @prettier
+ insertPragma: false,
+ // 使用默认的折行标准
+ proseWrap: 'preserve',
+ // 根据显示样式决定 html 要不要折行
+ htmlWhitespaceSensitivity: 'css',
+ // 去除对象最后一个逗号
+ trailingComma: 'none',
+ // 换行符使用 lf
+ endOfLine: 'lf'
+};
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b7156ea
--- /dev/null
+++ b/README.md
@@ -0,0 +1,132 @@
+
+
+# @kwooshung/algorithm-sorts
+
+![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/kwooshung/algorithm-sorts?labelColor=272e3b&color=00b42A&logo=github)
+![GitHub last commit](https://img.shields.io/github/last-commit/kwooshung/algorithm-sorts?labelColor=272e3b&color=165dff)
+![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/kwooshung/algorithm-sorts?labelColor=272e3b&color=165dff)
+![GitHub top language](https://img.shields.io/github/languages/top/kwooshung/algorithm-sorts?labelColor=272e3b&color=165dff)
+![GitHub pull requests](https://img.shields.io/github/issues-pr/kwooshung/algorithm-sorts?labelColor=272e3b&color=165dff)
+![GitHub issues](https://img.shields.io/github/issues/kwooshung/algorithm-sorts?labelColor=272e3b&color=165dff)
+[![NPM Version](https://img.shields.io/npm/v/@kwooshung/algorithm-sorts?labelColor=272e3b&color=165dff)](https://www.npmjs.com/package/@kwooshung/algorithm-sorts)
+[![Npm.js Downloads/Week](https://img.shields.io/npm/dw/@kwooshung/algorithm-sorts?labelColor=272e3b&labelColor=272e3b&color=165dff&logo=npm)](https://www.npmjs.com/package/@kwooshung/algorithm-sorts)
+[![Github CI/CD](https://github.com/kwooshung/algorithm-sorts/actions/workflows/ci.yml/badge.svg)](https://github.com/kwooshung/algorithm-sorts/actions/)
+[![codecov](https://codecov.io/gh/kwooshung/algorithm-sorts/graph/badge.svg?token=VVZJE7H0KD)](https://codecov.io/gh/kwooshung/algorithm-sorts)
+[![Maintainability](https://api.codeclimate.com/v1/badges/325d0881b1ca19165d35/maintainability)](https://codeclimate.com/github/kwooshung/algorithm-sorts/maintainability/)
+[![GitHub License](https://img.shields.io/github/license/kwooshung/algorithm-sorts?labelColor=272e3b&color=165dff)](LICENSE)
+[![Gitee Repo](https://img.shields.io/badge/gitee-cvlar-165dff?logo=gitee)](https://gitee.com/kwooshung/algorithm-sorts/)
+![Github Stars](https://img.shields.io/github/stars/kwooshung/algorithm-sorts?labelColor=272e3b&color=165dff)
+
+
+ 中文 |
+ English
+
+
+
+# Why was it developed?
+
+- During development, I needed to use algorithms and found the [algorithms.js](https://github.com/felipernb/algorithms.js) library. Its implementation is excellent. This project is based on [algorithms.js](https://github.com/felipernb/algorithms.js), with slight modifications in the [compare](src/internal/compare/index.ts) section.
+- [algorithms.js](https://github.com/felipernb/algorithms.js) is implemented using the `commonjs` standard, not `esm`. This means it can't utilize `tree shaking`. While there are indirect methods to achieve this, they are not as convenient as using the `esm` standard directly.
+- [algorithms.js](https://github.com/felipernb/algorithms.js) hasn't been maintained for several years. Some algorithms and implementation logic would be better with a modern approach.
+
+# Why Use It?
+
+- Written in `Typescript` with unit testing, ensuring code quality with `100%` coverage.
+- Supports both `esm` and `commonjs` standards. The `esm` standard enables direct use of `tree shaking` to reduce the bundle size.
+- Clear documentation, including comments in both Chinese and English, making it easy to read and understand, as shown below.
+
+```ts
+/**
+ * 短冒泡排序 / Short Bubble Sort
+ * @description 短冒泡排序是冒泡排序的一种变体,当在整个排序过程中没有进行任何交换时,该算法会提前停止 / Short bubble sort is a variation of bubble sort that stops early if no swaps are made during the entire sorting process
+ * @usageScenario 适用于检测几乎已经排序好的数组 / Suitable for detecting nearly sorted arrays
+ * @timeComplexity 最好情况 O(n),平均和最坏情况 O(n^2) / Best case O(n), average and worst case O(n^2)
+ * @param {T[]} array 待排序数组 / Array to be sorted
+ * @param {boolean} [modifyOriginal=true] 是否修改原数组 / Whether to modify the original array
+ * @param {(a: T, b: T) => number} [compareFunction] 比较函数,定义元素的排序方式 / Comparison function, defines the sorting order of elements
+ * @param {boolean} [reverse=false] 是否反转结果 / Whether to reverse the result
+ */
+```
+
+- Compared to [algorithms.js](https://github.com/felipernb/algorithms.js), our sorting algorithms include several additional ones, with more to be added in the future.
+- In most cases, the efficiency of our library's algorithms is superior to [algorithms.js](https://github.com/felipernb/algorithms.js). There are comparative charts below, and you can also `git clone` this project and run `npm compare` for testing.
+
+# When Not to Use It?
+
+As the project name suggests, our project's algorithms only support `sorting`. If you need other types of algorithms, you might want to use [algorithms.js](https://github.com/felipernb/algorithms.js).
+
+# Efficiency Comparison
+
+The comparison involves random data of 1000 items, with string lengths varying from 6 to 32 and numbers ranging from 0 to 1,000,000, as shown below:
+
+| Algorithm | algorithms.js | @kwooshung/algorithm-sorts | Difference |
+| :---------------------- | :-----------: | :------------------------: | :------------: |
+| Bubble Sort | 65.0368 ms | 65.0298 ms | -0.0070 ms |
+| Shout Bubble Sort | 13251.3260 ms | 128.2500 ms | -13123.0760 ms |
+| Cocktail Sort | - | 52.7166 ms | - |
+| Counting Sort | - | 12.3503 ms | - |
+| Optimized Counting Sort | 33.2357 ms | 32.6380 ms | -0.5977 ms |
+| Heap Sort | 8.3025 ms | 4.6525 ms | -3.6500 ms |
+| Insertion Sort | 27.4480 ms | 27.4331 ms | -0.0149 ms |
+| Merge Sort | 2.9167 ms | 2.5592 ms | -0.3575 ms |
+| Pancake Sort | - | 57.7009 ms | 0 ms |
+| Quick Sort | 3.0599 ms | 2.6374 ms | -0.4225 ms |
+| Radix Sort | 0.2070 ms | 0.1339 ms | -0.0731 ms |
+| Selection Sort | 55.8389 ms | 55.8000 ms | -0.0389 ms |
+| Shell Sort | 3.1775 ms | 3.1564 ms | -0.0211 ms |
+| Tim Sort | - | 6.7950 ms | - |
+
+# Install
+
+## npm
+
+```bash
+npm install @kwooshung/algorithm-sorts --save-dev
+```
+
+## yarn
+
+```bash
+yarn add @kwooshung/algorithm-sorts -D
+```
+
+## pnpm
+
+```bash
+pnpm add @kwooshung/algorithm-sorts -D
+```
+
+# Usage
+
+## Importing
+
+### esm
+
+```ts
+import { bubbleSort } from '@kwooshung/algorithm-sorts';
+```
+
+### commonjs
+
+```ts
+const { bubbleSort } = require('@kwooshung/algorithm-sorts');
+```
+
+## Supported Algorithms
+
+> Currently, the following sorting algorithms are supported. For specific usage instructions, click on the sorting algorithm names below and refer to the comments and parameters:
+
+- [» Bubble Sort](src/sorts/bubble/index.ts)
+- [» Short Bubble Sort](src/sorts/bubble/short/index.ts)
+- [» Cocktail Sort](src/sorts/cocktail/index.ts)
+- [» Counting Sort](src/sorts/counting/index.ts)
+- [» Counting Sort (Optimized Version)](src/sorts/counting/optimized/index.ts)
+- [» Heap Sort](src/sorts/heap/index.ts)
+- [» Insertion Sort](src/sorts/insertion/index.ts)
+- [» Merge Sort](src/sorts/merge/index.ts)
+- [» Pancake Sorting](src/sorts/pancake/index.ts)
+- [» Quick Sort](src/sorts/quick/index.ts)
+- [» Radix Sort](src/sorts/radix/index.ts)
+- [» Selection Sort](src/sorts/selection/index.ts)
+- [» Shell Sort](src/sorts/shell/index.ts)
+- [» Tim Sort](src/sorts/tim/index.ts)
diff --git a/README.zh-CN.md b/README.zh-CN.md
new file mode 100644
index 0000000..2882495
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,132 @@
+