Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish #38

Merged
merged 14 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = {
node: true,
browser: true,
es2021: true,
"cypress/globals": true,
},
globals: {
describe: true,
Expand All @@ -13,21 +14,21 @@ module.exports = {
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended", "prettier"],
parserOptions: {
ecmaVersion: 12,
parser: '@typescript-eslint/parser',
sourceType: 'module',
project: ["tsconfig.json"]
parser: "@typescript-eslint/parser",
sourceType: "module",
project: ["tsconfig.json"],
},
plugins: ["@typescript-eslint", "prettier"],
ignorePatterns: ['.eslintrc.cjs'],
plugins: ["@typescript-eslint", "prettier", "cypress"],
ignorePatterns: [".eslintrc.cjs"],
rules: {
'no-param-reassign': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-require-imports': 'off',
"no-param-reassign": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{
"checksVoidReturn": false
}
]
checksVoidReturn: false,
},
],
},
};
15 changes: 5 additions & 10 deletions .github/CONTRIBUTING.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,19 @@ NI Web Infra Team 的成长离不开大家的支持,如果你愿意为 NI Web

## Pull Request 规范

- 请使用 [pnpm](https://pnpm.io/zh/) 进行开发
- 如果您是团队外用户请先 fork 一份到自己的项目下,不要直接在仓库下建分支。

- commit 信息要以 `type(scope): 描述信息` 的形式填写,例如 `fix(components): [scrollbar] fix xxx bug`(推荐使用 `git-cz` 生成)。

1. type: 必须是 'build', 'chore', 'ci', 'conflict', 'delete', 'docs', 'downgrade', 'feat', 'fix', 'font', 'lint', 'perf', 'refactor', 'release', 'revert', 'stash', 'style', 'test', 'upgrade', 'wip' 其中的一个。
1. type: 必须是 'build', 'chore', 'ci', 'conflict', 'delete', 'docs', 'downgrade', 'feat', 'fix', 'font', 'lint', 'perf', 'refactor', 'release', 'revert', 'stash', 'style', 'test', 'upgrade', 'wip' 其中的一个。

2. scope: 必须是 components, directives, hooks, locale, test-utils, theme-chalk, tokens, utils, project, core, style, docs, ci, dev, build, deploy, other, typography, color, border, var 其中的一个。
2. scope: 必须是 components, directives, hooks, locale, test-utils, theme-chalk, tokens, utils, project, core, style, docs, ci, dev, build, deploy, other, typography, color, border, var 其中的一个。

3. header: 描述信息不要超过 128 个字符并且不要少于 3 个字符。
3. header: 描述信息不要超过 128 个字符并且不要少于 3 个字符。

- **不要提交** `.gitignore` 里面忽略的文件。

- 执行 `npm run build` 后可以正确打包文件。

- 执行 `pnpm run build` 后可以正确打包文件。
- 提交 PR 前请 rebase,确保 commit 记录的整洁。

- 确保 PR 是提交到 `development` 分支,而不是 `main` 分支。

- 如果是修复 bug,请在 PR 中给出描述信息。

- 合并代码需要两名维护人员参与:一人进行 review 后 approve,另一人再次 review,通过后即可合并。
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---

name: Bug 提交
about: 使用此模板来提交一个 bug。

---

<!-- generated by template DO NOT REMOVE -->
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ contact_links:
- name: 贡献指南
url: https://github.com/NI-Web-Infra-Team/common-utils/blob/main/.github/CONTRIBUTING.zh-CN.md
about: 如果您不知道如何提交一个 issue,请查看项目贡献指南

2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---

name: 功能请求
about: 使用此模板来提交一个功能请求。

---

<!-- generated by template DO NOT REMOVE -->
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-commit-message-post.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
如果你觉得自己写这个提交消息很难,请使用下面的命令来启动一个交互式工具来帮助你生成消息。

```shell
yarn cz
pnpm cz
```

Note that if you do not fix the commit message issue, your PR will be automatically closed within **3 days**.
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/lint-commit-message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,29 @@ jobs:
with:
node-version: 18

- name: Get yarn store directory
id: yarn-cache
- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $env:GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup yarn cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-store-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-store-
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: yarn --frozen-lockfile
run: pnpm i --frozen-lockfile

- name: Lint commit
id: lint
run: yarn run lint || echo "failed=true" >> $GITHUB_OUTPUT
run: pnpm run lint || echo "failed=true" >> $GITHUB_OUTPUT

- name: Set success result
if: ${{ steps.lint.outputs.failed != 'true' }}
Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/pr-auto-assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,25 @@ jobs:
with:
node-version: 18

- name: Get yarn store directory
id: yarn-cache
- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $env:GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup yarn cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-store-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-store-
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: yarn --frozen-lockfile
run: pnpm i --frozen-lockfile

- name: Generate config
run: |
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/publish-build-product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,27 @@ jobs:
with:
node-version: 18

- name: Get yarn store directory
id: yarn-cache
- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $env:GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup yarn cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-store-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-store-
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: yarn --frozen-lockfile
run: pnpm i --frozen-lockfile

- name: Local build
run: yarn build
run: pnpm run build
env:
NODE_OPTIONS: --max-old-space-size=4096
31 changes: 19 additions & 12 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,34 @@ jobs:
node-version: 18
registry-url: https://registry.npmjs.com/

- name: Get yarn store directory
id: yarn-cache
- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $env:GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup yarn cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-store-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-store-
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: yarn --frozen-lockfile
run: pnpm i --frozen-lockfile

- name: Lint
run: yarn run lint
run: pnpm run lint

- name: Build banner
run: yarn run banner
run: pnpm run banner

- name: Test
run: yarn run test
run: pnpm run test:all

publish:
needs: test
Expand All @@ -55,6 +59,9 @@ jobs:
node-version: 18
registry-url: https://registry.npmjs.com/

- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Get version
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/publish-size-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@ jobs:
with:
node-version: 18

- name: Get yarn store directory
id: yarn-cache
- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $env:GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup yarn cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-store-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-store-
${{ runner.os }}-pnpm-store-

- uses: preactjs/compressed-size-action@v2
with:
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/release-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,27 @@ jobs:
with:
node-version: 18

- name: Get yarn store directory
id: yarn-cache
- name: Setup pnpm
uses: pnpm/action-setup@v2

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "yarn_cache_dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
echo "pnpm_cache_dir=$(pnpm store path)" >> $env:GITHUB_OUTPUT

- uses: actions/cache@v3
name: Setup yarn cache
name: Setup pnpm cache
with:
path: ${{ steps.yarn-cache.outputs.yarn_cache_dir }}
key: ${{ runner.os }}-yarn-store-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-store-
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: yarn --frozen-lockfile
run: pnpm i --frozen-lockfile

- name: Start release
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
run: yarn run semantic-release
run: pnpm run semantic-release
Loading