From be7a8ac3eafcef5944b53fa5355f9023575ec615 Mon Sep 17 00:00:00 2001 From: leejooy96 Date: Sat, 29 Oct 2022 12:35:12 +0900 Subject: [PATCH] pack: add .editorconfig and use tab instead of space --- .editorconfig | 11 + .eslintrc.json | 58 +++--- docs/.vitepress/config.mjs | 24 +-- docs/build-configuration.md | 42 ++-- electron-builder.json5 | 188 +++++++++--------- package.json | 118 +++++------ prettier.config.js | 36 ++-- src/main/MainRunner.ts | 134 ++++++------- src/main/index.ts | 30 +-- src/main/utils/Constants.ts | 22 +- src/main/utils/Menus.ts | 12 +- src/renderer/App.vue | 14 +- .../components/layout/DefaultLayout.vue | 16 +- .../components/layout/HeaderLayout.vue | 6 +- src/renderer/index.html | 14 +- src/renderer/locales/en.json | 16 +- src/renderer/locales/ko.json | 16 +- src/renderer/plugins/i18n.ts | 16 +- src/renderer/plugins/vuetify.ts | 56 +++--- src/renderer/router/index.ts | 42 ++-- src/renderer/screens/ErrorScreen.vue | 2 +- src/renderer/screens/MainScreen.vue | 74 +++---- src/renderer/store/temp.ts | 22 +- src/renderer/utils/index.ts | 12 +- tsconfig.json | 52 ++--- tsconfig.node.json | 20 +- vite.config.js | 78 ++++---- 27 files changed, 571 insertions(+), 560 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6d0e97b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# http://editorconfig.org +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = tab +indent_size = 2 +insert_final_newline = true +max_line_length = 80 +trim_trailing_whitespace = true diff --git a/.eslintrc.json b/.eslintrc.json index 7a4d27c..507c67b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,31 +1,31 @@ { - "root": true, - "parser": "vue-eslint-parser", - "parserOptions": { - "parser": "@typescript-eslint/parser", - "sourceType": "module", - "ecmaVersion": 2022, - "ecmaFeatures": { - "jsx": true - } - }, - "env": { - "node": true, - "es6": true - }, - "extends": ["standard", "plugin:vue/vue3-recommended", "prettier"], - "globals": { - "__static": true - }, - "plugins": ["vue"], - "rules": { - "arrow-parens": 0, - "generator-star-spacing": 0, - "no-case-declarations": 0, - "array-callback-return": 0, - "no-trailing-spaces": 1, - "no-control-regex": 0, - "no-useless-constructor": 0, - "node/no-deprecated-api": 0 - } + "root": true, + "parser": "vue-eslint-parser", + "parserOptions": { + "parser": "@typescript-eslint/parser", + "sourceType": "module", + "ecmaVersion": 2022, + "ecmaFeatures": { + "jsx": true + } + }, + "env": { + "node": true, + "es6": true + }, + "extends": ["standard", "plugin:vue/vue3-recommended", "prettier"], + "globals": { + "__static": true + }, + "plugins": ["vue"], + "rules": { + "arrow-parens": 0, + "generator-star-spacing": 0, + "no-case-declarations": 0, + "array-callback-return": 0, + "no-trailing-spaces": 1, + "no-control-regex": 0, + "no-useless-constructor": 0, + "node/no-deprecated-api": 0 + } } diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index b4c8e6f..cab5dc4 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -1,16 +1,16 @@ import { generateSidebar } from 'vitepress-sidebar' export default { - title: 'Vutron', - description: 'Quick Start Templates for Vite + Vue 3 + Electron', - themeConfig: { - sidebar: generateSidebar({ - root: 'docs', - collapsible: false, - collapsed: false, - underscoreToSpace: true, - hyphenToSpace: true - }), - socialLinks: [{ icon: 'github', link: 'https://github.com/jooy2/vutron' }] - } + title: 'Vutron', + description: 'Quick Start Templates for Vite + Vue 3 + Electron', + themeConfig: { + sidebar: generateSidebar({ + root: 'docs', + collapsible: false, + collapsed: false, + underscoreToSpace: true, + hyphenToSpace: true + }), + socialLinks: [{ icon: 'github', link: 'https://github.com/jooy2/vutron' }] + } } diff --git a/docs/build-configuration.md b/docs/build-configuration.md index 1ce8f19..b51c019 100644 --- a/docs/build-configuration.md +++ b/docs/build-configuration.md @@ -21,9 +21,9 @@ For projects that use the **Native Node Module**, add the following script to yo ```json { - "scripts": { - "postinstall": "electron-builder install-app-deps" - } + "scripts": { + "postinstall": "electron-builder install-app-deps" + } } ``` @@ -49,23 +49,23 @@ Below is an unnecessary `node_modules` file pattern that can further save bundle ```json [ - "!**/.*", - "!**/node_modules/**/{CONTRIBUTORS,CNAME,AUTHOR,TODO,CONTRIBUTING,COPYING,INSTALL,NEWS,PORTING,Makefile,htdocs,CHANGELOG,ChangeLog,changelog,README,Readme,readme,test,sample,example,demo,composer.json,tsconfig.json,jsdoc.json,tslint.json,typings.json,gulpfile,bower.json,package-lock,Gruntfile,CMakeLists,karma.conf,yarn.lock}*", - "!**/node_modules/**/{man,benchmark,node_modules,spec,cmake,browser,vagrant,doxy*,bin,obj,obj.target,example,examples,test,tests,doc,docs,msvc,Xcode,CVS,RCS,SCCS}{,/**/*}", - "!**/node_modules/**/*.{conf,png,pc,coffee,txt,spec.js,ts,js.flow,html,def,jst,xml,ico,in,ac,sln,dsp,dsw,cmd,vcproj,vcxproj,vcxproj.filters,pdb,exp,obj,lib,map,md,sh,gypi,gyp,h,cpp,yml,log,tlog,Makefile,mk,c,cc,rc,xcodeproj,xcconfig,d.ts,yaml,hpp}", - "!**/node_modules/**/node-v*-x64{,/**/*}", - "!**/node_modules/bluebird/js/browser{,/**/*}", - "!**/node_modules/bluebird/js/browser{,/**/*}", - "!**/node_modules/source-map/dist{,/**/*}", - "!**/node_modules/lodash/fp{,/**/*}", - "!**/node_modules/async/!(dist|package.json)", - "!**/node_modules/async/internal{,/**/*}", - "!**/node_modules/ajv/dist{,/**/*}", - "!**/node_modules/ajv/scripts{,/**/*}", - "!**/node_modules/node-pre-gyp/!(lib|package.json)", - "!**/node_modules/node-pre-gyp/lib/!(util|pre-binding.js|node-pre-gyp.js)", - "!**/node_modules/node-pre-gyp/lib/util/!(versioning.js|abi_crosswalk.json)", - "!**/node_modules/source-map-support/browser-source-map-support.js", - "!**/node_modules/json-schema/!(package.json|lib)" + "!**/.*", + "!**/node_modules/**/{CONTRIBUTORS,CNAME,AUTHOR,TODO,CONTRIBUTING,COPYING,INSTALL,NEWS,PORTING,Makefile,htdocs,CHANGELOG,ChangeLog,changelog,README,Readme,readme,test,sample,example,demo,composer.json,tsconfig.json,jsdoc.json,tslint.json,typings.json,gulpfile,bower.json,package-lock,Gruntfile,CMakeLists,karma.conf,yarn.lock}*", + "!**/node_modules/**/{man,benchmark,node_modules,spec,cmake,browser,vagrant,doxy*,bin,obj,obj.target,example,examples,test,tests,doc,docs,msvc,Xcode,CVS,RCS,SCCS}{,/**/*}", + "!**/node_modules/**/*.{conf,png,pc,coffee,txt,spec.js,ts,js.flow,html,def,jst,xml,ico,in,ac,sln,dsp,dsw,cmd,vcproj,vcxproj,vcxproj.filters,pdb,exp,obj,lib,map,md,sh,gypi,gyp,h,cpp,yml,log,tlog,Makefile,mk,c,cc,rc,xcodeproj,xcconfig,d.ts,yaml,hpp}", + "!**/node_modules/**/node-v*-x64{,/**/*}", + "!**/node_modules/bluebird/js/browser{,/**/*}", + "!**/node_modules/bluebird/js/browser{,/**/*}", + "!**/node_modules/source-map/dist{,/**/*}", + "!**/node_modules/lodash/fp{,/**/*}", + "!**/node_modules/async/!(dist|package.json)", + "!**/node_modules/async/internal{,/**/*}", + "!**/node_modules/ajv/dist{,/**/*}", + "!**/node_modules/ajv/scripts{,/**/*}", + "!**/node_modules/node-pre-gyp/!(lib|package.json)", + "!**/node_modules/node-pre-gyp/lib/!(util|pre-binding.js|node-pre-gyp.js)", + "!**/node_modules/node-pre-gyp/lib/util/!(versioning.js|abi_crosswalk.json)", + "!**/node_modules/source-map-support/browser-source-map-support.js", + "!**/node_modules/json-schema/!(package.json|lib)" ] ``` diff --git a/electron-builder.json5 b/electron-builder.json5 index 142446b..1494f9e 100644 --- a/electron-builder.json5 +++ b/electron-builder.json5 @@ -1,98 +1,98 @@ { - productName: 'Vutron', - appId: 'com.vutron.vutron', - asar: true, - extends: null, - compression: 'maximum', - copyright: 'ⓒ 2022 ${author}', - artifactName: '${productName} ${version}_${arch}.${ext}', - directories: { - buildResources: 'buildRes', - output: './dist/release/${version}' - }, - /* A list of files not to be included in the build. */ - files: [ - /* + productName: 'Vutron', + appId: 'com.vutron.vutron', + asar: true, + extends: null, + compression: 'maximum', + copyright: 'ⓒ 2022 ${author}', + artifactName: '${productName} ${version}_${arch}.${ext}', + directories: { + buildResources: 'buildRes', + output: './dist/release/${version}' + }, + /* A list of files not to be included in the build. */ + files: [ + /* (Required) The files and folders listed below should not be included in the build. */ - 'dist/**/*', - '!docs/**/*', - '!dist/release/**/*', - '!dist/main/index.ts' - ], - mac: { - bundleVersion: '1.0', - hardenedRuntime: true, - gatekeeperAssess: false, - icon: 'buildRes/icons/icon.icns', - type: 'distribution', - target: [ - { - target: 'dmg', - arch: ['x64', 'arm64', 'universal'] - } - ] - }, - dmg: { - contents: [ - { - x: 410, - y: 150, - type: 'link', - path: '/Applications' - }, - { - x: 130, - y: 150, - type: 'file' - } - ], - sign: false - }, - win: { - icon: 'buildRes/icons/icon.ico', - target: [ - { - target: 'appx', - arch: 'x64' - }, - { - target: 'zip', - arch: 'x64' - }, - { - target: 'portable', - arch: 'x64' - }, - { - target: 'nsis', - arch: 'x64' - } - ] - }, - portable: { - artifactName: '${productName} ${version}_${arch} Portable.${ext}' - }, - nsis: { - oneClick: true - }, - linux: { - executableName: 'vutron', - icon: 'buildRes/icons', - category: 'Utility', - target: [ - { - target: 'snap', - arch: 'x64' - }, - { - target: 'deb', - arch: 'x64' - }, - { - target: 'rpm', - arch: 'x64' - } - ] - } + 'dist/**/*', + '!docs/**/*', + '!dist/release/**/*', + '!dist/main/index.ts' + ], + mac: { + bundleVersion: '1.0', + hardenedRuntime: true, + gatekeeperAssess: false, + icon: 'buildRes/icons/icon.icns', + type: 'distribution', + target: [ + { + target: 'dmg', + arch: ['x64', 'arm64', 'universal'] + } + ] + }, + dmg: { + contents: [ + { + x: 410, + y: 150, + type: 'link', + path: '/Applications' + }, + { + x: 130, + y: 150, + type: 'file' + } + ], + sign: false + }, + win: { + icon: 'buildRes/icons/icon.ico', + target: [ + { + target: 'appx', + arch: 'x64' + }, + { + target: 'zip', + arch: 'x64' + }, + { + target: 'portable', + arch: 'x64' + }, + { + target: 'nsis', + arch: 'x64' + } + ] + }, + portable: { + artifactName: '${productName} ${version}_${arch} Portable.${ext}' + }, + nsis: { + oneClick: true + }, + linux: { + executableName: 'vutron', + icon: 'buildRes/icons', + category: 'Utility', + target: [ + { + target: 'snap', + arch: 'x64' + }, + { + target: 'deb', + arch: 'x64' + }, + { + target: 'rpm', + arch: 'x64' + } + ] + } } diff --git a/package.json b/package.json index 51794bf..51d1189 100644 --- a/package.json +++ b/package.json @@ -1,61 +1,61 @@ { - "name": "vutron", - "version": "1.0.0", - "description": "Quick Start Templates for Vite + Vue 3 + Electron", - "homepage": "https://github.com/jooy2/vutron", - "author": "jooy2 ", - "license": "MIT", - "main": "dist/main/index.js", - "scripts": { - "dev": "cross-env NODE_ENV=development vite", - "build": "npm run build:pre && electron-builder -wml", - "build:pre": "npm run format:fix && vue-tsc --noEmit && cross-env NODE_ENV=production vite build", - "build:dir": "npm run build:pre && electron-builder --dir", - "build:mac": "npm run build:pre && CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --mac", - "build:linux": "npm run build:pre && electron-builder --linux", - "build:win": "npm run build:pre && electron-builder --windows", - "lint": "eslint --ext .js,.ts,.vue -f ./node_modules/eslint-friendly-formatter src", - "lint:fix": "eslint --ext .js,.ts,.vue -f ./node_modules/eslint-friendly-formatter --fix src", - "format": "prettier .", - "format:fix": "prettier . --write", - "docs:install": "npm i --no-save vitepress vitepress-sidebar", - "docs:dev": "vitepress dev docs", - "docs:build": "npm run format:fix && vitepress build docs", - "docs:serve": "npm run docs:build && vitepress serve docs" - }, - "engines": { - "node": ">=16.0.0" - }, - "dependencies": { - "@electron/remote": "^2.0.8", - "pinia": "^2.0.22", - "vue": "^3.2.39", - "vue-i18n": "^9.2.2", - "vue-router": "^4.1.5", - "vuetify": "^3.0.0-beta.13" - }, - "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.40.1", - "@typescript-eslint/parser": "^5.40.1", - "@vitejs/plugin-vue": "^3.1.2", - "@vitejs/plugin-vue-jsx": "^2.0.1", - "cross-env": "^7.0.3", - "electron": "^21.2.0", - "electron-builder": "^23.3.3", - "eslint": "^8.26.0", - "eslint-config-prettier": "^8.5.0", - "eslint-config-standard": "^17.0.0", - "eslint-friendly-formatter": "^4.0.1", - "eslint-plugin-import": "^2.26.0", - "eslint-plugin-n": "^15.3.0", - "eslint-plugin-promise": "^6.1.1", - "eslint-plugin-vue": "^9.5.1", - "prettier": "^2.7.1", - "typescript": "^4.8.4", - "vite": "^3.1.4", - "vite-plugin-electron": "^0.9.3", - "vite-plugin-eslint": "^1.8.1", - "vue-eslint-parser": "^9.1.0", - "vue-tsc": "^1.0.9" - } + "name": "vutron", + "version": "1.0.0", + "description": "Quick Start Templates for Vite + Vue 3 + Electron", + "homepage": "https://github.com/jooy2/vutron", + "author": "jooy2 ", + "license": "MIT", + "main": "dist/main/index.js", + "scripts": { + "dev": "cross-env NODE_ENV=development vite", + "build": "npm run build:pre && electron-builder -wml", + "build:pre": "npm run format:fix && vue-tsc --noEmit && cross-env NODE_ENV=production vite build", + "build:dir": "npm run build:pre && electron-builder --dir", + "build:mac": "npm run build:pre && CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --mac", + "build:linux": "npm run build:pre && electron-builder --linux", + "build:win": "npm run build:pre && electron-builder --windows", + "lint": "eslint --ext .js,.ts,.vue -f ./node_modules/eslint-friendly-formatter src", + "lint:fix": "eslint --ext .js,.ts,.vue -f ./node_modules/eslint-friendly-formatter --fix src", + "format": "prettier .", + "format:fix": "prettier . --write", + "docs:install": "npm i --no-save vitepress vitepress-sidebar", + "docs:dev": "vitepress dev docs", + "docs:build": "npm run format:fix && vitepress build docs", + "docs:serve": "npm run docs:build && vitepress serve docs" + }, + "engines": { + "node": ">=16.0.0" + }, + "dependencies": { + "@electron/remote": "^2.0.8", + "pinia": "^2.0.22", + "vue": "^3.2.39", + "vue-i18n": "^9.2.2", + "vue-router": "^4.1.5", + "vuetify": "^3.0.0-beta.13" + }, + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.40.1", + "@typescript-eslint/parser": "^5.40.1", + "@vitejs/plugin-vue": "^3.1.2", + "@vitejs/plugin-vue-jsx": "^2.0.1", + "cross-env": "^7.0.3", + "electron": "^21.2.0", + "electron-builder": "^23.3.3", + "eslint": "^8.26.0", + "eslint-config-prettier": "^8.5.0", + "eslint-config-standard": "^17.0.0", + "eslint-friendly-formatter": "^4.0.1", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-n": "^15.3.0", + "eslint-plugin-promise": "^6.1.1", + "eslint-plugin-vue": "^9.5.1", + "prettier": "^2.7.1", + "typescript": "^4.8.4", + "vite": "^3.1.4", + "vite-plugin-electron": "^0.9.3", + "vite-plugin-eslint": "^1.8.1", + "vue-eslint-parser": "^9.1.0", + "vue-tsc": "^1.0.9" + } } diff --git a/prettier.config.js b/prettier.config.js index 040c108..e51242e 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -1,20 +1,20 @@ module.exports = { - printWidth: 100, - tabWidth: 2, - useTabs: false, - semi: false, - vueIndentScriptAndStyle: false, - singleQuote: true, - quoteProps: 'as-needed', - trailingComma: 'none', - bracketSpacing: true, - bracketSameLine: false, - jsxBracketSameLine: false, - jsxSingleQuote: false, - arrowParens: 'always', - insertPragma: false, - requirePragma: false, - proseWrap: 'never', - htmlWhitespaceSensitivity: 'strict', - endOfLine: 'lf' + printWidth: 100, + tabWidth: 2, + useTabs: true, + semi: false, + vueIndentScriptAndStyle: false, + singleQuote: true, + quoteProps: 'as-needed', + trailingComma: 'none', + bracketSpacing: true, + bracketSameLine: false, + jsxBracketSameLine: false, + jsxSingleQuote: false, + arrowParens: 'always', + insertPragma: false, + requirePragma: false, + proseWrap: 'never', + htmlWhitespaceSensitivity: 'strict', + endOfLine: 'lf' } diff --git a/src/main/MainRunner.ts b/src/main/MainRunner.ts index 985cbbb..045c7eb 100644 --- a/src/main/MainRunner.ts +++ b/src/main/MainRunner.ts @@ -3,91 +3,91 @@ import Constants from './utils/Constants' import * as electronRemote from '@electron/remote/main' const exitApp = (mainWindow: BrowserWindow): void => { - if (mainWindow && !mainWindow.isDestroyed()) { - mainWindow.hide() - } - mainWindow.destroy() - app.exit() + if (mainWindow && !mainWindow.isDestroyed()) { + mainWindow.hide() + } + mainWindow.destroy() + app.exit() } export const createMainWindow = async (mainWindow: BrowserWindow): Promise => { - mainWindow = new BrowserWindow({ - title: Constants.APP_NAME, - show: false, - width: Constants.IS_DEV_ENV ? 1500 : 1200, - height: 650, - useContentSize: true, - webPreferences: Constants.DEFAULT_WEB_PREFERENCES - }) + mainWindow = new BrowserWindow({ + title: Constants.APP_NAME, + show: false, + width: Constants.IS_DEV_ENV ? 1500 : 1200, + height: 650, + useContentSize: true, + webPreferences: Constants.DEFAULT_WEB_PREFERENCES + }) - mainWindow.setMenu(null) + mainWindow.setMenu(null) - mainWindow.on('close', (event: Event) => { - event.preventDefault() - exitApp(mainWindow) - }) + mainWindow.on('close', (event: Event) => { + event.preventDefault() + exitApp(mainWindow) + }) - mainWindow.webContents.on('did-frame-finish-load', () => { - if (Constants.IS_DEV_ENV) { - mainWindow.webContents.openDevTools() - } - }) + mainWindow.webContents.on('did-frame-finish-load', () => { + if (Constants.IS_DEV_ENV) { + mainWindow.webContents.openDevTools() + } + }) - mainWindow.once('ready-to-show', () => { - mainWindow.setAlwaysOnTop(true) - mainWindow.show() - mainWindow.focus() - mainWindow.setAlwaysOnTop(false) + mainWindow.once('ready-to-show', () => { + mainWindow.setAlwaysOnTop(true) + mainWindow.show() + mainWindow.focus() + mainWindow.setAlwaysOnTop(false) - electronRemote.initialize() - }) + electronRemote.initialize() + }) - if (Constants.IS_DEV_ENV) { - await mainWindow.loadURL(Constants.APP_INDEX_URL_DEV) - } else { - await mainWindow.loadFile(Constants.APP_INDEX_URL_PROD) - } + if (Constants.IS_DEV_ENV) { + await mainWindow.loadURL(Constants.APP_INDEX_URL_DEV) + } else { + await mainWindow.loadFile(Constants.APP_INDEX_URL_PROD) + } - return mainWindow + return mainWindow } export const createErrorWindow = async ( - errorWindow: BrowserWindow, - mainWindow: BrowserWindow, - details?: RenderProcessGoneDetails + errorWindow: BrowserWindow, + mainWindow: BrowserWindow, + details?: RenderProcessGoneDetails ): Promise => { - if (!Constants.IS_DEV_ENV) { - mainWindow?.hide() - } + if (!Constants.IS_DEV_ENV) { + mainWindow?.hide() + } - errorWindow = new BrowserWindow({ - title: Constants.APP_NAME, - show: false, - resizable: Constants.IS_DEV_ENV, - webPreferences: Constants.DEFAULT_WEB_PREFERENCES - }) + errorWindow = new BrowserWindow({ + title: Constants.APP_NAME, + show: false, + resizable: Constants.IS_DEV_ENV, + webPreferences: Constants.DEFAULT_WEB_PREFERENCES + }) - errorWindow.setMenu(null) + errorWindow.setMenu(null) - if (Constants.IS_DEV_ENV) { - await errorWindow.loadURL(`${Constants.APP_INDEX_URL_DEV}#/error`) - } else { - await errorWindow.loadFile(Constants.APP_INDEX_URL_PROD, { hash: 'error' }) - } + if (Constants.IS_DEV_ENV) { + await errorWindow.loadURL(`${Constants.APP_INDEX_URL_DEV}#/error`) + } else { + await errorWindow.loadFile(Constants.APP_INDEX_URL_PROD, { hash: 'error' }) + } - errorWindow.on('ready-to-show', () => { - if (!Constants.IS_DEV_ENV && mainWindow && !mainWindow.isDestroyed()) { - mainWindow.destroy() - } - errorWindow.show() - errorWindow.focus() - }) + errorWindow.on('ready-to-show', () => { + if (!Constants.IS_DEV_ENV && mainWindow && !mainWindow.isDestroyed()) { + mainWindow.destroy() + } + errorWindow.show() + errorWindow.focus() + }) - errorWindow.webContents.on('did-frame-finish-load', () => { - if (Constants.IS_DEV_ENV) { - errorWindow.webContents.openDevTools() - } - }) + errorWindow.webContents.on('did-frame-finish-load', () => { + if (Constants.IS_DEV_ENV) { + errorWindow.webContents.openDevTools() + } + }) - return errorWindow + return errorWindow } diff --git a/src/main/index.ts b/src/main/index.ts index 30e9f96..9067f2b 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -7,33 +7,33 @@ let mainWindow let errorWindow app.on('ready', () => { - macOSDisableDefaultMenuItem() + macOSDisableDefaultMenuItem() - mainWindow = createMainWindow(mainWindow) + mainWindow = createMainWindow(mainWindow) }) app.on('activate', () => { - if (!mainWindow) { - mainWindow = createMainWindow(mainWindow) - } + if (!mainWindow) { + mainWindow = createMainWindow(mainWindow) + } }) app.on('window-all-closed', () => { - mainWindow = null - errorWindow = null + mainWindow = null + errorWindow = null - if (!Constants.IS_MAC) { - app.quit() - } + if (!Constants.IS_MAC) { + app.quit() + } }) app.on( - 'render-process-gone', - (event: Event, webContents: WebContents, details: RenderProcessGoneDetails) => { - errorWindow = createErrorWindow(errorWindow, mainWindow, details) - } + 'render-process-gone', + (event: Event, webContents: WebContents, details: RenderProcessGoneDetails) => { + errorWindow = createErrorWindow(errorWindow, mainWindow, details) + } ) process.on('uncaughtException', () => { - errorWindow = createErrorWindow(errorWindow, mainWindow) + errorWindow = createErrorWindow(errorWindow, mainWindow) }) diff --git a/src/main/utils/Constants.ts b/src/main/utils/Constants.ts index 6ca756f..d39eaac 100644 --- a/src/main/utils/Constants.ts +++ b/src/main/utils/Constants.ts @@ -1,19 +1,19 @@ import { join } from 'path' export default class Constants { - static APP_NAME = 'Vutron' + static APP_NAME = 'Vutron' - static IS_DEV_ENV = process.env.NODE_ENV === 'development' + static IS_DEV_ENV = process.env.NODE_ENV === 'development' - static IS_MAC = process.platform === 'darwin' + static IS_MAC = process.platform === 'darwin' - static DEFAULT_WEB_PREFERENCES = { - nodeIntegration: true, - contextIsolation: false, - nodeIntegrationInWorker: true, - enableRemoteModule: true - } + static DEFAULT_WEB_PREFERENCES = { + nodeIntegration: true, + contextIsolation: false, + nodeIntegrationInWorker: true, + enableRemoteModule: true + } - static APP_INDEX_URL_DEV = 'http://localhost:5173/index.html' - static APP_INDEX_URL_PROD = join(__dirname, '../index.html') + static APP_INDEX_URL_DEV = 'http://localhost:5173/index.html' + static APP_INDEX_URL_PROD = join(__dirname, '../index.html') } diff --git a/src/main/utils/Menus.ts b/src/main/utils/Menus.ts index b05c164..3c228d7 100644 --- a/src/main/utils/Menus.ts +++ b/src/main/utils/Menus.ts @@ -2,12 +2,12 @@ import { systemPreferences } from 'electron' import Constants from './Constants' export default class Menus { - static macOSDisableDefaultMenuItem(): void { - if (Constants.IS_MAC) { - systemPreferences.setUserDefault('NSDisabledDictationMenuItem', 'boolean', true) - systemPreferences.setUserDefault('NSDisabledCharacterPaletteMenuItem', 'boolean', true) - } - } + static macOSDisableDefaultMenuItem(): void { + if (Constants.IS_MAC) { + systemPreferences.setUserDefault('NSDisabledDictationMenuItem', 'boolean', true) + systemPreferences.setUserDefault('NSDisabledCharacterPaletteMenuItem', 'boolean', true) + } + } } export const { macOSDisableDefaultMenuItem } = Menus diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 6291fea..5844762 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -3,22 +3,22 @@ import { DefaultLayout } from '@/renderer/components/layout' diff --git a/src/renderer/components/layout/DefaultLayout.vue b/src/renderer/components/layout/DefaultLayout.vue index 83282a1..ca10691 100644 --- a/src/renderer/components/layout/DefaultLayout.vue +++ b/src/renderer/components/layout/DefaultLayout.vue @@ -3,12 +3,12 @@ import HeaderLayout from '@/renderer/components/layout/HeaderLayout.vue' diff --git a/src/renderer/components/layout/HeaderLayout.vue b/src/renderer/components/layout/HeaderLayout.vue index 7714951..7b20b9c 100644 --- a/src/renderer/components/layout/HeaderLayout.vue +++ b/src/renderer/components/layout/HeaderLayout.vue @@ -1,5 +1,5 @@ diff --git a/src/renderer/index.html b/src/renderer/index.html index c83ba6b..b6aee85 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -1,10 +1,10 @@ - - - - -
- - + + + + +
+ + diff --git a/src/renderer/locales/en.json b/src/renderer/locales/en.json index 49a8816..b7069b0 100644 --- a/src/renderer/locales/en.json +++ b/src/renderer/locales/en.json @@ -1,10 +1,10 @@ { - "desc": { - "welcome": "Thank you for using Vutron. This cool template makes it easy to create a variety of cross-platform applications." - }, - "menu": { - "change-theme": "Change Theme", - "change-language": "Change Language", - "about": "About Vutron" - } + "desc": { + "welcome": "Thank you for using Vutron. This cool template makes it easy to create a variety of cross-platform applications." + }, + "menu": { + "change-theme": "Change Theme", + "change-language": "Change Language", + "about": "About Vutron" + } } diff --git a/src/renderer/locales/ko.json b/src/renderer/locales/ko.json index eafbd02..5714d24 100644 --- a/src/renderer/locales/ko.json +++ b/src/renderer/locales/ko.json @@ -1,10 +1,10 @@ { - "desc": { - "welcome": "Vutron을 이용해주셔서 감사드립니다. 이 멋진 템플릿을 활용하면 다양한 크로스플랫폼 애플리케이션을 손쉽게 제작할 수 있습니다." - }, - "menu": { - "change-theme": "테마 변경", - "change-language": "언어 변경", - "about": "Vutron 정보" - } + "desc": { + "welcome": "Vutron을 이용해주셔서 감사드립니다. 이 멋진 템플릿을 활용하면 다양한 크로스플랫폼 애플리케이션을 손쉽게 제작할 수 있습니다." + }, + "menu": { + "change-theme": "테마 변경", + "change-language": "언어 변경", + "about": "Vutron 정보" + } } diff --git a/src/renderer/plugins/i18n.ts b/src/renderer/plugins/i18n.ts index 9afd7d6..2e8fabe 100644 --- a/src/renderer/plugins/i18n.ts +++ b/src/renderer/plugins/i18n.ts @@ -4,12 +4,12 @@ import ko from '@/renderer/locales/ko.json' import { getCurrentLocale } from '@/renderer/utils' export default createI18n({ - legacy: false, - locale: getCurrentLocale(), - fallbackLocale: 'en', - globalInjection: true, - messages: { - en, - ko - } + legacy: false, + locale: getCurrentLocale(), + fallbackLocale: 'en', + globalInjection: true, + messages: { + en, + ko + } }) diff --git a/src/renderer/plugins/vuetify.ts b/src/renderer/plugins/vuetify.ts index e025b92..2d627f3 100644 --- a/src/renderer/plugins/vuetify.ts +++ b/src/renderer/plugins/vuetify.ts @@ -5,32 +5,32 @@ import { aliases, mdi } from 'vuetify/iconsets/mdi' import colors from 'vuetify/lib/util/colors.mjs' export default createVuetify({ - locale: { - messages: { ko, en }, - defaultLocale: 'en', - fallbackLocale: 'en' - }, - icons: { - defaultSet: 'mdi', - aliases, - sets: { - mdi - } - }, - theme: { - themes: { - light: { - dark: false, - colors: { - primary: colors.green.darken2 - } - }, - dark: { - dark: true, - colors: { - primary: colors.green.darken4 - } - } - } - } + locale: { + messages: { ko, en }, + defaultLocale: 'en', + fallbackLocale: 'en' + }, + icons: { + defaultSet: 'mdi', + aliases, + sets: { + mdi + } + }, + theme: { + themes: { + light: { + dark: false, + colors: { + primary: colors.green.darken2 + } + }, + dark: { + dark: true, + colors: { + primary: colors.green.darken4 + } + } + } + } }) diff --git a/src/renderer/router/index.ts b/src/renderer/router/index.ts index f26f2ee..dc6922a 100644 --- a/src/renderer/router/index.ts +++ b/src/renderer/router/index.ts @@ -2,25 +2,25 @@ import { createRouter, createWebHashHistory } from 'vue-router/dist/vue-router.e import { MainScreen, ErrorScreen } from '@/renderer/screens' export default createRouter({ - history: createWebHashHistory(), - routes: [ - { - path: '/', - component: MainScreen, - meta: { - title: 'Main' - } - }, - { - path: '/error', - component: ErrorScreen, - meta: { - title: 'Unknown error occurred' - } - }, - { - path: '/:pathMatch(.*)*', - redirect: '/' - } - ] + history: createWebHashHistory(), + routes: [ + { + path: '/', + component: MainScreen, + meta: { + title: 'Main' + } + }, + { + path: '/error', + component: ErrorScreen, + meta: { + title: 'Unknown error occurred' + } + }, + { + path: '/:pathMatch(.*)*', + redirect: '/' + } + ] }) diff --git a/src/renderer/screens/ErrorScreen.vue b/src/renderer/screens/ErrorScreen.vue index 74a6e5b..cf8528b 100644 --- a/src/renderer/screens/ErrorScreen.vue +++ b/src/renderer/screens/ErrorScreen.vue @@ -1,5 +1,5 @@ diff --git a/src/renderer/screens/MainScreen.vue b/src/renderer/screens/MainScreen.vue index 67c61d2..f4e8488 100644 --- a/src/renderer/screens/MainScreen.vue +++ b/src/renderer/screens/MainScreen.vue @@ -11,54 +11,54 @@ const { counterIncrease } = useTempStore() const { counter } = storeToRefs(useTempStore()) const handleChangeTheme = (): void => { - theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark' + theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark' } const handleChangeLanguage = (): void => { - if (locale.value === 'en') { - locale.value = 'ko' - } else { - locale.value = 'en' - } + if (locale.value === 'en') { + locale.value = 'ko' + } else { + locale.value = 'en' + } } const handleAbout = async (): Promise => { - await openExternal('https://github.com/jooy2/vutron') + await openExternal('https://github.com/jooy2/vutron') } const handleCountIncrease = (): void => { - counterIncrease(1) + counterIncrease(1) } diff --git a/src/renderer/store/temp.ts b/src/renderer/store/temp.ts index a895399..c6a562e 100644 --- a/src/renderer/store/temp.ts +++ b/src/renderer/store/temp.ts @@ -1,15 +1,15 @@ import { defineStore } from 'pinia' export const useTempStore = defineStore('temp', { - state: () => ({ - counter: 0 - }), - getters: { - getCounter: (state): number => state.counter - }, - actions: { - counterIncrease(amount: number) { - this.counter += amount - } - } + state: () => ({ + counter: 0 + }), + getters: { + getCounter: (state): number => state.counter + }, + actions: { + counterIncrease(amount: number) { + this.counter += amount + } + } }) diff --git a/src/renderer/utils/index.ts b/src/renderer/utils/index.ts index 2789d80..ed4af5f 100644 --- a/src/renderer/utils/index.ts +++ b/src/renderer/utils/index.ts @@ -1,13 +1,13 @@ import { shell } from 'electron' export default class Utils { - static getCurrentLocale(): string { - return navigator?.language?.split('-')[0] || 'en' - } + static getCurrentLocale(): string { + return navigator?.language?.split('-')[0] || 'en' + } - static async openExternal(url: string): Promise { - await shell.openExternal(url) - } + static async openExternal(url: string): Promise { + await shell.openExternal(url) + } } export const { getCurrentLocale, openExternal } = Utils diff --git a/tsconfig.json b/tsconfig.json index 5ccd3d2..a673c30 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,28 +1,28 @@ { - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist", - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "jsx": "preserve", - "noImplicitAny": false, - "allowSyntheticDefaultImports": true, - "declaration": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "sourceMap": true, - "strict": true, - "skipLibCheck": true, - "paths": { - "@/*": ["./src/*"] - }, - "lib": ["esnext", "dom"] - }, - "include": ["src/**/*/*.ts", "src/**/*/*.d.ts", "src/**/*/*.tsx", "src/**/*/*.vue"], - "references": [ - { - "path": "./tsconfig.node.json" - } - ] + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist", + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "jsx": "preserve", + "noImplicitAny": false, + "allowSyntheticDefaultImports": true, + "declaration": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "sourceMap": true, + "strict": true, + "skipLibCheck": true, + "paths": { + "@/*": ["./src/*"] + }, + "lib": ["esnext", "dom"] + }, + "include": ["src/**/*/*.ts", "src/**/*/*.d.ts", "src/**/*/*.tsx", "src/**/*/*.vue"], + "references": [ + { + "path": "./tsconfig.node.json" + } + ] } diff --git a/tsconfig.node.json b/tsconfig.node.json index 47d362d..d711ff2 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -1,12 +1,12 @@ { - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "jsx": "preserve", - "moduleResolution": "node", - "composite": true, - "resolveJsonModule": true, - "allowSyntheticDefaultImports": true - }, - "include": ["package.json", "electron"] + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "jsx": "preserve", + "moduleResolution": "node", + "composite": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true + }, + "include": ["package.json"] } diff --git a/vite.config.js b/vite.config.js index 7883a98..2933b5b 100644 --- a/vite.config.js +++ b/vite.config.js @@ -8,43 +8,43 @@ import { resolve, dirname } from 'path' import { builtinModules } from 'module' export default defineConfig({ - define: { - __VUE_I18N_FULL_INSTALL__: true, - __VUE_I18N_LEGACY_API__: false, - __INTLIFY_PROD_DEVTOOLS__: false - }, - resolve: { - extensions: ['.mjs', '.js', '.ts', '.vue', '.json', '.scss'], - alias: { - '@': resolve(dirname(fileURLToPath(import.meta.url)), 'src') - } - }, - base: './', - root: resolve('./src/renderer'), - publicDir: resolve('./src/renderer/public'), - build: { - outDir: resolve('./dist') - }, - plugins: [ - vue(), - vueJsx(), - eslintPlugin(), - electronPlugin({ - main: { - entry: 'src/main/index.ts', - vite: { - publicDir: resolve('./src/main'), - build: { - emptyOutDir: true, - assetsDir: '.', - outDir: 'dist/main', - rollupOptions: { - external: ['electron', ...builtinModules] - } - } - } - }, - renderer: {} - }) - ] + define: { + __VUE_I18N_FULL_INSTALL__: true, + __VUE_I18N_LEGACY_API__: false, + __INTLIFY_PROD_DEVTOOLS__: false + }, + resolve: { + extensions: ['.mjs', '.js', '.ts', '.vue', '.json', '.scss'], + alias: { + '@': resolve(dirname(fileURLToPath(import.meta.url)), 'src') + } + }, + base: './', + root: resolve('./src/renderer'), + publicDir: resolve('./src/renderer/public'), + build: { + outDir: resolve('./dist') + }, + plugins: [ + vue(), + vueJsx(), + eslintPlugin(), + electronPlugin({ + main: { + entry: 'src/main/index.ts', + vite: { + publicDir: resolve('./src/main'), + build: { + emptyOutDir: true, + assetsDir: '.', + outDir: 'dist/main', + rollupOptions: { + external: ['electron', ...builtinModules] + } + } + } + }, + renderer: {} + }) + ] })