mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-05-12 02:19:55 +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/**
|
||||
win:
|
||||
executableName: geekgeekrun
|
||||
target:
|
||||
- target: nsis
|
||||
arch:
|
||||
- x64
|
||||
- arm64
|
||||
nsis:
|
||||
artifactName: ${name}_${version}_${arch}_setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
@@ -39,22 +34,12 @@ mac:
|
||||
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
|
||||
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
|
||||
notarize: false
|
||||
target:
|
||||
- target: dmg
|
||||
arch:
|
||||
- x64
|
||||
- arm64
|
||||
dmg:
|
||||
artifactName: ${name}_${version}_${arch}.${ext}
|
||||
linux:
|
||||
target:
|
||||
- target: deb
|
||||
arch:
|
||||
- x64
|
||||
- arm64
|
||||
artifactName: ${name}_${version}_${arch}.${ext}
|
||||
maintainer: GeekGeekRun
|
||||
category: Utility
|
||||
artifactName: ${name}_${version}_${arch}.${ext}
|
||||
npmRebuild: false
|
||||
publish:
|
||||
provider: generic
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
"build:win": "npm run build && electron-builder --win",
|
||||
"build:mac": "npm run build && electron-builder --mac",
|
||||
"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",
|
||||
"release": "node ./scripts/release-new-version.mjs"
|
||||
},
|
||||
@@ -57,9 +58,10 @@
|
||||
"electron-builder": "^24.9.1",
|
||||
"electron-vite": "^2.0.0",
|
||||
"element-plus": "^2.5.5",
|
||||
"find-chrome-bin": "^2.0.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-plugin-vue": "^9.20.1",
|
||||
"find-chrome-bin": "^2.0.1",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"normalize.css": "^8.0.1",
|
||||
"prettier": "^3.2.4",
|
||||
|
||||
29
packages/ui/scripts/make-dist-for-current-platform.mjs
Normal file
29
packages/ui/scripts/make-dist-for-current-platform.mjs
Normal file
@@ -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 os from 'node:os'
|
||||
|
||||
const currentOsPlatform = os.platform()
|
||||
const osPlatformToBuildCommandMap = {
|
||||
darwin: 'mac',
|
||||
linux: 'linux',
|
||||
win32: 'win'
|
||||
}
|
||||
import { osPlatformToBuildCommandMap, currentOsPlatform } from '../vars/os.mjs'
|
||||
|
||||
export default function buildUiOnCurrentPlatform() {
|
||||
try {
|
||||
|
||||
13
packages/ui/scripts/vars/os.mjs
Normal file
13
packages/ui/scripts/vars/os.mjs
Normal file
@@ -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']
|
||||
}
|
||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -187,6 +187,9 @@ importers:
|
||||
find-chrome-bin:
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.1
|
||||
js-yaml:
|
||||
specifier: ^4.1.0
|
||||
version: 4.1.0
|
||||
lodash-es:
|
||||
specifier: ^4.17.21
|
||||
version: 4.17.21
|
||||
|
||||
Reference in New Issue
Block a user