create-young-proj 2.0.0 → 2.2.0

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +7 -1
  3. package/dist/index.mjs +6 -6
  4. package/package.json +1 -1
  5. package/src/index.ts +6 -1
  6. package/template-electron-win7/.vscode/extensions.json +5 -0
  7. package/template-electron-win7/.vscode/settings.json +49 -0
  8. package/template-electron-win7/README.md +65 -0
  9. package/template-electron-win7/RELEASE_NOTES.md +11 -0
  10. package/template-electron-win7/_gitignore +27 -0
  11. package/template-electron-win7/dev-app-update.yml +2 -0
  12. package/template-electron-win7/electron/config/0.local.config.ts +13 -0
  13. package/template-electron-win7/electron/config/1.dev.config.ts +13 -0
  14. package/template-electron-win7/electron/config/2.test.config.ts +13 -0
  15. package/template-electron-win7/electron/config/3.wtest.config.ts +13 -0
  16. package/template-electron-win7/electron/config/4.online.config.ts +13 -0
  17. package/template-electron-win7/electron/config.ts +13 -0
  18. package/template-electron-win7/electron/electron-env.d.ts +58 -0
  19. package/template-electron-win7/electron/main.ts +318 -0
  20. package/template-electron-win7/electron/preload.ts +23 -0
  21. package/template-electron-win7/electron/update.ts +78 -0
  22. package/template-electron-win7/electron-builder.yaml +67 -0
  23. package/template-electron-win7/env/.env +1 -0
  24. package/template-electron-win7/env/.env.development +9 -0
  25. package/template-electron-win7/env/.env.production +9 -0
  26. package/template-electron-win7/eslint.config.mjs +33 -0
  27. package/template-electron-win7/index.html +16 -0
  28. package/template-electron-win7/package.json +71 -0
  29. package/template-electron-win7/public/icon.ico +0 -0
  30. package/template-electron-win7/scripts/afterPack.mjs +36 -0
  31. package/template-electron-win7/scripts/build.mjs +55 -0
  32. package/template-electron-win7/src/App.vue +23 -0
  33. package/template-electron-win7/src/auto-imports.d.ts +305 -0
  34. package/template-electron-win7/src/components/UpdateDialog.vue +166 -0
  35. package/template-electron-win7/src/components.d.ts +18 -0
  36. package/template-electron-win7/src/layouts/blank.vue +11 -0
  37. package/template-electron-win7/src/layouts/default.vue +13 -0
  38. package/template-electron-win7/src/main.ts +36 -0
  39. package/template-electron-win7/src/modules/1-router.ts +72 -0
  40. package/template-electron-win7/src/modules/2-pinia.ts +13 -0
  41. package/template-electron-win7/src/styles/variables.scss +8 -0
  42. package/template-electron-win7/src/types/global.d.ts +0 -0
  43. package/template-electron-win7/src/utils/env.ts +4 -0
  44. package/template-electron-win7/src/utils/ls.ts +118 -0
  45. package/template-electron-win7/src/views/[...all_404].vue +539 -0
  46. package/template-electron-win7/src/views/index.vue +34 -0
  47. package/template-electron-win7/src/vite-env.d.ts +27 -0
  48. package/template-electron-win7/tsconfig.json +29 -0
  49. package/template-electron-win7/tsconfig.node.json +11 -0
  50. package/template-electron-win7/uno.config.ts +32 -0
  51. package/template-electron-win7/vite.config.ts +78 -0
  52. package/template-electron-win7/yarn.lock +5964 -0
  53. package/template-nuxt-admin/error.vue +3 -3
  54. package/template-nuxt-admin/nuxt.config.ts +20 -7
  55. package/template-nuxt-admin/package.json +5 -3
  56. package/template-nuxt-admin/yarn.lock +3438 -2586
  57. package/template-nuxt-website/app.vue +45 -1
  58. package/template-nuxt-website/layouts/default.vue +18 -16
  59. package/template-nuxt-website/layouts/home.vue +14 -12
  60. package/template-nuxt-website/layouts/tabbar.vue +18 -16
  61. package/template-nuxt-website/nuxt.config.ts +20 -5
  62. package/template-nuxt-website/package.json +2 -1
  63. package/template-nuxt-website/yarn.lock +4677 -3598
