create-jnrs-vue 1.2.23 → 1.2.24

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,90 @@
1
+ /**
2
+ * @Author : TanRui
3
+ * @WeChat : Tan578853789
4
+ * @File : upgrade.mjs
5
+ * @Date : 2026/04/13
6
+ * @Desc. : 安全升级脚手架模板(保留用户自定义配置)
7
+ */
8
+
9
+ import { execSync } from 'child_process'
10
+ import { cpSync, readFileSync, writeFileSync, rmSync, existsSync } from 'fs'
11
+ import { join } from 'path'
12
+
13
+ const TEMP_DIR = 'temp_new'
14
+ const TEMPLATE_FILES = [
15
+ 'package.json',
16
+ 'vite.config.ts',
17
+ 'eslint.config.ts',
18
+ '.prettierrc.json',
19
+ 'tsconfig.json',
20
+ 'index.html'
21
+ ]
22
+
23
+ console.log('🔄 正在拉取最新模板...')
24
+
25
+ // 1. 清理旧临时目录(避免冲突)
26
+ if (existsSync(TEMP_DIR)) {
27
+ rmSync(TEMP_DIR, { recursive: true, force: true })
28
+ }
29
+
30
+ // 2. 静默创建最新模板(跳过所有交互)
31
+ try {
32
+ execSync(`pnpm create jnrs-vue@latest ${TEMP_DIR} -- --silent --no-git --no-install`, {
33
+ stdio: 'inherit',
34
+ env: {
35
+ ...process.env,
36
+ // 强制非交互模式(部分脚手架识别此变量)
37
+ CI: 'true'
38
+ }
39
+ })
40
+ } catch {
41
+ console.error('❌ 模板拉取失败,请检查网络或 jnrs-vue 是否发布')
42
+ process.exit(1)
43
+ }
44
+
45
+ // 3. 合并 package.json(保留用户 scripts/dependencies 等)
46
+ try {
47
+ const currentPkg = JSON.parse(readFileSync('package.json', 'utf8'))
48
+ const newPkg = JSON.parse(readFileSync(join(TEMP_DIR, 'package.json'), ' utf8'))
49
+
50
+ // 保留用户字段:name, version, description, author, private, scripts, dependencies, devDependencies
51
+ const mergedPkg = {
52
+ ...newPkg,
53
+ name: currentPkg.name,
54
+ version: currentPkg.version,
55
+ description: currentPkg.description,
56
+ author: currentPkg.author,
57
+ private: currentPkg.private,
58
+ scripts: { ...newPkg.scripts, ...currentPkg.scripts }, // 新脚本优先,但保留用户自定义
59
+ dependencies: { ...newPkg.dependencies, ...currentPgk.dependencies },
60
+ devDependencies: { ...newPkg.devDependencies, ...currentPkg.devDependencies }
61
+ }
62
+
63
+ writeFileSync('package.json', JSON.stringify(mergedPkg, null, 2) + '\n')
64
+ console.log('✅ 合并: package.json')
65
+ } catch (error) {
66
+ console.warn('⚠️ package.json 合并失败,跳过', error)
67
+ }
68
+
69
+ // 4. 同步其他配置文件
70
+ for (const file of TEMPLATE_FILES) {
71
+ const src = join(TEMP_DIR, file)
72
+ const dest = file
73
+ if (existsSync(src)) {
74
+ cpSync(src, dest, { force: true })
75
+ console.log(`✅ 同步: ${file}`)
76
+ } else {
77
+ console.warn(`⚠️ 跳过: ${file} (模板中不存在)`)
78
+ }
79
+ }
80
+
81
+ // 5. 提示用户
82
+ console.log('\n🔧 请运行:')
83
+ console.log(' pnpm install')
84
+ console.log('\n📝 注意:')
85
+ console.log(' - 检查 package.json 中的依赖版本是否冲突')
86
+ console.log(' - src/ 目录未更新,请手动参考 temp_new/src 合并新功能(如有)')
87
+ console.log(' - 如使用 auto-imports.d.ts,可能需重新生成')
88
+
89
+ // 6. 清理
90
+ rmSync(TEMP_DIR, { recursive: true, force: true })
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jnrs-vue",
3
- "version": "1.2.23",
3
+ "version": "1.2.24",
4
4
  "description": "JNRS 信息化管理系统",
5
5
  "author": "talia_tan",
6
6
  "private": true,
@@ -8,9 +8,6 @@
8
8
  "engines": {
9
9
  "node": "^20.19.0 || >=22.12.0"
10
10
  },
11
- "bin": {
12
- "upgrade-jnrs-vue": "./bin/upgrade.mjs"
13
- },
14
11
  "scripts": {
15
12
  "dev": "vite",
16
13
  "build": "run-p type-check \"build-only {@}\" --",
@@ -22,9 +19,9 @@
22
19
  },
