Skip to content

Commit

Permalink
Merge pull request #1 from alanlu-dev/dev
Browse files Browse the repository at this point in the history
test
  • Loading branch information
alanlu-tw authored Mar 3, 2024
2 parents e0cd0f7 + 700d049 commit 25f8e9f
Show file tree
Hide file tree
Showing 36 changed files with 11,249 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
16 changes: 16 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "alanlu-dev/web-kit"
}
],
"commit": false,
"fixed": [["@alanlu-dev/*-config"]],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
7 changes: 7 additions & 0 deletions .changeset/twenty-dragons-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@alanlu-dev/markdownlint-config": patch
"@alanlu-dev/prettier-config": patch
"@alanlu-dev/eslint-config": patch
---

add changeset package to manage versioning and changelogs
70 changes: 70 additions & 0 deletions .commitlintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/** @type {import('czg').UserConfig} */
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
// @see: https://commitlint.js.org/#/reference-rules
// 'scope-enum': [2, 'always', scopes],
},
prompt: {
alias: { fd: 'docs: fix typos' },
messages: {
type: `Select the type of change that you're committing:`,
scope: 'Denote the SCOPE of this change (optional):',
customScope: 'Denote the SCOPE of this change:',
subject: 'Write a SHORT, IMPERATIVE tense description of the change:\n',
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
footerPrefixesSelect: 'Select the ISSUES type of changeList by this change (optional):',
customFooterPrefix: 'Input ISSUES prefix:',
footer: 'List any ISSUES by this change. E.g.: #31, #34:\n',
generatingByAI: 'Generating your AI commit subject...',
generatedSelectByAI: 'Select suitable subject by AI generated:',
confirmCommit: 'Are you sure you want to proceed with the commit above?',
},
types: [
{ value: 'feat', name: 'feat: AASD new feature', emoji: ':sparkles:' },
{ value: 'fix', name: 'fix: A bug fix', emoji: ':bug:' },
{ value: 'docs', name: 'docs: Documentation only changes', emoji: ':memo:' },
{ value: 'style', name: 'style: Changes that do not affect the meaning of the code', emoji: ':lipstick:' },
{ value: 'refactor', name: 'refactor: A code change that neither fixes a bug nor adds a feature', emoji: ':recycle:' },
{ value: 'perf', name: 'perf: A code change that improves performance', emoji: ':zap:' },
{ value: 'test', name: 'test: Adding missing tests or correcting existing tests', emoji: ':white_check_mark:' },
{ value: 'build', name: 'build: Changes that affect the build system or external dependencies', emoji: ':package:' },
{ value: 'ci', name: 'ci: Changes to our CI configuration files and scripts', emoji: ':ferris_wheel:' },
{ value: 'chore', name: `chore: Other changes that don't modify src or test files`, emoji: ':hammer:' },
{ value: 'revert', name: 'revert: Reverts a previous commit', emoji: ':rewind:' },
],
useEmoji: false,
emojiAlign: 'center',
useAI: false,
aiNumber: 1,
themeColorCode: '',
scopes: [],
allowCustomScopes: true,
allowEmptyScopes: true,
customScopesAlign: 'bottom',
customScopesAlias: 'custom',
emptyScopesAlias: 'empty',
upperCaseSubject: false,
markBreakingChangeMode: false,
allowBreakingChanges: ['feat', 'fix'],
breaklineNumber: 100,
breaklineChar: '|',
skipQuestions: [],
issuePrefixes: [{ value: 'closed', name: 'closed: ISSUES has been processed' }],
customIssuePrefixAlign: 'top',
emptyIssuePrefixAlias: 'skip',
customIssuePrefixAlias: 'custom',
allowCustomIssuePrefix: true,
allowEmptyIssuePrefix: true,
confirmColorize: true,
maxHeaderLength: Number.POSITIVE_INFINITY,
maxSubjectLength: Number.POSITIVE_INFINITY,
minSubjectLength: 0,
scopeOverrides: undefined,
defaultBody: '',
defaultIssues: '',
defaultScope: '',
defaultSubject: '',
},
}
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Matches all files
[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab

[*.{yaml,yml,conf}]
indent_size = 2

# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd,bat}]
end_of_line = crlf
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: release
on:
push:
branches:
- main
jobs:
release:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
with:
version: 8
- name: install dependencies
run: pnpm install --frozen-lockfile
- name: build packages
run: pnpm run build
- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
with:
version: pnpm run version
publish: pnpm run release
commit: "chore: new release"
title: "chore: new release candidate"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Dependencies
node_modules

# Build files
.output
.nuxt
.nitro
.cache
.virtual
.turbo
dist

# Logs
logs
.log

# Miscellaneous
.DS_Store
.fleet
.idea

# Local environment files
.env
.env.*
!.env.example
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm lint-staged
7 changes: 7 additions & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
'*.json': ['eslint --fix', 'prettier --write'],
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
'*.vue': ['eslint --fix', 'prettier --write'],
'*.{css,scss,postcss,less,html}': ['eslint --fix', 'prettier --write'],
'*.{md,mdx}': ['markdownlint-cli2 --fix'],
}
1 change: 1 addition & 0 deletions .markdownlint-cli2.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@alanlu-dev/markdownlint-config')
5 changes: 5 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
auto-install-peers=true
public-hoist-pattern[]=*types*
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=*markdownlint*
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.11.1
31 changes: 31 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Dependencies
**/node_modules

