Skip to content

Commit

Permalink
publish (#38)
Browse files Browse the repository at this point in the history
* ci: 新增 action 手动触发

* ci: 新增手动 action 提示

* chore(release): 1.1.0-beta.1 [skip ci]

# [1.1.0-beta.1](v1.0.0...v1.1.0-beta.1) (2023-06-14)

### Features

* 添加文档搜索功能 ([#24](#24)) ([9248fb6](9248fb6))

* docs: update README.md (#17)

* feat: 计算文字宽度

✅ Closes: #15

* chore(release): 1.0.0-development.1 [skip ci]

# 1.0.0-development.1 (2023-05-25)

### Features

* 清除历史日志,项目迁移 ([5ec0f43](5ec0f43))
* 计算文字宽度 ([b916185](b916185)), closes [#15](#15)
* 重置版本号 ([55def4a](55def4a))

* docs: update README.md

---------

Co-authored-by: liu <liunian@2077tech.com>
Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>

* ci: 修改触发单元测试覆盖率的分支

old:main -> new:development

* ci: 兼容新版 vitest

vitest-dev/vitest#3339

* ci: 测试覆盖率前生成 banner

* test: 单元测试更新 (#28)

Co-authored-by: lyj <liyanjie@cennavi.com.cn>

* docs: readme update (#30)

Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>

* build: 使用 pnpm 替代 yarn (#31)

* feat: 异步加载文件成功提示信息 (#32)

Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: liu <liunian@2077tech.com>

* feature: 更新 load 方法,并修改 vite 打包暴露的全局变量名称为 niUtils (#33)

* refactor: 修改默认暴露名称

* fix: 修改load的函数

---------

Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: wuhaoyuan <wuhaoyuan11101@navinfo.com>

* feat: 补充单元测试并增加 e2e 相关测试 (#34)

* feat: 单元测试增加jsdom相关测试

* test: 添加 e2e 的测试并使用 eslint 重新格式化整个项目

* feat: 新增获取元素样式的值的函数

* test: 修复错误的 computedTextWidth 测试用例逻辑

* ci: 添加 cypress 的缓存

---------

Co-authored-by: lyj <liyanjie@cennavi.com.cn>
Co-authored-by: liunian <liunian@2077tech.com>

---------

Co-authored-by: liunian <liunian@2077tech.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: liu <liunian7965@navinfo.com>
Co-authored-by: wuhaoyuan <wuhaoyuan@cennavi.com.cn>
Co-authored-by: 李彦杰 <1132925293@qq.com>
Co-authored-by: lyj <liyanjie@cennavi.com.cn>
Co-authored-by: wuhaoyuan <wuhaoyuan11101@navinfo.com>
  • Loading branch information
8 people authored Jul 19, 2023
1 parent fb6c8b1 commit f17de2a
Show file tree
Hide file tree
Showing 84 changed files with 20,778 additions and 16,639 deletions.
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

0 comments on commit f17de2a

Please sign in to comment.