23
20
  "dependencies": {
24
21
  "@element-plus/icons-vue": "^2.3.2",
25
- "@jnrs/shared": "1.1.16",
26
- "@jnrs/vue-core": "1.2.11",
27
- "@jnrs/lingshu-smart": "2.2.4",
22
+ "@jnrs/shared": "1.1.17",
23
+ "@jnrs/vue-core": "1.2.12",
24
+ "@jnrs/lingshu-smart": "2.2.5",
28
25
  "@vueuse/core": "^14.1.0",
29
26
  "element-plus": "^2.13.3",
30
27
  "pinia": "^3.0.4",
@@ -6,9 +6,8 @@ import { ref, onActivated, nextTick } from 'vue'
6
6
  import { ElMessage, ElMessageBox } from 'element-plus'
7
7
  import { Plus } from '@element-plus/icons-vue'
8
8
  import { useRoute } from '@jnrs/vue-core/router'
9
- import { objectMatchAssign, dateFormatsToObject } from '@jnrs/shared'
9
+ import { objectMatchAssign, dateFormatsToObject, isNumberGtZero } from '@jnrs/shared'
10
10
  import { debounce } from '@jnrs/shared/lodash'
11
- import { isNumberGtZero } from '@jnrs/shared/validator'
12
11
  import { getDictList, downloadFile, extractFieldId } from '@/utils'
13
12
  import { useI18n } from '@/locales'
14
13
  import {
@@ -6,7 +6,7 @@ import type { IMenuItem } from '@jnrs/vue-core'
6
6
  import { hasPermission } from '@/utils/permissions'
7
7
  import { MenuApi } from '@/api/system'
8
8
  import { formatDateTime, formatWeekday } from '@jnrs/shared'
9
- import { isFloatGtZero } from '@jnrs/shared/validator'
9
+ import { verifyFloatGtZero } from '@jnrs/shared'
10
10
  import { testI18n } from '@jnrs/shared/request'
11
11
 
12
12
  const routeOptions = ref<IMenuItem[]>([])
@@ -48,14 +48,14 @@ const handleRouterSystemMine = () => {
48
48
 
49
49
  const changeI18n = () => {
50
50
  datetime.value = formatDateTime() + ' ' + formatWeekday()
51
- isFloatGtZero({}, '0', (msg) => {
51
+ verifyFloatGtZero({}, '0', (msg) => {
52
52
  validator.value = msg
53
53
  })
54
54
  testI18nInCore.value = testI18n()
55
55
  }
56
56
 
57
57
  onMounted(() => {
58
- isFloatGtZero({}, '0', (msg) => {
58
+ verifyFloatGtZero({}, '0', (msg) => {
59
59
  validator.value = msg
60
60
  })
61
61
  testI18nInCore.value = testI18n()
@@ -4,7 +4,7 @@ import { ref } from 'vue'
4
4
  import { RoleApi, LoginApi } from '@/api/system'
5
5
  import { useAuthStore } from '@/stores'
6
6
  import { handleRouter, useRoute } from '@jnrs/vue-core/router'
7
- import { isWeakPwd } from '@jnrs/shared/validator'
7
+ import { verifyWeakPwd } from '@jnrs/shared'
8
8
  import { formatDateTime, formatWeekday } from '@jnrs/shared'
9
9
  import { GlobalSetting } from '@jnrs/vue-core/components'
10
10
 
@@ -30,7 +30,7 @@ const rules = ref<FormRules>({
30
30
  account: [{ required: true, message: '请输入用户名', trigger: 'change' }],
31
31
  password: [
32
32
  { required: true, message: '请输入密码', trigger: 'change' },
33
- { validator: isWeakPwd, trigger: 'change' }
33
+ { validator: verifyWeakPwd, trigger: 'change' }
34
34
  ]
35
35
  })
36
36
 
@@ -3,7 +3,7 @@ import { reactive, ref } from 'vue'
3
3
  import { PasswordChangeApi } from '@/api/system'
4
4
  import { useAuthStore } from '@/stores'
5
5
  import { handleRouter } from '@jnrs/vue-core/router'
6
- import { isWeakPwd } from '@jnrs/shared/validator'
6
+ import { verifyWeakPwd } from '@jnrs/shared'
7
7
  import type { FormInstance, FormItemRule } from 'element-plus'
8
8
  import { ElMessage } from 'element-plus'
9
9
  import { LogoutApi } from '@/api/system'
@@ -21,7 +21,7 @@ const rules = reactive({
21
21
  password: [
22
22
  { required: true, message: '请输入', trigger: 'change' },
23
23
  {
24
- validator: isWeakPwd,
24
+ validator: verifyWeakPwd,
25
25
  trigger: 'change'
26
26
  }
27
27
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-jnrs-vue",
3
- "version": "1.2.23",
3
+ "version": "1.2.24",
4
4
  "description": "巨能前端工程化开发,Vue 项目模板脚手架",
5
5
  "keywords": [
6
6
  "vue",
@@ -17,7 +17,8 @@
17
17
  },
18
18
  "type": "module",
19
19
  "bin": {
20
- "create-jnrs-vue": "./bin/create.mjs"
20
+ "create-jnrs-vue": "./bin/create.mjs",
21
+ "upgrade-jnrs-vue": "./bin/upgrade.mjs"
21
22
  },
22
23
  "files": [
23
24
  "bin",
@@ -1,40 +0,0 @@
1
- /**
2
- * @Author : TanRui
3
- * @WeChat : Tan578853789
4
- * @File : upgrade.mjs
5
- * @Date : 2026/03/11
6
- * @Desc. : 脚手架升级脚本
7
- */
8
-
9
- import { execSync } from 'child_process'
10
- import { cpSync, readFileSync, writeFileSync, rmSync } from 'fs'
11
- import { join } from 'path'
12
-
13
- console.log('🔄 正在拉取最新模板...')
14
-
15
- // 1. 临时创建一个最新版模板
16
- execSync('pnpm create jnrs-vue@latest ./_temp_new --force', {
17
- stdio: 'inherit'
18
- })
19
-
20
- // 2. 安静地复制关键配置文件(不覆盖 src/)
21
- const filesToSync = ['package.json', 'vite.config.ts', '.eslintrc.cjs', '.prettierrc', 'tsconfig.json', 'index.html']
22
-
23
- for (const file of filesToSync) {
24
- try {
25
- cpSync(join('_temp_new', file), file, { force: true })
26
- console.log(`✅ 同步: ${file}`)
27
- } catch (e) {
28
- console.warn(`⚠️ 跳过: ${file} (可能不存在)`)
29
- }
30
- }
31
-
32
- // 3. 提示用户手动处理依赖和业务代码
33
- console.log('\n🔧 请运行:')
34
- console.log(' pnpm install')
35
- console.log('\n📝 注意:')
36
- console.log(' - 检查 package.json 差异')
37
- console.log(' - src/ 目录未自动更新,请手动合并新功能')
38
-
39
- // 4. 清理临时目录
40
- rmSync('_temp_new', { recursive: true, force: true })
@@ -1,115 +0,0 @@
1
- /**
2
- * 文件信息
3
- */
4
- export interface IAttachment {
5
- /**
6
- * 数据 id
7
- */
8
- id: number;
9
- /**
10
- * 文件 id
11
- */
12
- documentId: number;
13
- /**
14
- * 文件名
15
- */
16
- fileName: string;
17
- /**
18
- * 文件名唯一标识(用于文件获取 API)
19
- */
20
- uniqueFileName: string;
21
- /**
22
- * MIME 类型
23
- */
24
- fileType: string;
25
- /**
26
- * 文件大小 单位:字节(Bytes)
27
- */
28
- fileSize: number;
29
- }
30
- /**
31
- * 文件容器(用于图片或附件)
32
- */
33
- export interface IDocument {
34
- id: number;
35
- description: string | null;
36
- attachments: IAttachment[];
37
- }
38
- /**
39
- * 图片 & 附件数据
40
- */
41
- export interface IFile {
42
- /**
43
- * 图片
44
- */
45
- imageDocument?: IDocument;
46
- /**
47
- * 附件
48
- */
49
- attachmentDocument?: IDocument;
50
- }
51
- /**
52
- * 分页
53
- */
54
- export interface IPagination {
55
- /**
56
- * 当前页码
57
- */
58
- pageNo: number;
59
- /**
60
- * 每页大小
61
- */
62
- pageSize: number;
63
- }
64
- /**
65
- * 分页列表数据
66
- */
67
- export interface IPageTableData<T = Record<string, any>> extends IPagination {
68
- /**
69
- * 数据列表
70
- */
71
- list: T[];
72
- /**
73
- * 数据总数
74
- */
75
- count: number;
76
- }
77
- /**
78
- * 用户信息
79
- */
80
- export interface IUser {
81
- id: number;
82
- name: string;
83
- role: number;
84
- permissions?: string[];
85
- jobTitle?: number;
86
- workNo?: string;
87
- workgroup?: string;
88
- avatarFileName?: string;
89
- [key: string]: unknown;
90
- }
91
- /**
92
- * 字典
93
- */
94
- export interface IDictItem {
95
- label: string;
96
- value: string | number;
97
- sequence: number;
98
- displayColor?: string;
99
- [key: string]: unknown;
100
- }
101
- /**
102
- * 字典键值对
103
- */
104
- export interface IDict {
105
- [key: string]: IDictItem[];
106
- }
107
- /**
108
- * 角色
109
- */
110
- export interface IRole {
111
- label: string;
112
- value: string | number;
113
- permissions?: string[];
114
- [key: string]: unknown;
115
- }
@@ -1 +0,0 @@
1
- export {};