# Build files
**/.output
**/.nuxt
**/.nitro
**/.cache
**/.virtual
**/.turbo
**/dist

# Logs
**/logs
**/*.log

# Miscellaneous
**/.DS_Store
**/.fleet
**/.idea
pnpm-lock.yaml

# Local environment files
**/.env
**/.env.*
**/!.env.example

# Markdown files
**/*.md
**/*.mdx

1 change: 1 addition & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@alanlu-dev/prettier-config')
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["EditorConfig.EditorConfig", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode", "DavidAnson.vscode-markdownlint"]
}
47 changes: 47 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
// "prettier.enable": false, // Disable the default formatter, use eslint instead
"editor.defaultFormatter": "esbenp.prettier-vscode",

"editor.formatOnPaste": false, // required
"editor.formatOnType": false, // required
"editor.formatOnSave": false, // optional, if you use ESlint,this should be false
"editor.formatOnSaveMode": "file", // required to format on save

"editor.quickSuggestions": {
"strings": true
},

"editor.codeActionsOnSave": {
"source.organizeImports": "never",
"source.fixAll": "never",
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit",
"source.fixAll.markdownlint": "explicit"
},

// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "html", "markdown", "json", "jsonc", "yaml", "toml"],
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],

"stylelint.enable": true,
"stylelint.validate": ["css", "less", "postcss", "sass", "scss", "vue", "html"],
"css.validate": false,
"less.validate": false,
"scss.validate": false,

"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
}
}
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# @alanlu-dev/web-kit

這套開發模板是一個全方位且易於操作的基礎架構,旨在提升開發效率及確保程式碼風格的統一。它整合了以下幾款主要工具與套件,以優化開發流程:

* **EditorConfig**:透過維護一致的編輯器設定,EditorConfig 幫助團隊成員在不同的編輯器和 IDE 中保持一致的編碼風格。

* **ESLint**:這是一款廣受歡迎的 JavaScript 及 JSX 程式碼檢查工具,能夠協助開發者發現並修正程式碼中的錯誤,保障程式碼質量。

* **Prettier**:作為一款程式碼格式化工具,Prettier 能自動整理程式碼格式,確保整個團隊的程式碼風格保持一致。

* **Markdownlint**:這是一款專門用於維護 Markdown 文件風格一致性的工具,幫助你遵循最佳寫作實踐。

* **Commitlint**:這款工具幫助你規範 git commit 訊息的格式,促進團隊間溝通的效率和清晰度。

* **Husky**:Husky 允許你利用 git hooks 在執行 git commit 和 git push 命令前自動進行程式碼檢查和測試,提高代碼質量。

* **Lint-staged**:Lint-staged 能夠在 git commit 前自動檢查暫存的程式碼變更,確保只有通過檢查的程式碼才能被提交。

## 快速開始

若要開始使用這套模板,請按照以下步驟操作:

1. **克隆倉庫**

首先,使用以下命令克隆這個倉庫到本地:

```bash
git clone https://github.com/alanlu-dev/web-kit.git
```

2. **安裝依賴**

接著,進入項目目錄並執行以下命令安裝所需的依賴:

```bash
pnpm install
```

透過這套模板,你可以快速搭建起一個具有良好程式碼風格與質量保障的開發環境。
Loading

0 comments on commit 25f8e9f

Please sign in to comment.