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

refactor: add packages/tdesign-vue-next for npm publish #5015

Merged
merged 10 commits into from
Feb 14, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
env:
BODY: ${{ github.event.comment.body }}
run: |
txt=$(cat CHANGELOG.md)
echo "${txt%%##*}$BODY${txt##*---}" > CHANGELOG.md
txt=$(cat packages/tdesign-vue-next/CHANGELOG.md)
echo "${txt%%##*}$BODY${txt##*---}" > packages/tdesign-vue-next/CHANGELOG.md
git add .
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
Expand Down
142 changes: 136 additions & 6 deletions .github/workflows/tag-push.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,144 @@
# 文件名建议统一为 tag-push.yml
# 应用 publish.yml 的 demo

# name: TAG_PUSH

# on: create

# jobs:
# call-publish:
# uses: Tencent/tdesign/.github/workflows/publish.yml@main
# secrets:
# TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }}
# TDESIGN_NPM_TOKEN: ${{ secrets.TDESIGN_NPM_TOKEN }}
# PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}

name: TAG_PUSH

on: create

jobs:
call-publish:
uses: Tencent/tdesign/.github/workflows/publish.yml@main
secrets:
TDESIGN_SURGE_TOKEN: ${{ secrets.TDESIGN_SURGE_TOKEN }}
TDESIGN_NPM_TOKEN: ${{ secrets.TDESIGN_NPM_TOKEN }}
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
TAG_PUSH:
runs-on: ubuntu-latest
if: github.event.ref_type == 'tag'
steps:
# 检出代码仓库,并递归初始化子模块
- uses: actions/checkout@v4
with:
submodules: recursive

# 设置 pnpm
- name: Setup pnpm
uses: pnpm/action-setup@v4

# 设置 Node.js 环境,版本为 18
- uses: actions/setup-node@v4
with:
node-version: 18

# 获取 pnpm 的存储目录路径
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT

# 设置 pnpm 缓存
- uses: actions/cache@v4
name: Setup pnpm cache
with:
# 缓存路径
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
# 缓存键
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
# 恢复缓存的备用键
restore-keys: |
${{ runner.os }}-pnpm-store-

# 安装依赖
- run: pnpm i

- run: echo "🍏 This job's status is ${{ job.status }}."
- run: pnpm run build
- name: publish
id: publish
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.TDESIGN_NPM_TOKEN }}
package: packages/tdesign-vue-next
tag: ${{ contains(github.ref_name, 'beta') && 'beta' || 'latest' }}
- if: steps.publish.outputs.type != 'none'
run: |
echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}"

DEPLOY_HISTORY_VERSION_SITE:
runs-on: ubuntu-latest
if: github.event.ref_type == 'tag'
steps:
# 检出代码仓库,并递归初始化子模块
- uses: actions/checkout@v4
with:
submodules: recursive

# 设置 pnpm
- name: Setup pnpm
uses: pnpm/action-setup@v4

# 设置 Node.js 环境,版本为 18
- uses: actions/setup-node@v4
with:
node-version: 18

# 获取 pnpm 的存储目录路径
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT

# 设置 pnpm 缓存
- uses: actions/cache@v4
name: Setup pnpm cache
with:
# 缓存路径
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
# 缓存键
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
# 恢复缓存的备用键
restore-keys: |
${{ runner.os }}-pnpm-store-

# 安装依赖
- run: pnpm i

- name: Build site
run: pnpm run site:preview

