vite-plugin-qingkuai 1.0.24 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/.github/workflows/release.yml +0 -106
- package/.husky/pre-commit +0 -1
- package/scripts/release.js +0 -94
package/package.json
CHANGED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- "v*"
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
inputs:
|
|
9
|
-
tag:
|
|
10
|
-
type: string
|
|
11
|
-
required: false
|
|
12
|
-
description: "Optional tag to release (for example: v1.0.66). Leave empty to auto-create from package version."
|
|
13
|
-
|
|
14
|
-
permissions:
|
|
15
|
-
contents: write
|
|
16
|
-
id-token: write
|
|
17
|
-
|
|
18
|
-
jobs:
|
|
19
|
-
release:
|
|
20
|
-
runs-on: ubuntu-latest
|
|
21
|
-
|
|
22
|
-
steps:
|
|
23
|
-
- name: Checkout source
|
|
24
|
-
uses: actions/checkout@v6
|
|
25
|
-
with:
|
|
26
|
-
fetch-depth: 0
|
|
27
|
-
|
|
28
|
-
- name: Resolve release tag
|
|
29
|
-
id: tag
|
|
30
|
-
env:
|
|
31
|
-
INPUT_TAG: ${{ inputs.tag }}
|
|
32
|
-
REF_NAME: ${{ github.ref_name }}
|
|
33
|
-
EVENT_NAME: ${{ github.event_name }}
|
|
34
|
-
run: |
|
|
35
|
-
if [[ "$EVENT_NAME" == "push" ]]; then
|
|
36
|
-
echo "value=$REF_NAME" >> "$GITHUB_OUTPUT"
|
|
37
|
-
exit 0
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
if [[ -n "$INPUT_TAG" ]]; then
|
|
41
|
-
echo "value=$INPUT_TAG" >> "$GITHUB_OUTPUT"
|
|
42
|
-
exit 0
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
package_version="$(node -p 'require("./package.json").version')"
|
|
46
|
-
echo "value=v$package_version" >> "$GITHUB_OUTPUT"
|
|
47
|
-
|
|
48
|
-
- name: Ensure tag exists on workflow dispatch
|
|
49
|
-
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
50
|
-
env:
|
|
51
|
-
TAG: ${{ steps.tag.outputs.value }}
|
|
52
|
-
run: |
|
|
53
|
-
git fetch origin --tags --prune
|
|
54
|
-
|
|
55
|
-
if git rev-parse --verify --quiet "refs/tags/$TAG" >/dev/null; then
|
|
56
|
-
echo "Tag already exists: $TAG"
|
|
57
|
-
else
|
|
58
|
-
git config user.name "github-actions[bot]"
|
|
59
|
-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
60
|
-
git tag "$TAG"
|
|
61
|
-
git push origin "$TAG"
|
|
62
|
-
echo "Created and pushed tag: $TAG"
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
- name: Checkout resolved tag
|
|
66
|
-
env:
|
|
67
|
-
TAG: ${{ steps.tag.outputs.value }}
|
|
68
|
-
run: |
|
|
69
|
-
git fetch origin --tags --prune
|
|
70
|
-
git checkout "refs/tags/$TAG"
|
|
71
|
-
|
|
72
|
-
- name: Setup pnpm
|
|
73
|
-
uses: pnpm/action-setup@v6
|
|
74
|
-
|
|
75
|
-
- name: Setup Node.js
|
|
76
|
-
uses: actions/setup-node@v6
|
|
77
|
-
with:
|
|
78
|
-
node-version: 24
|
|
79
|
-
cache: pnpm
|
|
80
|
-
registry-url: https://registry.npmjs.org
|
|
81
|
-
|
|
82
|
-
- name: Install dependencies
|
|
83
|
-
run: pnpm install --frozen-lockfile --ignore-scripts
|
|
84
|
-
|
|
85
|
-
- name: Validate tag equals package version
|
|
86
|
-
env:
|
|
87
|
-
TAG: ${{ steps.tag.outputs.value }}
|
|
88
|
-
run: |
|
|
89
|
-
package_version="$(node -p 'require("./package.json").version')"
|
|
90
|
-
if [[ "v$package_version" != "$TAG" ]]; then
|
|
91
|
-
echo "Tag and package.json version mismatch: $TAG vs v$package_version"
|
|
92
|
-
exit 1
|
|
93
|
-
fi
|
|
94
|
-
|
|
95
|
-
- name: Build
|
|
96
|
-
run: pnpm build
|
|
97
|
-
|
|
98
|
-
- name: Publish package to npm (Trusted Publishing)
|
|
99
|
-
run: npm publish --access public --provenance
|
|
100
|
-
|
|
101
|
-
- name: Create GitHub Release
|
|
102
|
-
uses: softprops/action-gh-release@v2
|
|
103
|
-
with:
|
|
104
|
-
tag_name: ${{ steps.tag.outputs.value }}
|
|
105
|
-
name: ${{ steps.tag.outputs.value }}
|
|
106
|
-
body: "Release ${{ steps.tag.outputs.value }}"
|
package/.husky/pre-commit
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
pnpm lint-staged
|
package/scripts/release.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import nodeFs from "node:fs"
|
|
3
|
-
import nodePath from "node:path"
|
|
4
|
-
|
|
5
|
-
import { spawnSync } from "node:child_process"
|
|
6
|
-
|
|
7
|
-
const ROOT = nodePath.resolve(process.cwd())
|
|
8
|
-
const PKG_PATH = nodePath.join(ROOT, "package.json")
|
|
9
|
-
|
|
10
|
-
main()
|
|
11
|
-
|
|
12
|
-
function readPackageJson() {
|
|
13
|
-
return JSON.parse(nodeFs.readFileSync(PKG_PATH, "utf-8"))
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function writePackageJson(pkg) {
|
|
17
|
-
nodeFs.writeFileSync(PKG_PATH, JSON.stringify(pkg, null, 2) + "\n", "utf-8")
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function bumpVersion(version) {
|
|
21
|
-
const parts = version.split(".").map(Number)
|
|
22
|
-
if (parts.length !== 3 || parts.some(n => Number.isNaN(n) || n < 0)) {
|
|
23
|
-
throw new Error(`Unsupported version format: ${version}`)
|
|
24
|
-
}
|
|
25
|
-
parts[2] += 1
|
|
26
|
-
return parts.join(".")
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async function run(command, args, opts = {}) {
|
|
30
|
-
const result = spawnSync(command, args, { stdio: "inherit", ...opts })
|
|
31
|
-
if (result.error) {
|
|
32
|
-
throw result.error
|
|
33
|
-
}
|
|
34
|
-
if (result.status !== 0) {
|
|
35
|
-
throw new Error(`Command failed: ${command} ${args.join(" ")}`)
|
|
36
|
-
}
|
|
37
|
-
return result
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function verifyCleanWorkingTree() {
|
|
41
|
-
const result = spawnSync("git", ["status", "--porcelain"], {
|
|
42
|
-
encoding: "utf-8",
|
|
43
|
-
stdio: ["ignore", "pipe", "inherit"]
|
|
44
|
-
})
|
|
45
|
-
if (result.error) {
|
|
46
|
-
throw result.error
|
|
47
|
-
}
|
|
48
|
-
if (result.status !== 0) {
|
|
49
|
-
throw new Error("Failed to check git working tree status")
|
|
50
|
-
}
|
|
51
|
-
if (result.stdout.trim()) {
|
|
52
|
-
throw new Error(
|
|
53
|
-
"Git working tree is not clean. Please commit or stash your changes before releasing."
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async function release() {
|
|
59
|
-
verifyCleanWorkingTree()
|
|
60
|
-
const pkg = readPackageJson()
|
|
61
|
-
const currentVersion = pkg.version
|
|
62
|
-
if (!currentVersion) {
|
|
63
|
-
throw new Error("package.json is missing version")
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const arg = process.argv[2]
|
|
67
|
-
const newVersion = arg ? arg.replace(/^v/, "") : bumpVersion(currentVersion)
|
|
68
|
-
const tag = `v${newVersion}`
|
|
69
|
-
|
|
70
|
-
if (newVersion === currentVersion) {
|
|
71
|
-
console.log(`Version unchanged: ${newVersion}`)
|
|
72
|
-
return
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
pkg.version = newVersion
|
|
76
|
-
writePackageJson(pkg)
|
|
77
|
-
|
|
78
|
-
await run("git", ["add", "package.json"])
|
|
79
|
-
await run("git", ["commit", "-m", `release: bump version to ${tag}`])
|
|
80
|
-
await run("git", ["tag", tag])
|
|
81
|
-
await run("git", ["push"])
|
|
82
|
-
await run("git", ["push", "origin", tag])
|
|
83
|
-
|
|
84
|
-
console.log(`Released ${tag}`)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async function main() {
|
|
88
|
-
try {
|
|
89
|
-
await release()
|
|
90
|
-
} catch (error) {
|
|
91
|
-
console.error(error instanceof Error ? error.message : error)
|
|
92
|
-
process.exit(1)
|
|
93
|
-
}
|
|
94
|
-
}
|