16 changed files with 12022 additions and 612 deletions
@ -1,3 +1,4 @@ |
|||||||
/node_modules |
/node_modules |
||||||
/dist |
/dist |
||||||
/.vscode |
/.vscode |
||||||
|
out/ |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
registry=https://registry.npmmirror.com |
||||||
|
electron_mirror=https://npmmirror.com/mirrors/electron/ |
||||||
|
electron_custom_dir={{ version }} |
||||||
|
|
||||||
|
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/ |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
{ |
||||||
|
"ExpandedNodes": [ |
||||||
|
"" |
||||||
|
], |
||||||
|
"SelectedNode": "\\package.json", |
||||||
|
"PreviewInSolutionExplorer": false |
||||||
|
} |
||||||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,12 @@ |
|||||||
|
{ |
||||||
|
"Version": 1, |
||||||
|
"WorkspaceRootPath": "D:\\company\\bestway\\code\\\u5149\u4F0F\\pc\\", |
||||||
|
"Documents": [], |
||||||
|
"DocumentGroupContainers": [ |
||||||
|
{ |
||||||
|
"Orientation": 0, |
||||||
|
"VerticalTabListWidth": 256, |
||||||
|
"DocumentGroups": [] |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,101 @@ |
|||||||
|
const { FusesPlugin } = require('@electron-forge/plugin-fuses'); |
||||||
|
const { MakerSquirrel } = require('@electron-forge/maker-squirrel'); |
||||||
|
const { FuseV1Options, FuseVersion } = require('@electron/fuses'); |
||||||
|
const { convertVersion, createWindowsInstaller } = require('electron-winstaller'); |
||||||
|
const fs = require('fs-extra'); |
||||||
|
const os = require('node:os'); |
||||||
|
const path = require('node:path'); |
||||||
|
|
||||||
|
class AsciiOutputSquirrelMaker extends MakerSquirrel { |
||||||
|
async make({ dir, makeDir, targetArch, packageJSON, appName, forgeConfig }) { |
||||||
|
const finalOutPath = path.resolve(makeDir, `squirrel.windows/${targetArch}`); |
||||||
|
await this.ensureDirectory(finalOutPath); |
||||||
|
|
||||||
|
const tmpAppDir = await fs.mkdtemp(path.join(os.tmpdir(), 'squirrel-maker-app-')); |
||||||
|
const tmpOutPath = await fs.mkdtemp(path.join(os.tmpdir(), 'squirrel-maker-out-')); |
||||||
|
await fs.copy(dir, tmpAppDir); |
||||||
|
|
||||||
|
try { |
||||||
|
const winstallerConfig = { |
||||||
|
name: typeof packageJSON.name === 'string' |
||||||
|
? packageJSON.name.replace(/-/g, '_') |
||||||
|
: undefined, |
||||||
|
title: appName, |
||||||
|
noMsi: true, |
||||||
|
exe: `${forgeConfig.packagerConfig.executableName || appName}.exe`, |
||||||
|
setupExe: `${appName}-${packageJSON.version} Setup.exe`, |
||||||
|
...this.config, |
||||||
|
appDirectory: tmpAppDir, |
||||||
|
outputDirectory: tmpOutPath, |
||||||
|
}; |
||||||
|
|
||||||
|
await createWindowsInstaller(winstallerConfig); |
||||||
|
await fs.copy(tmpOutPath, finalOutPath, { overwrite: true }); |
||||||
|
|
||||||
|
const nupkgVersion = convertVersion(packageJSON.version); |
||||||
|
const artifacts = [ |
||||||
|
path.resolve(finalOutPath, 'RELEASES'), |
||||||
|
path.resolve(finalOutPath, winstallerConfig.setupExe || `${appName}Setup.exe`), |
||||||
|
path.resolve(finalOutPath, `${winstallerConfig.name}-${nupkgVersion}-full.nupkg`), |
||||||
|
]; |
||||||
|
const deltaPath = path.resolve(finalOutPath, `${winstallerConfig.name}-${nupkgVersion}-delta.nupkg`); |
||||||
|
if ( |
||||||
|
winstallerConfig.remoteReleases && |
||||||
|
!winstallerConfig.noDelta && |
||||||
|
await fs.pathExists(deltaPath) |
||||||
|
) { |
||||||
|
artifacts.push(deltaPath); |
||||||
|
} |
||||||
|
const msiPath = path.resolve(finalOutPath, winstallerConfig.setupMsi || `${appName}Setup.msi`); |
||||||
|
if (!winstallerConfig.noMsi && await fs.pathExists(msiPath)) { |
||||||
|
artifacts.push(msiPath); |
||||||
|
} |
||||||
|
|
||||||
|
return artifacts; |
||||||
|
} finally { |
||||||
|
await fs.remove(tmpAppDir); |
||||||
|
await fs.remove(tmpOutPath); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
packagerConfig: { |
||||||
|
asar: true, |
||||||
|
}, |
||||||
|
rebuildConfig: { |
||||||
|
onlyModules: [], |
||||||
|
}, |
||||||
|
makers: [ |
||||||
|
new AsciiOutputSquirrelMaker(), |
||||||
|
{ |
||||||
|
name: '@electron-forge/maker-zip', |
||||||
|
platforms: ['darwin'], |
||||||
|
}, |
||||||
|
{ |
||||||
|
name: '@electron-forge/maker-deb', |
||||||
|
config: {}, |
||||||
|
}, |
||||||
|
{ |
||||||
|
name: '@electron-forge/maker-rpm', |
||||||
|
config: {}, |
||||||
|
}, |
||||||
|
], |
||||||
|
plugins: [ |
||||||
|
{ |
||||||
|
name: '@electron-forge/plugin-auto-unpack-natives', |
||||||
|
config: {}, |
||||||
|
}, |
||||||
|
// Fuses are used to enable/disable various Electron functionality
|
||||||
|
// at package time, before code signing the application
|
||||||
|
new FusesPlugin({ |
||||||
|
version: FuseVersion.V1, |
||||||
|
[FuseV1Options.RunAsNode]: false, |
||||||
|
[FuseV1Options.EnableCookieEncryption]: true, |
||||||
|
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false, |
||||||
|
[FuseV1Options.EnableNodeCliInspectArguments]: false, |
||||||
|
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true, |
||||||
|
[FuseV1Options.OnlyLoadAppFromAsar]: true, |
||||||
|
}), |
||||||
|
], |
||||||
|
}; |
||||||
Loading…
Reference in new issue