@@ -0,0 +1,72 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2024-07-31 16:52:15
4
+ * @LastEditTime: 2024-07-31 17:28:36
5
+ * @Description:
6
+ * @LastEditors: zhangyang
7
+ * Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
8
+ */
9
+ import { createRouter, createWebHashHistory } from 'vue-router'
10
+ import { setupLayouts } from 'virtual:generated-layouts'
11
+ import routes from '~pages'
12
+
13
+ /**
14
+ * 路由元数据类型扩展
15
+ */
16
+ declare module 'vue-router' {
17
+ interface RouteMeta {
18
+ /**
19
+ * 页面标题
20
+ */
21
+ title: string
22
+ /**
23
+ * 是否固定
24
+ */
25
+ affix?: boolean
26
+ /**
27
+ * 是否禁用缓存
28
+ */
29
+ noCache?: boolean
30
+ /**
31
+ * 鉴权路径,不设置则为白名单页面
32
+ */
33
+ authPath?: string
34
+ /**
35
+ * 页面布局,对应 layouts 目录下的布局页面,默认为 default
36
+ */
37
+ layout?: 'default' | 'blank'
38
+ }
39
+ };
40
+
41
+ export const finalRoutes = setupLayouts(routes)
42
+ console.log('🚀 ~ finalRoutes:', finalRoutes)
43
+ // export const navMap = new Map<string, string>()
44
+ // /**
45
+ // * 生成权限节点映射表
46
+ // */
47
+ // function generateNavMap(raw: RouteRecordRaw[], base = '') {
48
+ // for (const route of raw) {
49
+ // if (route.children) {
50
+ // generateNavMap(route.children, route.path)
51
+ // }
52
+ // else {
53
+ // const meta = route.meta
54
+ // if (meta && meta.authPath) {
55
+ // navMap.set(
56
+ // meta.authPath,
57
+ // `${base}${route.path.startsWith('/') ? '' : '/'}${route.path}`,
58
+ // )
59
+ // }
60
+ // }
61
+ // }
62
+ // }
63
+ // generateNavMap(finalRoutes)
64
+
65
+ export const router = createRouter({
66
+ history: createWebHashHistory(import.meta.env.BASE_URL),
67
+ routes: finalRoutes,
68
+ })
69
+
70
+ export const install: UserModule = (app) => {
71
+ app.use(router)
72
+ }
@@ -0,0 +1,13 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2024-08-27 11:39:24
4
+ * @LastEditTime: 2024-08-27 11:39:35
5
+ * @Description:
6
+ * @LastEditors: zhangyang
7
+ * Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
8
+ */
9
+
10
+ export const install: UserModule = (app) => {
11
+ const pinia = createPinia()
12
+ app.use(pinia)
13
+ }
@@ -0,0 +1,8 @@
1
+ /**全局SCSS变量 样式值以同文件夹下的json主题配置的值为主,命名推荐全拼小驼峰,这里定义的值可随意取*/
2
+
3
+ $backgroundColor: var(--background-color, #fff);
4
+ $linkColor: var(--link-color, skyblue);
5
+
6
+ // 覆盖element的颜色配置 这里配置的颜色不会覆盖,初始化的时候通过代码进行覆盖
7
+ $primaryColor: var(--el-color-primary, #fe587f);
8
+ $textColor: var(--el-text-color, #232332);
File without changes
@@ -0,0 +1,4 @@
1
+ // 是否不为生产模式
2
+ const debug = import.meta.env.MODE !== 'production'
3
+
4
+ export default debug
@@ -0,0 +1,118 @@
1
+ /* localstorage封装,缓存工具类 参考:https://blog.csdn.net/w544924116/article/details/120906411
2
+
3
+ /** key前缀 */
4
+ const keyPrefix = 'app_cahce$_'
5
+
6
+ /**
7
+ * @param value 内容
8
+ * @param addTime 存入时间
9
+ * @param expires 有效时间
10
+ */
11
+ interface valObjParams {
12
+ value: any
13
+ addTime: number
14
+ expires: number
15
+ }
16
+
17
+ interface StorageInterface {
18
+ /**
19
+ * 设置localStorage
20
+ * @param value 内容
21
+ * @param expires 有效时间 单位 s
22
+ */
23
+ set: (key: string, value: any, expires?: number) => void
24
+ /** 获取localStorage,会自动转json */
25
+ get: (key: string) => any
26
+ /** 是否含有key */
27
+ has: (key: string) => boolean
28
+ /** 移除 */
29
+ remove: (key: string) => void
30
+ /** 移除全部缓存 */
31
+ clear: () => void
32
+ /** 移除自己前缀的全部缓存 */
33
+ clearSelf: () => void
34
+ }
35
+
36
+ const storage: StorageInterface = {
37
+ set: () => {},
38
+ get: () => '',
39
+ has: () => false,
40
+ remove: () => {},
41
+ clear: () => {},
42
+ clearSelf: () => {},
43
+ }
44
+
45
+ /**
46
+ * 是否过期
47
+ */
48
+ function isFresh(valObj: valObjParams) {
49
+ const now = new Date().getTime()
50
+ return valObj.addTime + valObj.expires >= now
51
+ }
52
+
53
+ /* 给key值添加前缀 */
54
+ function addPrefix(key: string) {
55
+ return `${keyPrefix}${key}`
56
+ }
57
+
58
+ /* 加方法 */
59
+ function extend(s: Storage) {
60
+ return {
61
+ set(key: string, value: any, expires?: number) {
62
+ const skey = addPrefix(key)
63
+ if (expires) {
64
+ expires *= 1000 // 将过期时间从微秒转为秒
65
+ s.setItem(
66
+ skey,
67
+ JSON.stringify({
68
+ value,
69
+ addTime: new Date().getTime(),
70
+ expires,
71
+ }),
72
+ )
73
+ }
74
+ else {
75
+ const val = JSON.stringify(value)
76
+ s.setItem(skey, val)
77
+ }
78
+ if (value === undefined || value === null) {
79
+ s.removeItem(skey)
80
+ }
81
+ },
82
+ get(key: string) {
83
+ const skey = addPrefix(key)
84
+ const item = JSON.parse(s.getItem(skey) as any)
85
+ // 如果有addTime的值,说明设置了失效时间
86
+ if (item && item.addTime) {
87
+ if (isFresh(item)) {
88
+ return item.value
89
+ }
90
+ /* 缓存过期,清除缓存,返回null */
91
+ s.removeItem(skey)
92
+ return null
93
+ }
94
+ return item
95
+ },
96
+ has(key: string) {
97
+ const skey = addPrefix(key)
98
+ return !!s.getItem(skey)
99
+ },
100
+ remove: (key: string) => {
101
+ const skey = addPrefix(key)
102
+ s.removeItem(skey)
103
+ },
104
+ clear: () => {
105
+ s.clear()
106
+ },
107
+ clearSelf: () => {
108
+ const arr = Array.from({ length: s.length }, (_, i) => s.key(i)).filter(
109
+ str => str?.startsWith(keyPrefix),
110
+ )
111
+ arr.forEach(str => s.removeItem(str as string))
112
+ },
113
+ }
114
+ }
115
+
116
+ Object.assign(storage, extend(window.localStorage))
117
+
118
+ export default storage