- name: upload surge service
id: deploy
run: |
repository=${{github.repository}}
project_name=${repository#*/}
ref_name=${{ github.ref_name }}
tag_name=${ref_name//./_}
export DEPLOY_DOMAIN=https://$tag_name-$project_name.surge.sh
npx surge --project _site --domain $DEPLOY_DOMAIN --token ${{ secrets.TDESIGN_SURGE_TOKEN }}
echo $DEPLOY_DOMAIN

UPDATE_OFFICIAL_WEBSITE:
runs-on: ubuntu-latest
if: github.event.ref_type == 'tag'
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
token: ${{ secrets.PERSONAL_TOKEN }}
submodules: recursive
- name: update official website
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git status
git fetch origin
git merge origin/develop
git push origin main

15 changes: 14 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,18 @@
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"cSpell.words": ["tdesign", "popconfirm", "cascader", "tnode", "backtop", "wechat", "miniprogram","nuxt","codesandbox"]
"cSpell.words": [
"backtop",
"cascader",
"codesandbox",
"miniprogram",
"nuxt",
"popconfirm",
"popperjs",
"precaching",
"tdesign",
"tdoc",
"tnode",
"wechat"
]
}
57 changes: 7 additions & 50 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,6 @@
{
"name": "tdesign-vue-next",
"version": "1.10.7",
"title": "tdesign-vue-next",
"description": "TDesign Component for vue-next",
"name": "tdesign-vue-mono",
"packageManager": "[email protected]",
"keywords": [
"vue",
"vue3",
"vue-next",
"tdesign",
"typescript"
],
"main": "cjs/index-lib.js",
"module": "es/index.mjs",
"typings": "es/index.d.ts",
"unpkg": "dist/tdesign.min.js",
"jsdelivr": "dist/tdesign.min.js",
"files": [
"es",
"esm",
"cjs",
"lib",
"dist",
"LICENSE",
"README.md",
"CHANGELOG.md",
"global.d.ts",
"helper"
],
"sideEffects": [
"*.vue",
"dist/*",
"site/*",
"examples/*",
"es/**/style/**",
"esm/**/style/**"
],
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Tencent/tdesign-vue-next.git"
Expand All @@ -61,13 +23,12 @@
"generate:usage": "node script/generate-usage/index.js",
"generate:component": "node script/init/index.js",
"generate:coverage-badge": "pnpm test:unit-coverage && node script/test/generate-coverage.js",
"prebuild": "rimraf es/* esm/* lib/* cjs/* dist/* --glob",
"build": "cross-env NODE_ENV=production rollup -c script/rollup.config.js && pnpm build:tsc",
"build:tsc": "run-p build:tsc-*",
"build:tsc-es": "tsc --emitDeclarationOnly -d --rootDir packages/components --outDir es/",
"build:tsc-esm": "tsc --emitDeclarationOnly -d --rootDir packages/components --outDir esm/",
"build:tsc-lib": "tsc --emitDeclarationOnly -d --rootDir packages/components --outDir lib/",
"build:tsc-cjs": "tsc --emitDeclarationOnly -d --rootDir packages/components --outDir cjs/",
"build:tsc-es": "tsc --emitDeclarationOnly -d --rootDir packages/components --outDir packages/tdesign-vue-next/es/",
"build:tsc-esm": "tsc --emitDeclarationOnly -d --rootDir packages/components --outDir packages/tdesign-vue-next/esm/",
"build:tsc-lib": "tsc --emitDeclarationOnly -d --rootDir packages/components --outDir packages/tdesign-vue-next/lib/",
"build:tsc-cjs": "tsc --emitDeclarationOnly -d --rootDir packages/components --outDir packages/tdesign-vue-next/cjs/",
"lint:fix": "eslint --ext .vue,.js,.ts,.tsx ./packages --max-warnings 0 --fix --cache",
"lint": "pnpm lint:tsc && eslint --ext .vue,.js,.ts,.tsx ./packages --max-warnings 0 --cache",
"lint:tsc": "tsc --emitDeclarationOnly",
Expand Down Expand Up @@ -99,6 +60,7 @@
"mitt": "^3.0.1",
"sortablejs": "^1.15.0",
"tdesign-icons-vue-next": "^0.3.4",
"tdesign-vue-next": "workspace:^",
"tinycolor2": "^1.6.0",
"validator": "^13.9.0"
},
Expand Down Expand Up @@ -205,10 +167,5 @@
"prettier --write --cache",
"eslint --fix --cache"
]
},
"vetur": {
"tags": "helper/tags.json",
"attributes": "helper/attributes.json"
},
"web-types": "helper/web-types.json"
}
}
Loading