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
+1115 -715

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
node_modules/ node_modules/
buildAssets/ buildAssets/icons/
dist/ dist/
release/ release/
docs/ docs/
+1 -1
View File
@@ -7,6 +7,6 @@
# Project files # Project files
.github/ .github/
buildAssets/ buildAssets/icons/
dist/ dist/
release/ release/
+6 -1
View File
@@ -6,10 +6,15 @@
"eslint.validate": [ "eslint.validate": [
"javascript" "javascript"
], ],
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"emmet.syntaxProfiles": {}, "emmet.syntaxProfiles": {},
"files.autoSave": "afterDelay", "files.autoSave": "afterDelay",
"editor.wordWrap": "on", "editor.wordWrap": "on",
"editor.defaultFormatter": "esbenp.prettier-vscode", "editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.tabSize": 2 "editor.tabSize": 2
} }
@@ -1,30 +1,22 @@
{ /* eslint-disable no-template-curly-in-string */
import dotenv from 'dotenv'
const baseConfig: any = {
productName: 'Vutron', productName: 'Vutron',
appId: 'com.vutron.vutron', appId: 'com.vutron.vutron',
asar: true, asar: true,
extends: null, extends: null,
compression: 'maximum', compression: 'maximum',
copyright: 'ⓒ 2023 ${author}',
artifactName: '${productName} ${version}_${arch}.${ext}', artifactName: '${productName} ${version}_${arch}.${ext}',
directories: { directories: {
buildResources: 'buildAssets', buildResources: 'buildAssets',
output: './release/${version}' 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: { mac: {
bundleVersion: '1.0', bundleVersion: '1.0',
identity: null,
hardenedRuntime: true, hardenedRuntime: true,
gatekeeperAssess: false, gatekeeperAssess: false,
notarize: false,
icon: 'buildAssets/icons/icon.icns', icon: 'buildAssets/icons/icon.icns',
type: 'distribution', type: 'distribution',
target: [ 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 ## 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. 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 │ └─ FUNDING.yml
├─ .vscode - Common project configuration files used by Visual Studio Code IDE ├─ .vscode - Common project configuration files used by Visual Studio Code IDE
├─ buildAssets/ - Package resource (icon, logo, etc.) file used for Electron build ├─ buildAssets/ - Package resource (icon, logo, etc.) file used for Electron build
│ └─ builder/
│ │ │ └─ config.ts - `electron-builder` dynamic configuration file
│ └─ icons/ │ └─ icons/
├─ dist/ - Output directory used to build the package ├─ dist/ - Output directory used to build the package
├─ docs/ - Project documents (optionally enabled) ├─ docs/ - Project documents (optionally enabled)
@@ -53,7 +55,6 @@
├─ .prettierignore - List of files to disable Prettier file formatting ├─ .prettierignore - List of files to disable Prettier file formatting
├─ .prettierrc - Prettier rule configurations ├─ .prettierrc - Prettier rule configurations
├─ CODE_OF_CONDUCT.md - Files used only on GitHub ├─ CODE_OF_CONDUCT.md - Files used only on GitHub
├─ electron-builder.json5
├─ LICENSE - Project license file ├─ LICENSE - Project license file
├─ package.json - NodeJS package configurations ├─ package.json - NodeJS package configurations
├─ package-lock.json ├─ 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": "cross-env ELECTRON_ENABLE_LOGGING=true vite",
"dev:debug": "vite -d", "dev:debug": "vite -d",
"dev:debug:force": "vite -d --force", "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:pre": "npm run format:fix && vue-tsc --noEmit && vite build",
"build:dir": "npm run build:pre && electron-builder --dir", "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 --mac", "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 --linux", "build:linux": "npm run build:pre && electron-builder --config=buildAssets/builder/config.ts --linux",
"build:win": "npm run build:pre && electron-builder --windows", "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": "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", "lint:fix": "eslint --ext .js,.ts,.vue -f ./node_modules/eslint-friendly-formatter --fix src",
"format": "prettier .", "format": "prettier .",
@@ -31,27 +31,28 @@
"test": "npm run build:dir && xvfb-maybe -- playwright test" "test": "npm run build:dir && xvfb-maybe -- playwright test"
}, },
"engines": { "engines": {
"node": ">=16.0.0" "node": ">=18.0.0"
}, },
"dependencies": { "dependencies": {
"pinia": "^2.1.6", "pinia": "^2.1.6",
"vue": "^3.3.4", "vue": "^3.3.4",
"vue-i18n": "^9.4.1", "vue-i18n": "^9.4.1",
"vue-router": "^4.2.4", "vue-router": "^4.2.5",
"vuetify": "^3.3.16" "vuetify": "^3.3.17"
}, },
"devDependencies": { "devDependencies": {
"@mdi/font": "^7.2.96", "@mdi/font": "^7.2.96",
"@playwright/test": "^1.38.0", "@playwright/test": "^1.38.1",
"@typescript-eslint/eslint-plugin": "^6.7.0", "@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.0", "@typescript-eslint/parser": "^6.7.3",
"@vitejs/plugin-vue": "^4.3.4", "@vitejs/plugin-vue": "^4.3.4",
"@vitejs/plugin-vue-jsx": "^3.0.2", "@vitejs/plugin-vue-jsx": "^3.0.2",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"electron": "^26.2.1", "dotenv": "^16.3.1",
"electron": "^26.2.2",
"electron-builder": "^24.6.4", "electron-builder": "^24.6.4",
"electron-extension-installer": "^1.2.0", "electron-extension-installer": "^1.2.0",
"eslint": "^8.49.0", "eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0", "eslint-config-standard": "^17.1.0",
"eslint-friendly-formatter": "^4.0.1", "eslint-friendly-formatter": "^4.0.1",
@@ -59,7 +60,7 @@
"eslint-plugin-n": "^16.1.0", "eslint-plugin-n": "^16.1.0",
"eslint-plugin-promise": "^6.1.1", "eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.17.0", "eslint-plugin-vue": "^9.17.0",
"playwright": "^1.38.0", "playwright": "^1.38.1",
"prettier": "^3.0.3", "prettier": "^3.0.3",
"typescript": "^5.2.2", "typescript": "^5.2.2",
"vite": "^4.4.9", "vite": "^4.4.9",
@@ -68,7 +69,7 @@
"vite-plugin-eslint": "^1.8.1", "vite-plugin-eslint": "^1.8.1",
"vite-plugin-vuetify": "^1.0.2", "vite-plugin-vuetify": "^1.0.2",
"vue-eslint-parser": "^9.3.1", "vue-eslint-parser": "^9.3.1",
"vue-tsc": "^1.8.11", "vue-tsc": "^1.8.14",
"xvfb-maybe": "^0.2.1" "xvfb-maybe": "^0.2.1"
} }
} }
+2 -1
View File
@@ -6,7 +6,8 @@
"moduleResolution": "node", "moduleResolution": "node",
"composite": true, "composite": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": 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"]
} }