vue3-django 0.1.11 → 0.1.13

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.
@@ -0,0 +1,37 @@
1
+ # 自动发布 npm
2
+
3
+ 推送 `v*` 标签会触发 `.github/workflows/publish.yml`,依次校验版本、安装依赖、运行测试、构建、预览打包内容并发布到 npm 的 `latest` 标签。任一步失败都会停止发布。仅支持正式版本,例如 `v0.1.12`;预发布版本会被拒绝。
4
+
5
+ ## 一次性配置
6
+
7
+ 将 workflow 提交并推送到 `szuprefix/vue3-django`,确保仓库启用了 GitHub Actions。
8
+
9
+ 以包维护者身份打开 npm 的 `vue3-django` 包设置,添加 GitHub Actions Trusted Publisher:
10
+
11
+ | 字段 | 值 |
12
+ | -------------------- | ---------------------- |
13
+ | Organization or user | `szuprefix` |
14
+ | Repository | `vue3-django` |
15
+ | Workflow filename | `publish.yml` |
16
+ | Environment name | 留空 |
17
+ | Allowed actions | 允许直接 `npm publish` |
18
+
19
+ 使用 GitHub 托管 runner 和 Node.js 24,通过 OIDC 获取发布身份,无需添加 `NPM_TOKEN`。npm CLI 必须至少为 11.5.1。包必须已经存在;如果尚未创建,先由维护者手动完成首次发布,再配置 Trusted Publisher。
20
+
21
+ 参考:[npm Trusted Publishing 文档](https://docs.npmjs.com/trusted-publishers/)。
22
+
23
+ ## 发布新版
24
+
25
+ 先将本次发布的代码提交到 `main`,确认工作区干净,再执行:
26
+
27
+ ```sh
28
+ git switch main
29
+ git pull --ff-only
30
+ npm version patch
31
+ git push origin main
32
+ git push origin "v$(node -p 'require("./package.json").version')"
33
+ ```
34
+
35
+ `npm version patch` 同步更新 `package.json` 和 `package-lock.json`,创建版本提交与 `v版本号` 标签。也可以使用 `npm version minor` 或 `npm version major`。最后一条命令只推送本次版本标签。
36
+
37
+ 在 GitHub Actions 的 **Publish to npm** 查看结果。npm 不允许覆盖已发布版本;已经成功发布后,需递增版本号再次发布。失败且该版本尚未发布时,可在 Actions 中重新运行失败的任务。
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "vue3-django",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "DRF metadata-driven Vue 3 framework",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/szuprefix/vue3-django.git"
8
+ },
5
9
  "keywords": [
6
10
  "vue3",
7
11
  "element-plus",
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed, ref, watch } from 'vue'
3
- import { ElSelect, ElOption } from 'element-plus'
3
+ import { ElSelect, ElOption, ElMessage } from 'element-plus'
4
4
  import Actions from './Actions.vue'
5
5
 
6
6
  const props = defineProps({
@@ -11,6 +11,12 @@ const props = defineProps({
11
11
  execute: Function,
12
12
  })
13
13
  const emit = defineEmits(['done', 'error'])
14
+ function onDone(result, action) {
15
+ const rows = result?.rows ?? result?.data?.rows
16
+ const countInfo = rows >= 0 ? `${rows}条记录` : ''
17
+ ElMessage.success(`操作成功${countInfo}.`)
18
+ emit('done', result, action)
19
+ }
14
20
  const scope = ref('select')
15
21
  const scopes = computed(() => {
16
22
  const selected = props.context.selection?.length ?? 0
@@ -73,7 +79,7 @@ watch(
73
79
  :permission-function="permissionFunction"
74
80
  :execute="execute"
75
81
  compact
76
- @done="(result, action) => emit('done', result, action)"
82
+ @done="onDone"
77
83
  @error="emit('error', $event)"
78
84
  />
79
85
  </div>
@@ -1,6 +1,6 @@
1
1
  // Small compatibility helpers used by migrated media config files.
2
2
  export function duration(value) {
3
- if (value == null || value === '' || !Number.isFinite(Number(value))) return ''
3
+ if (value == null || value === '' || !Number.isFinite(Number(value))) return '—'
4
4
  const seconds = Math.max(0, Number(value))
5
5
  return `${Math.floor(seconds / 60)}'${Math.floor(seconds % 60)}''`
6
6
  }