create-young-proj 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/CHANGELOG.md +17 -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
@@ -0,0 +1,55 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2024-09-03 17:39:09
4
+ * @LastEditTime: 2024-09-04 11:59:33
5
+ * @Description:
6
+ * @LastEditors: zhangyang
7
+ * Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
8
+ */
9
+ import { copyFileSync } from 'node:fs'
10
+ import { consola } from 'consola'
11
+ import prompts from 'prompts'
12
+ import { execa } from 'execa'
13
+ import task from 'tasuku'
14
+
15
+ consola.box('BluesYoung-web\'s build script')
16
+
17
+ consola.info('<==================== Start Build ====================>')
18
+
19
+ const EnvChoices = [
20
+ { title: 'dev: 开发服', value: 'dev' },
21
+ { title: 'test: 测试服', value: 'test' },
22
+ { title: 'wtest: 外网测试服', value: 'wtest' },
23
+ { title: 'online: 正式服', value: 'online' },
24
+ ]
25
+
26
+ const answer = await prompts([{
27
+ message: '请选择构建模式:',
28
+ type: 'autocomplete',
29
+ initial: 'dev',
30
+ name: 'env',
31
+ choices: EnvChoices,
32
+ }], {
33
+ onCancel: () => {
34
+ consola.info('<==================== 主动终止 ====================>')
35
+ process.exit(0)
36
+ },
37
+ })
38
+
39
+ console.log('🚀 ~ mode:', answer)
40
+
41
+ task('build', async () => {
42
+ await task.group(t => [
43
+ t('inject env', async () => {
44
+ const index = EnvChoices.findIndex(item => item.value === answer.env)
45
+
46
+ await copyFileSync(`electron/config/${index + 1}.${answer.env}.config.ts`, 'electron/config.ts')
47
+ }),
48
+ t('build client', async () => {
49
+ await execa('vite', ['build', '--mode', 'production'])
50
+ }),
51
+ t('build exe', async () => {
52
+ await execa('electron-builder')
53
+ }),
54
+ ])
55
+ })
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts"></script>
2
+
3
+ <template>
4
+ <router-view />
5
+ <update-dialog />
6
+ </template>
7
+
8
+ <style scoped>
9
+ .logo {
10
+ height: 6em;
11
+ padding: 1.5em;
12
+ will-change: filter;
13
+ transition: filter 300ms;
14
+ }
15
+
16
+ .logo:hover {
17
+ filter: drop-shadow(0 0 2em #646cffaa);
18
+ }
19
+
20
+ .logo.vue:hover {
21
+ filter: drop-shadow(0 0 2em #42b883aa);
22
+ }
23
+ </style>
@@ -0,0 +1,305 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // noinspection JSUnusedGlobalSymbols
5
+ // Generated by unplugin-auto-import
6
+ export {}
7
+ declare global {
8
+ const EffectScope: typeof import('vue')['EffectScope']
9
+ const ElMessage: typeof import('element-plus/es')['ElMessage']
10
+ const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
11
+ const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
12
+ const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
13
+ const computed: typeof import('vue')['computed']
14
+ const computedAsync: typeof import('@vueuse/core')['computedAsync']
15
+ const computedEager: typeof import('@vueuse/core')['computedEager']
16
+ const computedInject: typeof import('@vueuse/core')['computedInject']
17
+ const computedWithControl: typeof import('@vueuse/core')['computedWithControl']
18
+ const controlledComputed: typeof import('@vueuse/core')['controlledComputed']
19
+ const controlledRef: typeof import('@vueuse/core')['controlledRef']
20
+ const createApp: typeof import('vue')['createApp']
21
+ const createEventHook: typeof import('@vueuse/core')['createEventHook']
22
+ const createGlobalState: typeof import('@vueuse/core')['createGlobalState']
23
+ const createInjectionState: typeof import('@vueuse/core')['createInjectionState']
24
+ const createPinia: typeof import('pinia')['createPinia']
25
+ const createReactiveFn: typeof import('@vueuse/core')['createReactiveFn']
26
+ const createReusableTemplate: typeof import('@vueuse/core')['createReusableTemplate']
27
+ const createSharedComposable: typeof import('@vueuse/core')['createSharedComposable']
28
+ const createTemplatePromise: typeof import('@vueuse/core')['createTemplatePromise']
29
+ const createUnrefFn: typeof import('@vueuse/core')['createUnrefFn']
30
+ const customRef: typeof import('vue')['customRef']
31
+ const debouncedRef: typeof import('@vueuse/core')['debouncedRef']
32
+ const debouncedWatch: typeof import('@vueuse/core')['debouncedWatch']
33
+ const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
34
+ const defineComponent: typeof import('vue')['defineComponent']
35
+ const defineStore: typeof import('pinia')['defineStore']
36
+ const eagerComputed: typeof import('@vueuse/core')['eagerComputed']
37
+ const effectScope: typeof import('vue')['effectScope']
38
+ const extendRef: typeof import('@vueuse/core')['extendRef']
39
+ const getActivePinia: typeof import('pinia')['getActivePinia']
40
+ const getCurrentInstance: typeof import('vue')['getCurrentInstance']
41
+ const getCurrentScope: typeof import('vue')['getCurrentScope']
42
+ const h: typeof import('vue')['h']
43
+ const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
44
+ const inject: typeof import('vue')['inject']
45
+ const injectLocal: typeof import('@vueuse/core')['injectLocal']
46
+ const isDefined: typeof import('@vueuse/core')['isDefined']
47
+ const isProxy: typeof import('vue')['isProxy']
48
+ const isReactive: typeof import('vue')['isReactive']
49
+ const isReadonly: typeof import('vue')['isReadonly']
50
+ const isRef: typeof import('vue')['isRef']
51
+ const makeDestructurable: typeof import('@vueuse/core')['makeDestructurable']
52
+ const mapActions: typeof import('pinia')['mapActions']
53
+ const mapGetters: typeof import('pinia')['mapGetters']
54
+ const mapState: typeof import('pinia')['mapState']
55
+ const mapStores: typeof import('pinia')['mapStores']
56
+ const mapWritableState: typeof import('pinia')['mapWritableState']
57
+ const markRaw: typeof import('vue')['markRaw']
58
+ const nextTick: typeof import('vue')['nextTick']
59
+ const onActivated: typeof import('vue')['onActivated']
60
+ const onBeforeMount: typeof import('vue')['onBeforeMount']
61
+ const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
62
+ const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
63
+ const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
64
+ const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
65
+ const onClickOutside: typeof import('@vueuse/core')['onClickOutside']
66
+ const onDeactivated: typeof import('vue')['onDeactivated']
67
+ const onErrorCaptured: typeof import('vue')['onErrorCaptured']
68
+ const onKeyStroke: typeof import('@vueuse/core')['onKeyStroke']
69
+ const onLongPress: typeof import('@vueuse/core')['onLongPress']
70
+ const onMounted: typeof import('vue')['onMounted']
71
+ const onRenderTracked: typeof import('vue')['onRenderTracked']
72
+ const onRenderTriggered: typeof import('vue')['onRenderTriggered']
73
+ const onScopeDispose: typeof import('vue')['onScopeDispose']
74
+ const onServerPrefetch: typeof import('vue')['onServerPrefetch']
75
+ const onStartTyping: typeof import('@vueuse/core')['onStartTyping']
76
+ const onUnmounted: typeof import('vue')['onUnmounted']
77
+ const onUpdated: typeof import('vue')['onUpdated']
78
+ const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
79
+ const provide: typeof import('vue')['provide']
80
+ const provideLocal: typeof import('@vueuse/core')['provideLocal']
81
+ const reactify: typeof import('@vueuse/core')['reactify']
82
+ const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
83
+ const reactive: typeof import('vue')['reactive']
84
+ const reactiveComputed: typeof import('@vueuse/core')['reactiveComputed']
85
+ const reactiveOmit: typeof import('@vueuse/core')['reactiveOmit']
86
+ const reactivePick: typeof import('@vueuse/core')['reactivePick']
87
+ const readonly: typeof import('vue')['readonly']
88
+ const ref: typeof import('vue')['ref']
89
+ const refAutoReset: typeof import('@vueuse/core')['refAutoReset']
90
+ const refDebounced: typeof import('@vueuse/core')['refDebounced']
91
+ const refDefault: typeof import('@vueuse/core')['refDefault']
92
+ const refThrottled: typeof import('@vueuse/core')['refThrottled']
93
+ const refWithControl: typeof import('@vueuse/core')['refWithControl']
94
+ const resolveComponent: typeof import('vue')['resolveComponent']
95
+ const resolveRef: typeof import('@vueuse/core')['resolveRef']
96
+ const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
97
+ const setActivePinia: typeof import('pinia')['setActivePinia']
98
+ const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
99
+ const shallowReactive: typeof import('vue')['shallowReactive']
100
+ const shallowReadonly: typeof import('vue')['shallowReadonly']
101
+ const shallowRef: typeof import('vue')['shallowRef']
102
+ const storeToRefs: typeof import('pinia')['storeToRefs']
103
+ const syncRef: typeof import('@vueuse/core')['syncRef']
104
+ const syncRefs: typeof import('@vueuse/core')['syncRefs']
105
+ const templateRef: typeof import('@vueuse/core')['templateRef']
106
+ const throttledRef: typeof import('@vueuse/core')['throttledRef']
107
+ const throttledWatch: typeof import('@vueuse/core')['throttledWatch']
108
+ const toRaw: typeof import('vue')['toRaw']
109
+ const toReactive: typeof import('@vueuse/core')['toReactive']
110
+ const toRef: typeof import('vue')['toRef']
111
+ const toRefs: typeof import('vue')['toRefs']
112
+ const toValue: typeof import('vue')['toValue']
113
+ const triggerRef: typeof import('vue')['triggerRef']
114
+ const tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount']
115
+ const tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount']
116
+ const tryOnMounted: typeof import('@vueuse/core')['tryOnMounted']
117
+ const tryOnScopeDispose: typeof import('@vueuse/core')['tryOnScopeDispose']
118
+ const tryOnUnmounted: typeof import('@vueuse/core')['tryOnUnmounted']
119
+ const unref: typeof import('vue')['unref']
120
+ const unrefElement: typeof import('@vueuse/core')['unrefElement']
121
+ const until: typeof import('@vueuse/core')['until']
122
+ const useActiveElement: typeof import('@vueuse/core')['useActiveElement']
123
+ const useAnimate: typeof import('@vueuse/core')['useAnimate']
124
+ const useArrayDifference: typeof import('@vueuse/core')['useArrayDifference']
125
+ const useArrayEvery: typeof import('@vueuse/core')['useArrayEvery']
126
+ const useArrayFilter: typeof import('@vueuse/core')['useArrayFilter']
127
+ const useArrayFind: typeof import('@vueuse/core')['useArrayFind']
128
+ const useArrayFindIndex: typeof import('@vueuse/core')['useArrayFindIndex']
129
+ const useArrayFindLast: typeof import('@vueuse/core')['useArrayFindLast']
130
+ const useArrayIncludes: typeof import('@vueuse/core')['useArrayIncludes']
131
+ const useArrayJoin: typeof import('@vueuse/core')['useArrayJoin']
132
+ const useArrayMap: typeof import('@vueuse/core')['useArrayMap']
133
+ const useArrayReduce: typeof import('@vueuse/core')['useArrayReduce']
134
+ const useArraySome: typeof import('@vueuse/core')['useArraySome']
135
+ const useArrayUnique: typeof import('@vueuse/core')['useArrayUnique']
136
+ const useAsyncQueue: typeof import('@vueuse/core')['useAsyncQueue']
137
+ const useAsyncState: typeof import('@vueuse/core')['useAsyncState']
138
+ const useAttrs: typeof import('vue')['useAttrs']
139
+ const useBase64: typeof import('@vueuse/core')['useBase64']
140
+ const useBattery: typeof import('@vueuse/core')['useBattery']
141
+ const useBluetooth: typeof import('@vueuse/core')['useBluetooth']
142
+ const useBreakpoints: typeof import('@vueuse/core')['useBreakpoints']
143
+ const useBroadcastChannel: typeof import('@vueuse/core')['useBroadcastChannel']
144
+ const useBrowserLocation: typeof import('@vueuse/core')['useBrowserLocation']
145
+ const useCached: typeof import('@vueuse/core')['useCached']
146
+ const useClipboard: typeof import('@vueuse/core')['useClipboard']
147
+ const useClipboardItems: typeof import('@vueuse/core')['useClipboardItems']
148
+ const useCloned: typeof import('@vueuse/core')['useCloned']
149
+ const useColorMode: typeof import('@vueuse/core')['useColorMode']
150
+ const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
151
+ const useCounter: typeof import('@vueuse/core')['useCounter']
152
+ const useCssModule: typeof import('vue')['useCssModule']
153
+ const useCssVar: typeof import('@vueuse/core')['useCssVar']
154
+ const useCssVars: typeof import('vue')['useCssVars']
155
+ const useCurrentElement: typeof import('@vueuse/core')['useCurrentElement']
156
+ const useCycleList: typeof import('@vueuse/core')['useCycleList']
157
+ const useDark: typeof import('@vueuse/core')['useDark']
158
+ const useDateFormat: typeof import('@vueuse/core')['useDateFormat']
159
+ const useDebounce: typeof import('@vueuse/core')['useDebounce']
160
+ const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']
161
+ const useDebouncedRefHistory: typeof import('@vueuse/core')['useDebouncedRefHistory']
162
+ const useDeviceMotion: typeof import('@vueuse/core')['useDeviceMotion']
163
+ const useDeviceOrientation: typeof import('@vueuse/core')['useDeviceOrientation']
164
+ const useDevicePixelRatio: typeof import('@vueuse/core')['useDevicePixelRatio']
165
+ const useDevicesList: typeof import('@vueuse/core')['useDevicesList']
166
+ const useDisplayMedia: typeof import('@vueuse/core')['useDisplayMedia']
167
+ const useDocumentVisibility: typeof import('@vueuse/core')['useDocumentVisibility']
168
+ const useDraggable: typeof import('@vueuse/core')['useDraggable']
169
+ const useDropZone: typeof import('@vueuse/core')['useDropZone']
170
+ const useElementBounding: typeof import('@vueuse/core')['useElementBounding']
171
+ const useElementByPoint: typeof import('@vueuse/core')['useElementByPoint']
172
+ const useElementHover: typeof import('@vueuse/core')['useElementHover']
173
+ const useElementSize: typeof import('@vueuse/core')['useElementSize']
174
+ const useElementVisibility: typeof import('@vueuse/core')['useElementVisibility']
175
+ const useEventBus: typeof import('@vueuse/core')['useEventBus']
176
+ const useEventListener: typeof import('@vueuse/core')['useEventListener']
177
+ const useEventSource: typeof import('@vueuse/core')['useEventSource']
178
+ const useEyeDropper: typeof import('@vueuse/core')['useEyeDropper']
179
+ const useFavicon: typeof import('@vueuse/core')['useFavicon']
180
+ const useFetch: typeof import('@vueuse/core')['useFetch']
181
+ const useFileDialog: typeof import('@vueuse/core')['useFileDialog']
182
+ const useFileSystemAccess: typeof import('@vueuse/core')['useFileSystemAccess']
183
+ const useFocus: typeof import('@vueuse/core')['useFocus']
184
+ const useFocusWithin: typeof import('@vueuse/core')['useFocusWithin']
185
+ const useFps: typeof import('@vueuse/core')['useFps']
186
+ const useFullscreen: typeof import('@vueuse/core')['useFullscreen']
187
+ const useGamepad: typeof import('@vueuse/core')['useGamepad']
188
+ const useGeolocation: typeof import('@vueuse/core')['useGeolocation']
189
+ const useIdle: typeof import('@vueuse/core')['useIdle']
190
+ const useImage: typeof import('@vueuse/core')['useImage']
191
+ const useInfiniteScroll: typeof import('@vueuse/core')['useInfiniteScroll']
192
+ const useIntersectionObserver: typeof import('@vueuse/core')['useIntersectionObserver']
193
+ const useInterval: typeof import('@vueuse/core')['useInterval']
194
+ const useIntervalFn: typeof import('@vueuse/core')['useIntervalFn']
195
+ const useKeyModifier: typeof import('@vueuse/core')['useKeyModifier']
196
+ const useLastChanged: typeof import('@vueuse/core')['useLastChanged']
197
+ const useLink: typeof import('vue-router')['useLink']
198
+ const useLocalStorage: typeof import('@vueuse/core')['useLocalStorage']
199
+ const useMagicKeys: typeof import('@vueuse/core')['useMagicKeys']
200
+ const useManualRefHistory: typeof import('@vueuse/core')['useManualRefHistory']
201
+ const useMediaControls: typeof import('@vueuse/core')['useMediaControls']
202
+ const useMediaQuery: typeof import('@vueuse/core')['useMediaQuery']
203
+ const useMemoize: typeof import('@vueuse/core')['useMemoize']
204
+ const useMemory: typeof import('@vueuse/core')['useMemory']
205
+ const useMounted: typeof import('@vueuse/core')['useMounted']
206
+ const useMouse: typeof import('@vueuse/core')['useMouse']
207
+ const useMouseInElement: typeof import('@vueuse/core')['useMouseInElement']
208
+ const useMousePressed: typeof import('@vueuse/core')['useMousePressed']
209
+ const useMutationObserver: typeof import('@vueuse/core')['useMutationObserver']
210
+ const useNavigatorLanguage: typeof import('@vueuse/core')['useNavigatorLanguage']
211
+ const useNetwork: typeof import('@vueuse/core')['useNetwork']
212
+ const useNow: typeof import('@vueuse/core')['useNow']
213
+ const useObjectUrl: typeof import('@vueuse/core')['useObjectUrl']
214
+ const useOffsetPagination: typeof import('@vueuse/core')['useOffsetPagination']
215
+ const useOnline: typeof import('@vueuse/core')['useOnline']
216
+ const usePageLeave: typeof import('@vueuse/core')['usePageLeave']
217
+ const useParallax: typeof import('@vueuse/core')['useParallax']
218
+ const useParentElement: typeof import('@vueuse/core')['useParentElement']
219
+ const usePerformanceObserver: typeof import('@vueuse/core')['usePerformanceObserver']
220
+ const usePermission: typeof import('@vueuse/core')['usePermission']
221
+ const usePointer: typeof import('@vueuse/core')['usePointer']
222
+ const usePointerLock: typeof import('@vueuse/core')['usePointerLock']
223
+ const usePointerSwipe: typeof import('@vueuse/core')['usePointerSwipe']
224
+ const usePreferredColorScheme: typeof import('@vueuse/core')['usePreferredColorScheme']
225
+ const usePreferredContrast: typeof import('@vueuse/core')['usePreferredContrast']
226
+ const usePreferredDark: typeof import('@vueuse/core')['usePreferredDark']
227
+ const usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages']
228
+ const usePreferredReducedMotion: typeof import('@vueuse/core')['usePreferredReducedMotion']
229
+ const usePrevious: typeof import('@vueuse/core')['usePrevious']
230
+ const useRafFn: typeof import('@vueuse/core')['useRafFn']
231
+ const useRefHistory: typeof import('@vueuse/core')['useRefHistory']
232
+ const useResizeObserver: typeof import('@vueuse/core')['useResizeObserver']
233
+ const useRoute: typeof import('vue-router')['useRoute']
234
+ const useRouter: typeof import('vue-router')['useRouter']
235
+ const useScreenOrientation: typeof import('@vueuse/core')['useScreenOrientation']
236
+ const useScreenSafeArea: typeof import('@vueuse/core')['useScreenSafeArea']
237
+ const useScriptTag: typeof import('@vueuse/core')['useScriptTag']
238
+ const useScroll: typeof import('@vueuse/core')['useScroll']
239
+ const useScrollLock: typeof import('@vueuse/core')['useScrollLock']
240
+ const useSessionStorage: typeof import('@vueuse/core')['useSessionStorage']
241
+ const useShare: typeof import('@vueuse/core')['useShare']
242
+ const useSlots: typeof import('vue')['useSlots']
243
+ const useSorted: typeof import('@vueuse/core')['useSorted']
244
+ const useSpeechRecognition: typeof import('@vueuse/core')['useSpeechRecognition']
245
+ const useSpeechSynthesis: typeof import('@vueuse/core')['useSpeechSynthesis']
246
+ const useStepper: typeof import('@vueuse/core')['useStepper']
247
+ const useStorage: typeof import('@vueuse/core')['useStorage']
248
+ const useStorageAsync: typeof import('@vueuse/core')['useStorageAsync']
249
+ const useStyleTag: typeof import('@vueuse/core')['useStyleTag']
250
+ const useSupported: typeof import('@vueuse/core')['useSupported']
251
+ const useSwipe: typeof import('@vueuse/core')['useSwipe']
252
+ const useTemplateRefsList: typeof import('@vueuse/core')['useTemplateRefsList']
253
+ const useTextDirection: typeof import('@vueuse/core')['useTextDirection']
254
+ const useTextSelection: typeof import('@vueuse/core')['useTextSelection']
255
+ const useTextareaAutosize: typeof import('@vueuse/core')['useTextareaAutosize']
256
+ const useThrottle: typeof import('@vueuse/core')['useThrottle']
257
+ const useThrottleFn: typeof import('@vueuse/core')['useThrottleFn']
258
+ const useThrottledRefHistory: typeof import('@vueuse/core')['useThrottledRefHistory']
259
+ const useTimeAgo: typeof import('@vueuse/core')['useTimeAgo']
260
+ const useTimeout: typeof import('@vueuse/core')['useTimeout']
261
+ const useTimeoutFn: typeof import('@vueuse/core')['useTimeoutFn']
262
+ const useTimeoutPoll: typeof import('@vueuse/core')['useTimeoutPoll']
263
+ const useTimestamp: typeof import('@vueuse/core')['useTimestamp']
264
+ const useTitle: typeof import('@vueuse/core')['useTitle']
265
+ const useToNumber: typeof import('@vueuse/core')['useToNumber']
266
+ const useToString: typeof import('@vueuse/core')['useToString']
267
+ const useToggle: typeof import('@vueuse/core')['useToggle']
268
+ const useTransition: typeof import('@vueuse/core')['useTransition']
269
+ const useUrlSearchParams: typeof import('@vueuse/core')['useUrlSearchParams']
270
+ const useUserMedia: typeof import('@vueuse/core')['useUserMedia']
271
+ const useVModel: typeof import('@vueuse/core')['useVModel']
272
+ const useVModels: typeof import('@vueuse/core')['useVModels']
273
+ const useVibrate: typeof import('@vueuse/core')['useVibrate']
274
+ const useVirtualList: typeof import('@vueuse/core')['useVirtualList']
275
+ const useWakeLock: typeof import('@vueuse/core')['useWakeLock']
276
+ const useWebNotification: typeof import('@vueuse/core')['useWebNotification']
277
+ const useWebSocket: typeof import('@vueuse/core')['useWebSocket']
278
+ const useWebWorker: typeof import('@vueuse/core')['useWebWorker']
279
+ const useWebWorkerFn: typeof import('@vueuse/core')['useWebWorkerFn']
280
+ const useWindowFocus: typeof import('@vueuse/core')['useWindowFocus']
281
+ const useWindowScroll: typeof import('@vueuse/core')['useWindowScroll']
282
+ const useWindowSize: typeof import('@vueuse/core')['useWindowSize']
283
+ const watch: typeof import('vue')['watch']
284
+ const watchArray: typeof import('@vueuse/core')['watchArray']
285
+ const watchAtMost: typeof import('@vueuse/core')['watchAtMost']
286
+ const watchDebounced: typeof import('@vueuse/core')['watchDebounced']
287
+ const watchDeep: typeof import('@vueuse/core')['watchDeep']
288
+ const watchEffect: typeof import('vue')['watchEffect']
289
+ const watchIgnorable: typeof import('@vueuse/core')['watchIgnorable']
290
+ const watchImmediate: typeof import('@vueuse/core')['watchImmediate']
291
+ const watchOnce: typeof import('@vueuse/core')['watchOnce']
292
+ const watchPausable: typeof import('@vueuse/core')['watchPausable']
293
+ const watchPostEffect: typeof import('vue')['watchPostEffect']
294
+ const watchSyncEffect: typeof import('vue')['watchSyncEffect']
295
+ const watchThrottled: typeof import('@vueuse/core')['watchThrottled']
296
+ const watchTriggerable: typeof import('@vueuse/core')['watchTriggerable']
297
+ const watchWithFilter: typeof import('@vueuse/core')['watchWithFilter']
298
+ const whenever: typeof import('@vueuse/core')['whenever']
299
+ }
300
+ // for type re-export
301
+ declare global {
302
+ // @ts-ignore
303
+ export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
304
+ import('vue')
305
+ }
@@ -0,0 +1,166 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2024-07-31 09:14:09
4
+ * @LastEditTime: 2024-09-03 16:51:44
5
+ * @Description:
6
+ * @LastEditors: zhangyang
7
+ * Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
8
+ -->
9
+ <script lang="ts" setup>
10
+ import { type Node, initMarkdownItParser } from 'mdbox/parser'
11
+ import { compare } from 'compare-versions'
12
+ import { marked } from 'marked'
13
+ import DOMPurify from 'dompurify'
14
+
15
+ type Status = 'confirm' | 'processing' | 'success' | 'error'
16
+
17
+ interface UpdateItem {
18
+ title: string
19
+ content: string
20
+ raw: string
21
+ }
22
+
23
+ const progress = ref(0)
24
+ const visible = ref(false)
25
+ const status = ref<Status>('confirm')
26
+
27
+ const jumpVersion = useLocalStorage<Record<string, boolean>>('jumpVersion', {})
28
+ const nextVersion = ref('')
29
+
30
+ const title = ref('')
31
+ const content = ref('')
32
+
33
+ const autoCheck = ref(false)
34
+
35
+ onMounted(() => {
36
+ // 检查更新
37
+ window.ipcRenderer.send('check-update')
38
+ autoCheck.value = true
39
+ console.log('check')
40
+
41
+ // 有更新可用
42
+ window.ipcRenderer.on('update-available', async (_event, info: any) => {
43
+ console.log('🚀 ~ window.ipcRenderer.on ~ info:', info)
44
+ nextVersion.value = info.version
45
+
46
+ if (jumpVersion.value[info.version])
47
+ return
48
+
49
+ // 获取更新日志
50
+ const changelog: string = info?.releaseNotes ?? ''
51
+ const parser = await initMarkdownItParser()
52
+ const updateRecord: UpdateItem[] = []
53
+
54
+ changelog.split('------').forEach((item) => {
55
+ item = item.trim()
56
+ if (item) {
57
+ const { tree } = parser.parse(item)
58
+ updateRecord.push({
59
+ title: (tree[0] as Node).children!.toString(),
60
+ content: item.replace(/[^\n]+\n/, ''),
61
+ raw: item,
62
+ })
63
+ }
64
+ })
65
+
66
+ console.log('🚀 ~ parsed ~ changelog:', updateRecord)
67
+ const note = updateRecord.find(item => compare(item.title, info.version, '='))
68
+ console.log('🚀 ~ window.ipcRenderer.on ~ note:', note)
69
+ if (note) {
70
+ title.value = `${note.title} (${new Date(info.releaseDate).toLocaleDateString()})`
71
+ const purify = DOMPurify(window)
72
+ // eslint-disable-next-line no-misleading-character-class
73
+ content.value = await marked.parse(purify.sanitize(note.content.replace(/^[\u200B\u200C\u200D\u200E\u200F\uFEFF]/, '')))
74
+ }
75
+
76
+ // 有更新
77
+ status.value = 'confirm'
78
+ visible.value = true
79
+ })
80
+ // 下载更新进度
81
+ window.ipcRenderer.on('download-progress', (_event: any, msg: any) => {
82
+ status.value = 'processing'
83
+ progress.value = Math.ceil(msg.percent)
84
+ })
85
+ // 更新下载完成
86
+ window.ipcRenderer.on('update-downloaded', () => {
87
+ progress.value = 0
88
+ visible.value = false
89
+ console.log('下载完成')
90
+ })
91
+ // 更新失败
92
+ window.ipcRenderer.on('update-error', () => {
93
+ status.value = 'error'
94
+ progress.value = 0
95
+ setTimeout(() => {
96
+ visible.value = false
97
+ }, 1000)
98
+ })
99
+
100
+ // 没有更新
101
+ window.ipcRenderer.on('update-not-available', () => {
102
+ if (autoCheck.value)
103
+ autoCheck.value = false
104
+ else
105
+ ElMessage.success('当前已是最新版本')
106
+ })
107
+ })
108
+ // 确定更新
109
+ function SureUpdate() {
110
+ window.ipcRenderer.send('update-app')
111
+ status.value = 'processing'
112
+ }
113
+ // 取消更新
114
+ function CancelUpdate() {
115
+ jumpVersion.value[nextVersion.value] = true
116
+
117
+ visible.value = false
118
+ }
119
+ </script>
120
+
121
+ <template>
122
+ <div class="update-page">
123
+ <ElDialog
124
+ v-model="visible" width="30%" :close-on-press-escape="false" :show-close="false" :center="true"
125
+ :close-on-click-modal="false"
126
+ title-class="text-2xl"
127
+ >
128
+ <template #header>
129
+ <div class="my-header" style="margin-top: -5px">
130
+ <span class="text-xl font-bold">更新提醒</span>
131
+ </div>
132
+ </template>
133
+ <div v-if="status === 'confirm'" class="confirm">
134
+ <div v-if="title">
135
+ <h1 class="text-xl font-bold mb-4">
136
+ {{ title }}
137
+ </h1>
138
+ <article>
139
+ <Suspense>
140
+ <div v-html="content" />
141
+ <template #fallback>
142
+ <ElSkeleton />
143
+ </template>
144
+ </Suspense>
145
+ </article>
146
+ </div>
147
+
148
+ <p v-else>
149
+ 检测到新版本,是否更新?
150
+ </p>
151
+ </div>
152
+ <div v-if="status === 'processing'" class="processing">
153
+ <el-progress :text-inside="true" :stroke-width="26" :percentage="progress" />
154
+ </div>
155
+ <div v-if="status === 'error'" class="error">
156
+ 更新失败!
157
+ </div>
158
+ <template #footer>
159
+ <span v-if="status === 'confirm'">
160
+ <el-button text class="!text-gray-400" @click="CancelUpdate">跳过此版本</el-button>
161
+ <el-button type="primary" @click="SureUpdate">立即更新</el-button>
162
+ </span>
163
+ </template>
164
+ </ElDialog>
165
+ </div>
166
+ </template>
@@ -0,0 +1,18 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // Generated by unplugin-vue-components
5
+ // Read more: https://github.com/vuejs/core/pull/3399
6
+ export {}
7
+
8
+ declare module 'vue' {
9
+ export interface GlobalComponents {
10
+ ElButton: typeof import('element-plus/es')['ElButton']
11
+ ElDialog: typeof import('element-plus/es')['ElDialog']
12
+ ElProgress: typeof import('element-plus/es')['ElProgress']
13
+ ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
14
+ RouterLink: typeof import('vue-router')['RouterLink']
15
+ RouterView: typeof import('vue-router')['RouterView']
16
+ UpdateDialog: typeof import('./components/UpdateDialog.vue')['default']
17
+ }
18
+ }
@@ -0,0 +1,11 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2024-07-31 19:50:04
4
+ * @LastEditTime: 2024-07-31 19:50:04
5
+ * @Description:
6
+ * @LastEditors: zhangyang
7
+ * Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
8
+ -->
9
+ <template>
10
+ <router-view />
11
+ </template>
@@ -0,0 +1,13 @@
1
+ <!--
2
+ * @Author: zhangyang
3
+ * @Date: 2024-07-31 16:48:09
4
+ * @LastEditTime: 2024-07-31 16:48:09
5
+ * @Description:
6
+ * @LastEditors: zhangyang
7
+ * Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
8
+ -->
9
+ <template>
10
+ <div class="default-layout">
11
+ <router-view />
12
+ </div>
13
+ </template>
@@ -0,0 +1,36 @@
1
+ /*
2
+ * @Author: zhangyang
3
+ * @Date: 2024-07-31 09:14:09
4
+ * @LastEditTime: 2024-09-03 15:34:31
5
+ * @Description:
6
+ * @LastEditors: zhangyang
7
+ * Copyright (c) 2024 to current by BluesYoung-web, All Rights Reserved.
8
+ */
9
+ import { createApp } from 'vue'
10
+ // 样式
11
+ import '@unocss/reset/tailwind-compat.css'
12
+ import 'uno.css'
13
+ import App from './App.vue'
14
+ // import 'element-plus/theme-chalk/el-message.css'
15
+
16
+ const app = createApp(App)
17
+
18
+ Object.values(
19
+ // 模块按数字命名,确保安装的顺序
20
+ import.meta.glob<{ install: UserModule }>('./modules/*.ts', { eager: true }),
21
+ ).map(({ install }) => install(app))
22
+
23
+ app.mount('#app').$nextTick(async () => {
24
+ // Use contextBridge
25
+ window.ipcRenderer.on('main-process-message', (_event, message) => {
26
+ console.log(message)
27
+ })
28
+
29
+ // set Store
30
+ // window.ipcRenderer.send('setStore', 'foo', 'bar')
31
+ // window.ipcRenderer.send('setStore', 'foo2.other', 'bar2')
32
+
33
+ // get Store
34
+ const res = await window.ipcRenderer.invoke('getStore')
35
+ console.log('🚀 ~ app.mount ~ res:', res)
36
+ })