Use electron-builder
This commit is contained in:
parent
59b87d22e9
commit
750bcc0e8a
9 changed files with 202 additions and 10412 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -26,4 +26,4 @@ fonts
|
|||
.webpack/
|
||||
out/
|
||||
dist/
|
||||
build/
|
||||
gui/react/build/
|
||||
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
4
index.ts
4
index.ts
|
|
@ -1,5 +1,5 @@
|
|||
import { ServiceClass } from './@types/serviceClassInterface';
|
||||
import { appArgv, overrideArguments, showHelp } from './modules/module.app-args';
|
||||
import { appArgv, overrideArguments } from './modules/module.app-args';
|
||||
import * as yamlCfg from './modules/module.cfg-loader';
|
||||
import { makeCommand, addToArchive } from './modules/module.downloadArchive';
|
||||
|
||||
|
|
@ -56,8 +56,6 @@ import update from './modules/module.updater';
|
|||
} else if (argv.service === 'crunchy') {
|
||||
const crunchy = new (await import('./crunchy')).default();
|
||||
await crunchy.cli();
|
||||
} else {
|
||||
showHelp();
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
@ -4,13 +4,15 @@ import pkg from '../package.json';
|
|||
import modulesCleanup from 'removeNPMAbsolutePaths';
|
||||
import { exec } from 'pkg';
|
||||
import { execSync } from 'child_process';
|
||||
import { sep } from 'path';
|
||||
import path from 'path';
|
||||
|
||||
const buildsDir = './_builds';
|
||||
const nodeVer = 'node16-';
|
||||
|
||||
type BuildTypes = `${'ubuntu'|'windows'|'macos'}64`
|
||||
|
||||
(async () => {
|
||||
const buildType = process.argv[2];
|
||||
const buildType = process.argv[2] as BuildTypes;
|
||||
const isGUI = process.argv[3] === 'true';
|
||||
|
||||
if (isGUI) {
|
||||
|
|
@ -20,25 +22,42 @@ const nodeVer = 'node16-';
|
|||
}
|
||||
})();
|
||||
|
||||
async function buildGUI(buildType: string) {
|
||||
execSync('npx electron-forge make', { stdio: [0,1,2] });
|
||||
const path = ['out', 'make'];
|
||||
const makerDir = fs.readdirSync(path.join(sep));
|
||||
if (makerDir.length !== 1)
|
||||
throw new Error(`Illegal state ${makerDir.join(sep)}`);
|
||||
path.push(makerDir[0]);
|
||||
const arch = fs.readdirSync(path.join(sep));
|
||||
if (arch.length !== 1)
|
||||
throw new Error(`Illegal state ${arch.join(sep)}`);
|
||||
path.push(arch[0]);
|
||||
execSync(`7z a -t7z "../../../../${buildsDir}/multi-downloader-nx-${buildType}-gui.7z" .`,{
|
||||
async function buildGUI(buildType: BuildTypes) {
|
||||
execSync(`npx electron-builder build ${getCommand(buildType)}`, { stdio: [0,1,2] });
|
||||
execSync(`7z a -t7z "../${buildsDir}/multi-downloader-nx-${buildType}-gui.7z" "${getOutputFileName(buildType)}"`,{
|
||||
stdio:[0,1,2],
|
||||
cwd: path.join(sep)
|
||||
cwd: path.join('dist')
|
||||
});
|
||||
}
|
||||
|
||||
function getCommand(buildType: BuildTypes) {
|
||||
switch (buildType) {
|
||||
case 'ubuntu64':
|
||||
return `--linux --arm64`
|
||||
case 'windows64':
|
||||
return '--win';
|
||||
case 'macos64':
|
||||
return '--mac';
|
||||
default:
|
||||
return '--error'
|
||||
}
|
||||
}
|
||||
|
||||
function getOutputFileName(buildType: BuildTypes) {
|
||||
switch (buildType) {
|
||||
case 'ubuntu64':
|
||||
return `${pkg.name}_${pkg.version}_arm64.deb`;
|
||||
case 'windows64':
|
||||
return `${pkg.name} Setup ${pkg.version}.exe`;
|
||||
case 'macos64':
|
||||
return '';
|
||||
default:
|
||||
throw new Error(`Unknown build type ${buildType}`);
|
||||
}
|
||||
}
|
||||
|
||||
// main
|
||||
async function buildBinary(buildType: string) {
|
||||
async function buildBinary(buildType: BuildTypes) {
|
||||
const buildStr = `multi-downloader-nx`;
|
||||
const acceptableBuilds = ['windows64','ubuntu64','macos64'];
|
||||
if(!acceptableBuilds.includes(buildType)){
|
||||
|
|
|
|||
10509
package-lock.json
generated
10509
package-lock.json
generated
File diff suppressed because it is too large
Load diff
45
package.json
45
package.json
|
|
@ -14,7 +14,7 @@
|
|||
"utility",
|
||||
"cli"
|
||||
],
|
||||
"author": "Izu-co",
|
||||
"author": "Izu-co <github@izuco.dev> ",
|
||||
"homepage": "https://github.com/anidl/multi-downloader-nx",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
@ -44,12 +44,6 @@
|
|||
"yargs": "^17.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron-forge/cli": "^6.0.0-beta.61",
|
||||
"@electron-forge/maker-deb": "^6.0.0-beta.61",
|
||||
"@electron-forge/maker-rpm": "^6.0.0-beta.61",
|
||||
"@electron-forge/maker-squirrel": "^6.0.0-beta.61",
|
||||
"@electron-forge/maker-zip": "^6.0.0-beta.61",
|
||||
"@electron-forge/plugin-webpack": "^6.0.0-beta.61",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/json5": "^2.2.0",
|
||||
"@types/node": "^16.11.9",
|
||||
|
|
@ -93,27 +87,32 @@
|
|||
"pretest": "npm run tsc",
|
||||
"test": "cd lib && node modules/build windows64 && node modules/build ubuntu64 && node modules/build macos64"
|
||||
},
|
||||
"config": {
|
||||
"forge": {
|
||||
"packagerConfig": {},
|
||||
"makers": [
|
||||
"build": {
|
||||
"appId": "github.com/anidl",
|
||||
"mac": {
|
||||
"category": "public.app-category.developer-tools",
|
||||
"darkModeSupport": true
|
||||
},
|
||||
"dmg": {
|
||||
"iconSize": 160,
|
||||
"contents": [
|
||||
{
|
||||
"name": "@electron-forge/maker-squirrel",
|
||||
"config": {
|
||||
"name": "electron"
|
||||
}
|
||||
"x": 180,
|
||||
"y": 170
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-zip",
|
||||
"platforms": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-deb",
|
||||
"config": {}
|
||||
"x": 480,
|
||||
"y": 170,
|
||||
"type": "link",
|
||||
"path": "/Applications"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"target": [
|
||||
"deb"
|
||||
],
|
||||
"category": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
3
tsc.ts
3
tsc.ts
|
|
@ -18,7 +18,8 @@ if (!isTest)
|
|||
|
||||
if (!isGUI)
|
||||
buildIgnore = buildIgnore.concat([
|
||||
'./gui*'
|
||||
'./gui*',
|
||||
'./build*'
|
||||
])
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue