Skip to content

Commit

Permalink
allow disabling asar packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
Armaldio committed Jan 8, 2025
1 parent 0d00251 commit ac28fb2
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 52 deletions.
2 changes: 2 additions & 0 deletions assets/electron/template/app/config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @property {string} description
* @property {string} appCategoryType
* @property {string} icon
* @property {boolean} disableAsarPackaging
* @property {boolean} enableSteamSupport
* @property {number} steamGameId
*/
Expand All @@ -36,6 +37,7 @@ const config = {
customMainCode: '',
description: 'A simple Electron application',
electronVersion: '',
disableAsarPackaging: false,
enableDisableRendererBackgrounding: false,
enableInProcessGPU: false,
frame: true,
Expand Down
9 changes: 6 additions & 3 deletions assets/electron/template/app/forge.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ const config = require('./config.cjs')
module.exports = {
outDir: './out',
packagerConfig: {
asar: {
unpack: "*.{node,dll,so,lib,dylib}"
},
asar: config.disableAsarPackaging
? false
: {
// by default, unpack node, and libs files
unpack: '*.{node,dll,so,lib,dylib}'
},
name: config.name,
appBundleId: config.appBundleId,
appCopyright: config.appCopyright,
Expand Down
7 changes: 3 additions & 4 deletions src/shared/libs/plugin-core/pipelab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,9 @@ export interface ControlTypeMultiSelect extends ControlTypeBase {

export interface ControlTypeBoolean extends ControlTypeBase {
type: 'boolean'
// options: {
// value: boolean;
// onChange: (value: boolean) => void;
// };
// options?: {
// allowAuto?: boolean
// }
}

export interface ControlTypeCheckbox extends ControlTypeBase {
Expand Down
9 changes: 9 additions & 0 deletions src/shared/libs/plugin-electron/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ export const props = createAction({
label: 'Path to a file containing custom main code'
}
},
disableAsarPackaging: {
required: true,
label: 'Disable ASAR packaging',
value: false,
control: {
type: 'boolean'
},
description: 'Whether to to disable packaging project files in a single binary or not',
},

// Flags

Expand Down
1 change: 1 addition & 0 deletions src/shared/libs/plugin-electron/forge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export const forge = async (
customMainCode: '',
description: 'A simple Electron application',
electronVersion: '',
disableAsarPackaging: false,
enableDisableRendererBackgrounding: false,
enableInProcessGPU: false,
frame: true,
Expand Down
1 change: 1 addition & 0 deletions src/shared/libs/plugin-electron/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type ElectronConfiguration = {
appCopyright: string
appVersion: string
electronVersion: string
disableAsarPackaging: boolean
customMainCode: string
author: string
description: string
Expand Down
32 changes: 7 additions & 25 deletions src/shared/libs/plugin-tauri/forge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,25 +252,7 @@ export const forge = async (

const completeConfiguration = merge(
{
alwaysOnTop: false,
appBundleId: 'com.pipelab.app',
appCategoryType: '',
appCopyright: 'Copyright © 2024 Pipelab',
appVersion: '1.0.0',
author: 'Pipelab',
customMainCode: '',
description: 'A simple tauri application',
tauriVersion: '',
enableDisableRendererBackgrounding: false,
enableInProcessGPU: false,
frame: true,
fullscreen: false,
icon: '',
height: 600,
name: 'Pipelab',
toolbar: true,
transparent: false,
width: 800
name: 'Pipelab'
} satisfies TauriConfiguration,
inputs.configuration
) as TauriConfiguration
Expand All @@ -284,12 +266,12 @@ export const forge = async (
)

// copy custom main code
const destinationFile = join(destinationFolder, 'src', 'custom-main.js')
if (completeConfiguration.customMainCode) {
await cp(completeConfiguration.customMainCode, destinationFile)
} else {
await writeFile(destinationFile, 'console.log("No custom main code provided")')
}
// const destinationFile = join(destinationFolder, 'src', 'custom-main.js')
// if (completeConfiguration.customMainCode) {
// await cp(completeConfiguration.customMainCode, destinationFile)
// } else {
// await writeFile(destinationFile, 'console.log("No custom main code provided")')
// }

const shimsPaths = join(assets, 'shims')

Expand Down
20 changes: 0 additions & 20 deletions src/shared/libs/plugin-tauri/model.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
export type TauriConfiguration = {
name: string
appBundleId: string
appCopyright: string
appVersion: string
tauriVersion: string
customMainCode: string
author: string
description: string
width: number
height: number
fullscreen: boolean
frame: boolean
transparent: boolean
toolbar: boolean
alwaysOnTop: boolean
enableInProcessGPU: boolean
enableDisableRendererBackgrounding: boolean
icon: string
appCategoryType: string

// enableSteamSupport: boolean
}

0 comments on commit ac28fb2

Please sign in to comment.