pack: change the electron-builder setting to allow dynamic values to be added and move the folder location

This commit is contained in:
leejooy96 committed 2023-09-26 10:07:12 +09:00
1 parent 1fca9b3a81
commit f22dbcf775
9 files changed
+1114 -714

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
node_modules/
buildAssets/
buildAssets/icons/
dist/
release/
docs/
+1 -1
View File
@@ -7,6 +7,6 @@
# Project files
.github/
buildAssets/
buildAssets/icons/
dist/
release/
+5
View File
@@ -6,6 +6,11 @@
"eslint.validate": [
"javascript"
],
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"emmet.syntaxProfiles": {},
"files.autoSave": "afterDelay",
"editor.wordWrap": "on",
@@ -1,30 +1,22 @@
{
/* eslint-disable no-template-curly-in-string */
import dotenv from 'dotenv'
const baseConfig: any = {
productName: 'Vutron',
appId: 'com.vutron.vutron',
asar: true,
extends: null,
compression: 'maximum',
copyright: 'ⓒ 2023 ${author}',
artifactName: '${productName} ${version}_${arch}.${ext}',
directories: {
buildResources: 'buildAssets',
output: './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/**/*',
'!tests/**/*',
'!release/**/*'
],
mac: {
bundleVersion: '1.0',
identity: null,
hardenedRuntime: true,
gatekeeperAssess: false,
notarize: false,
icon: 'buildAssets/icons/icon.icns',
type: 'distribution',
target: [
@@ -97,3 +89,29 @@
]
}
}
dotenv.config()
baseConfig.copyright = `ⓒ ${new Date().getFullYear()} $\{author}`
baseConfig.files = [
/* A list of files not to be included in the build. */
/*
(Required) The files and folders listed below should not be included in the build.
*/
'dist/**/*',
'!docs/**/*',
'!tests/**/*',
'!release/**/*'
]
// TODO: Notarize for macOS
baseConfig.mac.identity = null
/* if (process.env.MAC_NOTARIZE === 'true') {
baseConfig.afterSign = './buildAssets/builder/notarize.ts'
} else {
baseConfig.mac.identity = null
} */
export default {
...baseConfig
}
+1 -1
View File
@@ -43,7 +43,7 @@ $ npm run build
## Reduce bundle size by excluding development files
You can exclude files you don't need at build time by adding a file pattern to the files property of `electron-builder.json5`. This will save bundle capacity.
You can exclude files you don't need at build time by adding a file pattern to the files property of `buildAssets/builder/config.ts`. This will save bundle capacity.
Below is an unnecessary `node_modules` file pattern that can further save bundles. Depending on the project, using the rules below may cause problems, so please review it before using.
+2 -1
View File
@@ -10,6 +10,8 @@
│ └─ FUNDING.yml
├─ .vscode - Common project configuration files used by Visual Studio Code IDE
├─ buildAssets/ - Package resource (icon, logo, etc.) file used for Electron build
│ └─ builder/
│ │ │ └─ config.ts - `electron-builder` dynamic configuration file
│ └─ icons/
├─ dist/ - Output directory used to build the package
├─ docs/ - Project documents (optionally enabled)
@@ -53,7 +55,6 @@
├─ .prettierignore - List of files to disable Prettier file formatting
├─ .prettierrc - Prettier rule configurations
├─ CODE_OF_CONDUCT.md - Files used only on GitHub
├─ electron-builder.json5
├─ LICENSE - Project license file
├─ package.json - NodeJS package configurations
├─ package-lock.json
+1055 -681
View File
File diff suppressed because it is too large. Load diff
+16 -15
View File
@@ -18,12 +18,12 @@
"dev": "cross-env ELECTRON_ENABLE_LOGGING=true vite",
"dev:debug": "vite -d",
"dev:debug:force": "vite -d --force",
"build": "npm run build:pre && electron-builder -wml",
"build": "npm run build:pre && electron-builder --config=buildAssets/builder/config.ts -wml",
"build:pre": "npm run format:fix && vue-tsc --noEmit && 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",
"build:dir": "npm run build:pre && electron-builder --config=buildAssets/builder/config.ts --dir",
"build:mac": "npm run build:pre && CSC_IDENTITY_AUTO_DISCOVERY=false electron-builder --config=buildAssets/builder/config.ts --mac",
"build:linux": "npm run build:pre && electron-builder --config=buildAssets/builder/config.ts --linux",
"build:win": "npm run build:pre && electron-builder --config=buildAssets/builder/config.ts --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 .",
@@ -31,27 +31,28 @@
"test": "npm run build:dir && xvfb-maybe -- playwright test"
},
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
},
"dependencies": {
"pinia": "^2.1.6",
"vue": "^3.3.4",
"vue-i18n": "^9.4.1",
"vue-router": "^4.2.4",
"vuetify": "^3.3.16"
"vue-router": "^4.2.5",
"vuetify": "^3.3.17"
},
"devDependencies": {
"@mdi/font": "^7.2.96",
"@playwright/test": "^1.38.0",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"@playwright/test": "^1.38.1",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"@vitejs/plugin-vue": "^4.3.4",
"@vitejs/plugin-vue-jsx": "^3.0.2",
"cross-env": "^7.0.3",
"electron": "^26.2.1",
"dotenv": "^16.3.1",
"electron": "^26.2.2",
"electron-builder": "^24.6.4",
"electron-extension-installer": "^1.2.0",
"eslint": "^8.49.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-friendly-formatter": "^4.0.1",
@@ -59,7 +60,7 @@
"eslint-plugin-n": "^16.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.17.0",
"playwright": "^1.38.0",
"playwright": "^1.38.1",
"prettier": "^3.0.3",
"typescript": "^5.2.2",
"vite": "^4.4.9",
@@ -68,7 +69,7 @@
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-vuetify": "^1.0.2",
"vue-eslint-parser": "^9.3.1",
"vue-tsc": "^1.8.11",
"vue-tsc": "^1.8.14",
"xvfb-maybe": "^0.2.1"
}
}
+2 -1
View File
@@ -6,7 +6,8 @@
"moduleResolution": "node",
"composite": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true
},
"include": ["src/main", "src/preload", "package.json", "vite.config.ts"]
"include": ["src/main", "src/preload", "package.json", "vite.config.ts", "buildAssets/builder"]
}