From 5aaa7655950ee15216f4023cac0328d0678ebc40 Mon Sep 17 00:00:00 2001 From: Justineo Date: Fri, 8 Aug 2025 02:05:09 +0800 Subject: [PATCH 1/6] chore: release and publish from github actions --- .github/workflows/ci.yml | 29 +++++++++++++++++++ .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ pnpm-workspace.yaml | 2 ++ scripts/changelog.ts | 47 +++++++++++++++++++++++++++++++ scripts/dist-tag.ts | 17 +++++++++++ 5 files changed, 148 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 pnpm-workspace.yaml create mode 100644 scripts/changelog.ts create mode 100644 scripts/dist-tag.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..47f4b47 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI +on: + pull_request: + push: + branches: + - main + - '8.0' # remove this after 8.0 is merged into main + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - uses: pnpm/action-setup@v4 + with: + version: 10.14.0 + run_install: false + + - run: pnpm install --frozen-lockfile + - run: pnpm run lint + - run: pnpm run typecheck + - run: pnpm run build + - run: pnpm run publint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f71a72a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + workflow_dispatch: + +permissions: + id-token: write + contents: write + +jobs: + publish: + runs-on: ubuntu-latest + environment: npm-publish + + steps: + # ───── 基础环境 ───── + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - uses: pnpm/action-setup@v4 + with: + version: 10.14.0 + run_install: false + + - run: pnpm install --frozen-lockfile + + - id: pkg + run: echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT" + + - id: tag + run: echo "tag=$(pnpm exec jiti scripts/dist-tag.ts '${{ steps.pkg.outputs.version }}')" >> "$GITHUB_OUTPUT" + + - run: pnpm exec jiti scripts/changelog.ts '${{ steps.pkg.outputs.version }}' > tmp_release_body.md + + - run: corepack prepare npm@11.5.0 --activate + + - name: Publish to npm + run: | + pnpm exec npm@11.5.0 publish \ + --tag '${{ steps.tag.outputs.tag }}' \ + --access public + + - uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ steps.pkg.outputs.version }} + body_path: tmp_release_body.md + prerelease: ${{ startsWith(steps.pkg.outputs.version, '0') || contains(steps.pkg.outputs.version, '-') }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..efc037a --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +onlyBuiltDependencies: + - esbuild diff --git a/scripts/changelog.ts b/scripts/changelog.ts new file mode 100644 index 0000000..9b9f300 --- /dev/null +++ b/scripts/changelog.ts @@ -0,0 +1,47 @@ +import { readFileSync } from "node:fs"; +import { join } from "node:path"; + +/** + * Extract the changelog section for the given version from CHANGELOG.md + * and print it to stdout (without leading/trailing blank lines). + * + * Usage: + * npx jiti scripts/changelog.ts 7.0.3 > tmp_release_body.md + */ + +const version = process.argv[2]; + +if (!version) { + console.error("Usage: jiti scripts/changelog.ts "); + process.exit(1); +} + +const header = `## ${version}`; +const changelogPath = join(process.cwd(), "CHANGELOG.md"); +const lines = readFileSync(changelogPath, "utf8").split(/\r?\n/); + +let capturing = false; +const section: string[] = []; + +for (const line of lines) { + if (line.startsWith("## ")) { + if (capturing) break; // reached next version header + if (line.trim() === header) { + capturing = true; // start capturing after header + continue; // skip header line itself + } + } + if (capturing) section.push(line); +} + +// Trim leading / trailing blank lines +while (section.length && section[0].trim() === "") section.shift(); +while (section.length && section[section.length - 1].trim() === "") + section.pop(); + +if (section.length === 0) { + console.error(`No changelog entry found for version ${version}`); + process.exit(1); +} + +console.log(section.join("\n")); diff --git a/scripts/dist-tag.ts b/scripts/dist-tag.ts new file mode 100644 index 0000000..65b998d --- /dev/null +++ b/scripts/dist-tag.ts @@ -0,0 +1,17 @@ +/** Resolve npm dist-tag from a semver string. + * Usage: jiti scripts/dist-tag.ts 1.2.3-beta.0 # → beta + * jiti scripts/dist-tag.ts # picks version from package.json + */ +import { readFileSync } from "node:fs"; +import { join } from "node:path"; + +// Prefer CLI arg, otherwise read package.json +const version: string = + process.argv[2] ?? + JSON.parse(readFileSync(join(process.cwd(), "package.json"), "utf8")).version; + +// Capture first recognised prerelease label +const tag = + version.match(/-(alpha|beta|rc)\b/i)?.[1].toLowerCase() ?? "latest"; + +console.log(tag); From 46a4193042bd5b901ec223dd35d351886c64dd62 Mon Sep 17 00:00:00 2001 From: Justineo Date: Fri, 8 Aug 2025 02:17:20 +0800 Subject: [PATCH 2/6] fix: install pnpm before node --- .github/workflows/ci.yml | 10 +++++----- .github/workflows/release.yml | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47f4b47..26eb2a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,16 +12,16 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'pnpm' - - uses: pnpm/action-setup@v4 with: version: 10.14.0 run_install: false + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + - run: pnpm install --frozen-lockfile - run: pnpm run lint - run: pnpm run typecheck diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f71a72a..5a1db24 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,6 @@ jobs: environment: npm-publish steps: - # ───── 基础环境 ───── - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From 91f56b405c0c6587223646ffd507e73fa15cc8d6 Mon Sep 17 00:00:00 2001 From: Yue JIN Date: Fri, 8 Aug 2025 23:45:45 +0800 Subject: [PATCH 3/6] improve ci --- .github/workflows/ci.yml | 32 +++--- .github/workflows/release.yml | 51 ++++----- package.json | 6 +- pnpm-lock.yaml | 201 +++++++++++++++++++++++++++++++--- scripts/changelog.ts | 47 -------- scripts/dist-tag.ts | 17 --- 6 files changed, 234 insertions(+), 120 deletions(-) delete mode 100644 scripts/changelog.ts delete mode 100644 scripts/dist-tag.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26eb2a2..4246c7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,26 +4,32 @@ on: push: branches: - main - - '8.0' # remove this after 8.0 is merged into main + - "8.0" # remove this after 8.0 is merged into main jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 10.14.0 - run_install: false + - name: Setup pnpm + uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 with: node-version: 22 - cache: 'pnpm' + cache: "pnpm" + + - name: Install dependencies + run: pnpm install + + - name: Lint + run: pnpm run lint + + - name: Typecheck + run: pnpm run typecheck && pnpm run dev:typecheck - - run: pnpm install --frozen-lockfile - - run: pnpm run lint - - run: pnpm run typecheck - - run: pnpm run build - - run: pnpm run publint + - name: Publint + run: pnpm run publint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5a1db24..069b5af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,52 +1,47 @@ name: Release on: - workflow_dispatch: + push: + tags: + - "v**" permissions: id-token: write contents: write jobs: - publish: + release: runs-on: ubuntu-latest environment: npm-publish steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 with: node-version: 22 cache: pnpm - - uses: pnpm/action-setup@v4 - with: - version: 10.14.0 - run_install: false - - - run: pnpm install --frozen-lockfile - - - id: pkg - run: echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT" - - - id: tag - run: echo "tag=$(pnpm exec jiti scripts/dist-tag.ts '${{ steps.pkg.outputs.version }}')" >> "$GITHUB_OUTPUT" - - - run: pnpm exec jiti scripts/changelog.ts '${{ steps.pkg.outputs.version }}' > tmp_release_body.md + - name: Install Dependencies + run: pnpm install - - run: corepack prepare npm@11.5.0 --activate + - name: Extract release notes + run: pnpm releaselog --format=notes ${{ github.ref_name }} > RELEASE_NOTES.md - - name: Publish to npm - run: | - pnpm exec npm@11.5.0 publish \ - --tag '${{ steps.tag.outputs.tag }}' \ - --access public - - - uses: softprops/action-gh-release@v2 + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 with: - tag_name: v${{ steps.pkg.outputs.version }} - body_path: tmp_release_body.md - prerelease: ${{ startsWith(steps.pkg.outputs.version, '0') || contains(steps.pkg.outputs.version, '-') }} + body_path: RELEASE_NOTES.md + prerelease: ${{ contains(github.ref_name, '-') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build + run: pnpm run build + + - name: Publish to npm + run: npm i -g npm && pnpm publish --access public --tag latest --no-git-checks diff --git a/package.json b/package.json index 71ae5a1..0c30d93 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "author": "GU Yiling ", "scripts": { "dev": "vite", - "build": "pnpm run docs && tsdown", + "build": "tsdown", "typecheck": "tsc", "lint": "eslint . --fix", "format": "prettier . --write", @@ -19,7 +19,7 @@ "dev:preview": "vite preview", "dev:typecheck": "vue-tsc -p ./demo", "docs": "jiti ./scripts/docs.ts", - "prepublishOnly": "pnpm run typecheck && pnpm run dev:typecheck && pnpm run build && publint" + "release": "pnpm run docs && bumpp -a" }, "packageManager": "pnpm@10.14.0", "type": "module", @@ -48,6 +48,7 @@ "@vue/eslint-config-typescript": "^14.6.0", "@vue/tsconfig": "^0.7.0", "@vueuse/core": "^13.6.0", + "bumpp": "^10.2.2", "comment-mark": "^2.0.1", "echarts": "^6.0.0", "echarts-gl": "^2.0.9", @@ -61,6 +62,7 @@ "postcss-nested": "^7.0.2", "prettier": "^3.6.2", "publint": "^0.3.12", + "releaselog": "^6.0.3", "tsdown": "^0.13.3", "typescript": "^5.9.2", "unplugin-raw": "^0.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 21c9803..5dcf291 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,7 +22,7 @@ importers: version: 1.5.0(vue@3.5.18(typescript@5.9.2)) '@vitejs/plugin-vue': specifier: ^6.0.1 - version: 6.0.1(rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4))(vue@3.5.18(typescript@5.9.2)) + version: 6.0.1(rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4)(yaml@2.8.1))(vue@3.5.18(typescript@5.9.2)) '@vue/eslint-config-prettier': specifier: ^10.2.0 version: 10.2.0(@types/eslint@8.56.10)(eslint@9.32.0(jiti@2.5.1))(prettier@3.6.2) @@ -35,6 +35,9 @@ importers: '@vueuse/core': specifier: ^13.6.0 version: 13.6.0(vue@3.5.18(typescript@5.9.2)) + bumpp: + specifier: ^10.2.2 + version: 10.2.2 comment-mark: specifier: ^2.0.1 version: 2.0.1 @@ -74,6 +77,9 @@ importers: publint: specifier: ^0.3.12 version: 0.3.12 + releaselog: + specifier: ^6.0.3 + version: 6.0.3 tsdown: specifier: ^0.13.3 version: 0.13.3(publint@0.3.12)(typescript@5.9.2)(vue-tsc@3.0.5(typescript@5.9.2)) @@ -85,7 +91,7 @@ importers: version: 0.5.1 vite: specifier: npm:rolldown-vite@^7.1.0 - version: rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4) + version: rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4)(yaml@2.8.1) vue: specifier: ^3.5.18 version: 3.5.18(typescript@5.9.2) @@ -424,13 +430,11 @@ packages: resolution: {integrity: sha512-oTDZVfqIAjLB2I1yTiLyyhfPPO6dky33sTblxTCpe+ZT55WizN3KDoBKJ4yXG8shI6I4bRShVu29Xg0yAjyQYw==} cpu: [arm64] os: [linux] - libc: [glibc] '@rolldown/binding-linux-arm64-musl@1.0.0-beta.31': resolution: {integrity: sha512-duJ3IkEBj9Xe9NYW1n8Y3483VXHGi8zQ0ZsLbK8464EJUXLF7CXM8Ry+jkkUw+ZvA+Zu1E/+C6p2Y6T9el0C9g==} cpu: [arm64] os: [linux] - libc: [musl] '@rolldown/binding-linux-arm64-ohos@1.0.0-beta.31': resolution: {integrity: sha512-qdbmU5QSZ0uoLZBYMxiHsMQmizqtzFGTVPU5oyU1n0jU0Mo+mkSzqZuL8VBnjHOHzhVxZsoAGH9JjiRzCnoGVA==} @@ -441,13 +445,11 @@ packages: resolution: {integrity: sha512-H7+r34TSV8udB2gAsebFM/YuEeNCkPGEAGJ1JE7SgI9XML6FflqcdKfrRSneQFsPaom/gCEc1g0WW5MZ0O3blw==} cpu: [x64] os: [linux] - libc: [glibc] '@rolldown/binding-linux-x64-musl@1.0.0-beta.31': resolution: {integrity: sha512-zRm2YmzFVqbsmUsyyZnHfJrOlQUcWS/FJ5ZWL8Q1kZh5PnLBrTVZNpakIWwAxpN5gNEi9MmFd5YHocVJp8ps1Q==} cpu: [x64] os: [linux] - libc: [musl] '@rolldown/binding-wasm32-wasi@1.0.0-beta.31': resolution: {integrity: sha512-fM1eUIuHLsNJXRlWOuIIex1oBJ89I0skFWo5r/D3KSJ5gD9MBd3g4Hp+v1JGohvyFE+7ylnwRxSUyMEeYpA69A==} @@ -711,6 +713,9 @@ packages: argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + args-tokenizer@0.3.0: + resolution: {integrity: sha512-xXAd7G2Mll5W8uo37GETpQ2VrE84M181Z7ugHFGQnJZ50M2mbOv0osSZ9VsSgPfJQ+LVG0prSi0th+ELMsno7Q==} + ast-kit@2.1.1: resolution: {integrity: sha512-mfh6a7gKXE8pDlxTvqIc/syH/P3RkzbOF6LeHdcKztLEzYe6IMsRCL7N8vI7hqTGWNxpkCuuRTpT21xNWqhRtQ==} engines: {node: '>=20.18.0'} @@ -737,6 +742,19 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + bumpp@10.2.2: + resolution: {integrity: sha512-b6LpQOuXqhejTfNV8r1XkdPQiPWS09l+k+W8raTV2YaFeIqCA76D81G22ac/2jhVTCWXwbEMgvxbQtHriOIPkw==} + engines: {node: '>=18'} + hasBin: true + + c12@3.2.0: + resolution: {integrity: sha512-ixkEtbYafL56E6HiFuonMm1ZjoKtIo7TH68/uiEq4DAwv9NcUX2nJ95F8TrbMeNjqIkZpruo3ojXQJ+MGG5gcQ==} + peerDependencies: + magicast: ^0.3.5 + peerDependenciesMeta: + magicast: + optional: true + cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -753,6 +771,13 @@ packages: resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==} engines: {node: '>= 14.16.0'} + ci-logger@7.0.0: + resolution: {integrity: sha512-mt2YIS+8AzhKcPybORt9NtiZcnRB4FbUJn9MTTgB7db2UrGGWAxgcu0WQylSTGeWGmJurAto7RoyZHSFRuIEAA==} + engines: {node: ^18.12.0 || ^20.9.0 || >=22.0.0} + + citty@0.1.6: + resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==} + claygl@1.3.0: resolution: {integrity: sha512-+gGtJjT6SSHD2l2yC3MCubW/sCV40tZuSs5opdtn79vFSGUgp/lH139RNEQ6Jy078/L0aV8odCw8RSrUcMfLaQ==} @@ -763,6 +788,10 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + commander@13.1.0: + resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==} + engines: {node: '>=18'} + commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -773,6 +802,13 @@ packages: concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + confbox@0.2.2: + resolution: {integrity: sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==} + + consola@3.4.2: + resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==} + engines: {node: ^14.18.0 || >=16.10.0} + copy-anything@3.0.5: resolution: {integrity: sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==} engines: {node: '>=12.13'} @@ -807,6 +843,9 @@ packages: defu@6.1.4: resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} + destr@2.0.5: + resolution: {integrity: sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==} + detect-libc@2.0.4: resolution: {integrity: sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==} engines: {node: '>=8'} @@ -815,6 +854,10 @@ packages: resolution: {integrity: sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg==} engines: {node: '>=0.3.1'} + dotenv@17.2.1: + resolution: {integrity: sha512-kQhDYKZecqnM0fCnzI5eIv5L4cAe/iRI+HqMbO/hbRdTAeXDG+M9FjipUxNfbARuEg4iHIbhnhs78BCHNbSxEQ==} + engines: {node: '>=12'} + dts-resolver@2.1.1: resolution: {integrity: sha512-3BiGFhB6mj5Kv+W2vdJseQUYW+SKVzAFJL6YNP6ursbrwy1fXHRotfHi3xLNxe4wZl/K8qbAFeCDjZLjzqxxRw==} engines: {node: '>=20.18.0'} @@ -855,6 +898,10 @@ packages: engines: {node: '>=18'} hasBin: true + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + escape-string-regexp@4.0.0: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} @@ -935,6 +982,9 @@ packages: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} + exsolve@1.0.7: + resolution: {integrity: sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw==} + fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} @@ -989,6 +1039,10 @@ packages: get-tsconfig@4.10.1: resolution: {integrity: sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==} + giget@2.0.0: + resolution: {integrity: sha512-L5bGsVkxJbJgdnwyuheIunkGatUF/zssUoxxjACCseZYAVbaqdh9Tsmmlkl8vYan09H7sbvKt4pS8GqKLBrEzA==} + hasBin: true + glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -1076,6 +1130,9 @@ packages: json-stable-stringify-without-jsonify@1.0.1: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + jsonc-parser@3.3.1: + resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==} + keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} @@ -1112,28 +1169,24 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] lightningcss-linux-arm64-musl@1.30.1: resolution: {integrity: sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [musl] lightningcss-linux-x64-gnu@1.30.1: resolution: {integrity: sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [glibc] lightningcss-linux-x64-musl@1.30.1: resolution: {integrity: sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [musl] lightningcss-win32-arm64-msvc@1.30.1: resolution: {integrity: sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==} @@ -1197,9 +1250,20 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + node-fetch-native@1.6.7: + resolution: {integrity: sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==} + nth-check@2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} + nypm@0.6.1: + resolution: {integrity: sha512-hlacBiRiv1k9hZFiphPUkfSQ/ZfQzZDzC+8z0wL3lvDAOUu/2NnChkKuMoMjNur/9OpKuz2QsIeiPVN0xM5Q0w==} + engines: {node: ^14.16.0 || >=16.10.0} + hasBin: true + + ohash@2.0.11: + resolution: {integrity: sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==} + optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -1256,6 +1320,9 @@ packages: typescript: optional: true + pkg-types@2.2.0: + resolution: {integrity: sha512-2SM/GZGAEkPp3KWORxQZns4M+WSeXbC2HEvmOIJe3Cmiv6ieAJvdVhDldtHqM5J1Y7MrR1XhkBT/rMlhh9FdqQ==} + postcss-nested@7.0.2: resolution: {integrity: sha512-5osppouFc0VR9/VYzYxO03VaDa3e8F23Kfd6/9qcZTUI8P58GIYlArOET2Wq0ywSl2o2PjELhYOFI4W7l5QHKw==} engines: {node: '>=18.0'} @@ -1302,10 +1369,18 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + rc9@2.1.2: + resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==} + readdirp@4.1.2: resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} engines: {node: '>= 14.18.0'} + releaselog@6.0.3: + resolution: {integrity: sha512-oTaqL2vWLPz5rk8m6hRmdWByjlzrbfrOWbFJR2yfopsbHvxA+rxoDosEcOZJ8yNdWXv7aRgldqpJXC515ulVKQ==} + engines: {node: ^18.12.0 || ^20.9.0 || >=22.0.0} + hasBin: true + resolve-from@4.0.0: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} @@ -1564,6 +1639,11 @@ packages: resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} engines: {node: '>=12'} + yaml@2.8.1: + resolution: {integrity: sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==} + engines: {node: '>= 14.6'} + hasBin: true + yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -1970,10 +2050,10 @@ snapshots: optionalDependencies: vue: 3.5.18(typescript@5.9.2) - '@vitejs/plugin-vue@6.0.1(rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4))(vue@3.5.18(typescript@5.9.2))': + '@vitejs/plugin-vue@6.0.1(rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4)(yaml@2.8.1))(vue@3.5.18(typescript@5.9.2))': dependencies: '@rolldown/pluginutils': 1.0.0-beta.29 - vite: rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4) + vite: rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4)(yaml@2.8.1) vue: 3.5.18(typescript@5.9.2) '@volar/language-core@2.4.22': @@ -2141,6 +2221,8 @@ snapshots: argparse@2.0.1: {} + args-tokenizer@0.3.0: {} + ast-kit@2.1.1: dependencies: '@babel/parser': 7.28.0 @@ -2168,6 +2250,37 @@ snapshots: buffer-from@1.1.2: optional: true + bumpp@10.2.2: + dependencies: + ansis: 4.1.0 + args-tokenizer: 0.3.0 + c12: 3.2.0 + cac: 6.7.14 + escalade: 3.2.0 + jsonc-parser: 3.3.1 + package-manager-detector: 1.3.0 + semver: 7.7.2 + tinyexec: 1.0.1 + tinyglobby: 0.2.14 + yaml: 2.8.1 + transitivePeerDependencies: + - magicast + + c12@3.2.0: + dependencies: + chokidar: 4.0.3 + confbox: 0.2.2 + defu: 6.1.4 + dotenv: 17.2.1 + exsolve: 1.0.7 + giget: 2.0.0 + jiti: 2.5.1 + ohash: 2.0.11 + pathe: 2.0.3 + perfect-debounce: 1.0.0 + pkg-types: 2.2.0 + rc9: 2.1.2 + cac@6.7.14: {} callsites@3.1.0: {} @@ -2181,6 +2294,12 @@ snapshots: dependencies: readdirp: 4.1.2 + ci-logger@7.0.0: {} + + citty@0.1.6: + dependencies: + consola: 3.4.2 + claygl@1.3.0: {} color-convert@2.0.1: @@ -2189,6 +2308,8 @@ snapshots: color-name@1.1.4: {} + commander@13.1.0: {} + commander@2.20.3: optional: true @@ -2196,6 +2317,10 @@ snapshots: concat-map@0.0.1: {} + confbox@0.2.2: {} + + consola@3.4.2: {} + copy-anything@3.0.5: dependencies: is-what: 4.1.16 @@ -2220,10 +2345,14 @@ snapshots: defu@6.1.4: {} + destr@2.0.5: {} + detect-libc@2.0.4: {} diff@8.0.2: {} + dotenv@17.2.1: {} + dts-resolver@2.1.1: {} echarts-gl@2.0.9(echarts@6.0.0): @@ -2276,6 +2405,8 @@ snapshots: '@esbuild/win32-ia32': 0.25.8 '@esbuild/win32-x64': 0.25.8 + escalade@3.2.0: {} + escape-string-regexp@4.0.0: {} eslint-config-prettier@10.1.8(eslint@9.32.0(jiti@2.5.1)): @@ -2376,6 +2507,8 @@ snapshots: esutils@2.0.3: {} + exsolve@1.0.7: {} + fast-deep-equal@3.1.3: {} fast-diff@1.3.0: {} @@ -2427,6 +2560,15 @@ snapshots: dependencies: resolve-pkg-maps: 1.0.0 + giget@2.0.0: + dependencies: + citty: 0.1.6 + consola: 3.4.2 + defu: 6.1.4 + node-fetch-native: 1.6.7 + nypm: 0.6.1 + pathe: 2.0.3 + glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -2484,6 +2626,8 @@ snapshots: json-stable-stringify-without-jsonify@1.0.1: {} + jsonc-parser@3.3.1: {} + keyv@4.5.4: dependencies: json-buffer: 3.0.1 @@ -2575,10 +2719,22 @@ snapshots: natural-compare@1.4.0: {} + node-fetch-native@1.6.7: {} + nth-check@2.1.1: dependencies: boolbase: 1.0.0 + nypm@0.6.1: + dependencies: + citty: 0.1.6 + consola: 3.4.2 + pathe: 2.0.3 + pkg-types: 2.2.0 + tinyexec: 1.0.1 + + ohash@2.0.11: {} + optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -2625,6 +2781,12 @@ snapshots: optionalDependencies: typescript: 5.9.2 + pkg-types@2.2.0: + dependencies: + confbox: 0.2.2 + exsolve: 1.0.7 + pathe: 2.0.3 + postcss-nested@7.0.2(postcss@8.5.6): dependencies: postcss: 8.5.6 @@ -2667,8 +2829,18 @@ snapshots: queue-microtask@1.2.3: {} + rc9@2.1.2: + dependencies: + defu: 6.1.4 + destr: 2.0.5 + readdirp@4.1.2: {} + releaselog@6.0.3: + dependencies: + ci-logger: 7.0.0 + commander: 13.1.0 + resolve-from@4.0.0: {} resolve-pkg-maps@1.0.0: {} @@ -2695,7 +2867,7 @@ snapshots: - oxc-resolver - supports-color - rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4): + rolldown-vite@7.1.0(@types/node@22.17.0)(esbuild@0.25.8)(jiti@2.5.1)(terser@5.30.4)(yaml@2.8.1): dependencies: fdir: 6.4.6(picomatch@4.0.3) lightningcss: 1.30.1 @@ -2709,6 +2881,7 @@ snapshots: fsevents: 2.3.3 jiti: 2.5.1 terser: 5.30.4 + yaml: 2.8.1 rolldown@1.0.0-beta.31: dependencies: @@ -2919,6 +3092,8 @@ snapshots: xml-name-validator@4.0.0: {} + yaml@2.8.1: {} + yocto-queue@0.1.0: {} zrender@5.6.1: diff --git a/scripts/changelog.ts b/scripts/changelog.ts deleted file mode 100644 index 9b9f300..0000000 --- a/scripts/changelog.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { readFileSync } from "node:fs"; -import { join } from "node:path"; - -/** - * Extract the changelog section for the given version from CHANGELOG.md - * and print it to stdout (without leading/trailing blank lines). - * - * Usage: - * npx jiti scripts/changelog.ts 7.0.3 > tmp_release_body.md - */ - -const version = process.argv[2]; - -if (!version) { - console.error("Usage: jiti scripts/changelog.ts "); - process.exit(1); -} - -const header = `## ${version}`; -const changelogPath = join(process.cwd(), "CHANGELOG.md"); -const lines = readFileSync(changelogPath, "utf8").split(/\r?\n/); - -let capturing = false; -const section: string[] = []; - -for (const line of lines) { - if (line.startsWith("## ")) { - if (capturing) break; // reached next version header - if (line.trim() === header) { - capturing = true; // start capturing after header - continue; // skip header line itself - } - } - if (capturing) section.push(line); -} - -// Trim leading / trailing blank lines -while (section.length && section[0].trim() === "") section.shift(); -while (section.length && section[section.length - 1].trim() === "") - section.pop(); - -if (section.length === 0) { - console.error(`No changelog entry found for version ${version}`); - process.exit(1); -} - -console.log(section.join("\n")); diff --git a/scripts/dist-tag.ts b/scripts/dist-tag.ts deleted file mode 100644 index 65b998d..0000000 --- a/scripts/dist-tag.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** Resolve npm dist-tag from a semver string. - * Usage: jiti scripts/dist-tag.ts 1.2.3-beta.0 # → beta - * jiti scripts/dist-tag.ts # picks version from package.json - */ -import { readFileSync } from "node:fs"; -import { join } from "node:path"; - -// Prefer CLI arg, otherwise read package.json -const version: string = - process.argv[2] ?? - JSON.parse(readFileSync(join(process.cwd(), "package.json"), "utf8")).version; - -// Capture first recognised prerelease label -const tag = - version.match(/-(alpha|beta|rc)\b/i)?.[1].toLowerCase() ?? "latest"; - -console.log(tag); From 0631d068f50729cfb136ec6f0dccf5c6044e7e00 Mon Sep 17 00:00:00 2001 From: Yue JIN Date: Sat, 9 Aug 2025 00:11:31 +0800 Subject: [PATCH 4/6] add back build in test --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4246c7e..d82bff2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,5 +31,8 @@ jobs: - name: Typecheck run: pnpm run typecheck && pnpm run dev:typecheck + - name: Build + run: pnpm run build + - name: Publint run: pnpm run publint From d48adb004a66d071ede386799c2aabe66c2d203d Mon Sep 17 00:00:00 2001 From: Yue JIN Date: Sat, 9 Aug 2025 10:38:48 +0800 Subject: [PATCH 5/6] fix: add back dist-tag --- .github/workflows/release.yml | 6 +++++- package.json | 2 +- scripts/dist-tag.ts | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 scripts/dist-tag.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 069b5af..20edb2a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,5 +43,9 @@ jobs: - name: Build run: pnpm run build + - name: Get dist tag + id: tag + run: echo "tag=$(pnpm exec jiti scripts/dist-tag.ts '${{ github.ref_name }}')" >> $GITHUB_OUTPUT + - name: Publish to npm - run: npm i -g npm && pnpm publish --access public --tag latest --no-git-checks + run: npm i -g npm && pnpm publish --access public --tag ${{ steps.tag.outputs.tag }} --no-git-checks diff --git a/package.json b/package.json index 0c30d93..4cade4b 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "dev:preview": "vite preview", "dev:typecheck": "vue-tsc -p ./demo", "docs": "jiti ./scripts/docs.ts", - "release": "pnpm run docs && bumpp -a" + "release": "pnpm run docs && bumpp --all" }, "packageManager": "pnpm@10.14.0", "type": "module", diff --git a/scripts/dist-tag.ts b/scripts/dist-tag.ts new file mode 100644 index 0000000..f869869 --- /dev/null +++ b/scripts/dist-tag.ts @@ -0,0 +1,16 @@ +/** Resolve npm dist-tag from a semver string. + * Usage: jiti scripts/dist-tag.ts 1.2.3-beta.0 # → beta + * jiti scripts/dist-tag.ts # picks version from package.json + */ +import { readFileSync } from "node:fs"; +import { join } from "node:path"; + +// Prefer CLI arg, otherwise read package.json +const version: string = + process.argv[2] ?? + JSON.parse(readFileSync(join(process.cwd(), "package.json"), "utf8")).version; + +// Capture first recognised prerelease label +const tag = version.match(/-(alpha|beta|rc)\b/i)?.[1].toLowerCase() ?? "latest"; + +console.log(tag); From f4f0bacde866f20a36e669a4ed50bd625d42c23b Mon Sep 17 00:00:00 2001 From: Yue JIN Date: Sat, 9 Aug 2025 16:14:51 +0800 Subject: [PATCH 6/6] update ci step names --- .github/workflows/ci.yml | 4 ++-- .github/workflows/release.yml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d82bff2..926bc5c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,10 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Setup pnpm + - name: Install pnpm uses: pnpm/action-setup@v4 - - name: Setup Node.js + - name: Install Node.js uses: actions/setup-node@v4 with: node-version: 22 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 20edb2a..d161815 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,8 @@ jobs: environment: npm-publish steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 @@ -26,13 +27,13 @@ jobs: node-version: 22 cache: pnpm - - name: Install Dependencies + - name: Install dependencies run: pnpm install - name: Extract release notes run: pnpm releaselog --format=notes ${{ github.ref_name }} > RELEASE_NOTES.md - - name: Create GitHub Release + - name: Create GitHub release uses: softprops/action-gh-release@v2 with: body_path: RELEASE_NOTES.md