使用electron-vite搭建项目前一定要挂梯子安装一下脚手架
其他按照官网流程往下搭建就行
官网>
下面是我package.json插件
主要功能有:
1:commit提交检查和拦截
2、打包测试环境
3、electron-vite官网提供的几个插件,帮助打包后代码的封闭性等问题
这里是我gitee代码仓库的地址
{
"name": "take-number",
"version": "1.0.0",
"description": "An Electron application with Vue and TypeScript",
"main": "./out/main/index.js",
"author": "example.com",
"homepage": "https://www.electronjs.org",
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"./**/*.{html,vue,ts,js,json,md,less,css}": "yarn format",
"./**/*.{js,ts,jsx,tsx}": "yarn lint"
},
"scripts": {
"prepare": "husky install",
"format": "prettier --write \"./**/*.{html,vue,ts,js,json,md,less,css}\"",
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix",
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
"typecheck:web": "vue-tsc --noEmit -p tsconfig.web.json --composite false",
"typecheck": "npm run typecheck:node && npm run typecheck:web",
"start": "electron-vite preview",
"dev": "electron-vite dev",
"build": "npm run typecheck && electron-vite build",
"postinstall": "electron-builder install-app-deps",
"stage:win": "npm run build && electron-builder --win --config --mode=staging",
"build:win": "npm run build && electron-builder --win --config",
"stage:mac": "npm run build && electron-builder --mac --config --mode=staging",
"build:mac": "npm run build && electron-builder --mac --config",
"stage:linux": "npm run build && electron-builder --linux --config --mode=staging",
"build:linux": "npm run build && electron-builder --linux --config"
},
"dependencies": {
"@electron-toolkit/preload": "^1.0.3",
"@electron-toolkit/utils": "^1.0.2",
"axios": "^1.3.3",
"dayjs": "^1.11.7",
"electron-updater": "^5.3.0",
"nprogress": "^0.2.0",
"pinia": "^2.0.32",
"vant": "^4.0.11",
"vue-router": "^4.0.13"
},
"devDependencies": {
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@electron-toolkit/tsconfig": "^1.0.1",
"@electron/notarize": "^1.2.3",
"@rushstack/eslint-patch": "^1.2.0",
"@swc/core": "^1.3.36",
"@types/axios": "^0.14.0",
"@types/node": "16.18.11",
"@types/rollup-plugin-visualizer": "^4.2.1",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"@vitejs/plugin-vue": "^4.0.0",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^11.0.2",
"autoprefixer": "^10.4.13",
"electron": "^21.3.3",
"electron-builder": "^23.6.0",
"electron-vite": "^1.0.17",
"eslint": "^8.31.0",
"eslint-plugin-vue": "^9.8.0",
"husky": "^8.0.3",
"less": "^4.1.3",
"lint-staged": "^13.1.2",
"postcss": "^8.4.21",
"postcss-html": "^1.5.0",
"postcss-less": "^6.0.0",
"prettier": "^2.8.2",
"tailwindcss": "^3.2.7",
"typescript": "^4.9.4",
"vite": "^4.0.4",
"vue": "^3.2.45",
"vue-tsc": "^1.0.22"
}
}