mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 17:09:07 +08:00
add script for making dist for current platform and arch
This commit is contained in:
@@ -21,11 +21,6 @@ extraResources:
|
|||||||
- external-node-runtime-dependencies/**
|
- external-node-runtime-dependencies/**
|
||||||
win:
|
win:
|
||||||
executableName: geekgeekrun
|
executableName: geekgeekrun
|
||||||
target:
|
|
||||||
- target: nsis
|
|
||||||
arch:
|
|
||||||
- x64
|
|
||||||
- arm64
|
|
||||||
nsis:
|
nsis:
|
||||||
artifactName: ${name}_${version}_${arch}_setup.${ext}
|
artifactName: ${name}_${version}_${arch}_setup.${ext}
|
||||||
shortcutName: ${productName}
|
shortcutName: ${productName}
|
||||||
@@ -39,22 +34,12 @@ mac:
|
|||||||
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
||||||
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
||||||
notarize: false
|
notarize: false
|
||||||
target:
|
|
||||||
- target: dmg
|
|
||||||
arch:
|
|
||||||
- x64
|
|
||||||
- arm64
|
|
||||||
dmg:
|
dmg:
|
||||||
artifactName: ${name}_${version}_${arch}.${ext}
|
artifactName: ${name}_${version}_${arch}.${ext}
|
||||||
linux:
|
linux:
|
||||||
target:
|
artifactName: ${name}_${version}_${arch}.${ext}
|
||||||
- target: deb
|
|
||||||
arch:
|
|
||||||
- x64
|
|
||||||
- arm64
|
|
||||||
maintainer: GeekGeekRun
|
maintainer: GeekGeekRun
|
||||||
category: Utility
|
category: Utility
|
||||||
artifactName: ${name}_${version}_${arch}.${ext}
|
|
||||||
npmRebuild: false
|
npmRebuild: false
|
||||||
publish:
|
publish:
|
||||||
provider: generic
|
provider: generic
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
"build:win": "npm run build && electron-builder --win",
|
"build:win": "npm run build && electron-builder --win",
|
||||||
"build:mac": "npm run build && electron-builder --mac",
|
"build:mac": "npm run build && electron-builder --mac",
|
||||||
"build:linux": "npm run build && electron-builder --linux",
|
"build:linux": "npm run build && electron-builder --linux",
|
||||||
|
"build:make-dist-for-current-platform": "npm run build && node ./scripts/make-dist-for-current-platform.mjs",
|
||||||
"install": "cd ./external-node-runtime-dependencies && cross-env PUPPETEER_SKIP_DOWNLOAD=1 npm install --omit=dev",
|
"install": "cd ./external-node-runtime-dependencies && cross-env PUPPETEER_SKIP_DOWNLOAD=1 npm install --omit=dev",
|
||||||
"release": "node ./scripts/release-new-version.mjs"
|
"release": "node ./scripts/release-new-version.mjs"
|
||||||
},
|
},
|
||||||
@@ -57,9 +58,10 @@
|
|||||||
"electron-builder": "^24.9.1",
|
"electron-builder": "^24.9.1",
|
||||||
"electron-vite": "^2.0.0",
|
"electron-vite": "^2.0.0",
|
||||||
"element-plus": "^2.5.5",
|
"element-plus": "^2.5.5",
|
||||||
"find-chrome-bin": "^2.0.1",
|
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
"eslint-plugin-vue": "^9.20.1",
|
"eslint-plugin-vue": "^9.20.1",
|
||||||
|
"find-chrome-bin": "^2.0.1",
|
||||||
|
"js-yaml": "^4.1.0",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"prettier": "^3.2.4",
|
"prettier": "^3.2.4",
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import builder from 'electron-builder'
|
||||||
|
import yaml from 'js-yaml'
|
||||||
|
import url from 'node:url'
|
||||||
|
import path from 'node:path'
|
||||||
|
import fs from 'node:fs'
|
||||||
|
import { buildTargetListMapByPlatform, osPlatformToBuildCommandMap } from './vars/os.mjs'
|
||||||
|
|
||||||
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
||||||
|
|
||||||
|
const getBuilderConfig = () => {
|
||||||
|
return yaml.load(fs.readFileSync(path.join(__dirname, '../electron-builder.yml'), 'utf8'))
|
||||||
|
}
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const buildTargets = buildTargetListMapByPlatform[process.platform]
|
||||||
|
const platformKeyForBuildParameter = osPlatformToBuildCommandMap[process.platform]
|
||||||
|
if (!buildTargets?.length || !platformKeyForBuildParameter) {
|
||||||
|
console.log('Cannot build for current platform')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
const buildParameter = {
|
||||||
|
config: getBuilderConfig()
|
||||||
|
}
|
||||||
|
buildParameter[platformKeyForBuildParameter] = buildTargets.map((it) => `${it}:${process.arch}`)
|
||||||
|
|
||||||
|
return await builder.build(buildParameter)
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
@@ -1,12 +1,5 @@
|
|||||||
import childProcess from 'node:child_process'
|
import childProcess from 'node:child_process'
|
||||||
import os from 'node:os'
|
import { osPlatformToBuildCommandMap, currentOsPlatform } from '../vars/os.mjs'
|
||||||
|
|
||||||
const currentOsPlatform = os.platform()
|
|
||||||
const osPlatformToBuildCommandMap = {
|
|
||||||
darwin: 'mac',
|
|
||||||
linux: 'linux',
|
|
||||||
win32: 'win'
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function buildUiOnCurrentPlatform() {
|
export default function buildUiOnCurrentPlatform() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import os from 'node:os'
|
||||||
|
|
||||||
|
export const currentOsPlatform = os.platform()
|
||||||
|
export const osPlatformToBuildCommandMap = {
|
||||||
|
darwin: 'mac',
|
||||||
|
linux: 'linux',
|
||||||
|
win32: 'win'
|
||||||
|
}
|
||||||
|
export const buildTargetListMapByPlatform = {
|
||||||
|
darwin: ['dmg'],
|
||||||
|
linux: ['deb'],
|
||||||
|
win32: ['nsis']
|
||||||
|
}
|
||||||
Generated
+3
@@ -187,6 +187,9 @@ importers:
|
|||||||
find-chrome-bin:
|
find-chrome-bin:
|
||||||
specifier: ^2.0.1
|
specifier: ^2.0.1
|
||||||
version: 2.0.1
|
version: 2.0.1
|
||||||
|
js-yaml:
|
||||||
|
specifier: ^4.1.0
|
||||||
|
version: 4.1.0
|
||||||
lodash-es:
|
lodash-es:
|
||||||
specifier: ^4.17.21
|
specifier: ^4.17.21
|
||||||
version: 4.17.21
|
version: 4.17.21
|
||||||
|
|||||||
Reference in New Issue
Block a user