Skip to content

Commit

Permalink
Build config changed from .ts to .mjs to fix contents not being used …
Browse files Browse the repository at this point in the history
…properly
  • Loading branch information
Isaac-GC committed Feb 7, 2024
1 parent dd7cb43 commit d4b6c0d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
9 changes: 4 additions & 5 deletions build/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as vite from 'vite';
import { getMainProcessCommonConfig } from './helpers.mjs';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import frappeBooksConfig from '../../electron-builder-config.mjs';

const dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.join(dirname, '..', '..');
Expand Down Expand Up @@ -153,12 +154,10 @@ async function packageApp() {
delete builderArgs[opt];
}



let buildOptions = {
config: {
directories: { output: packageDirPath, app: buildDirPath },
files: ['**'],
extends: null,
},
config: frappeBooksConfig,
...builderArgs,
};

Expand Down
22 changes: 18 additions & 4 deletions electron-builder.ts → electron-builder-config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import type { Configuration } from 'electron-builder';
// App is tagged with a .mjs extension to allow
import path from 'path';
import { fileURLToPath } from 'url';

/**
* electron-builder doesn't look for the APPLE_TEAM_ID environment variable for some reason.
* This workaround allows an environment variable to be added to the electron-builder.yml config
* collection. See: https://github.com/electron-userland/electron-builder/issues/7812
*/

const config: Configuration = {
const dirname = path.dirname(fileURLToPath(import.meta.url));
// const root = path.join(dirname, '..', '..');
const root = dirname; // redundant, but is meant to keep with the previous line
const buildDirPath = path.join(root, 'dist_electron', 'build');
const packageDirPath = path.join(root, 'dist_electron', 'bundled');

const frappeBooksConfig = {
productName: 'Frappe Books',
appId: 'io.frappe.books',
asarUnpack: '**/*.node',
Expand All @@ -15,6 +23,12 @@ const config: Configuration = {
{ from: 'translations', to: '../translations' },
{ from: 'templates', to: '../templates' },
],
files: '**',
extends: null,
directories: {
output: packageDirPath,
app: buildDirPath,
},
mac: {
type: 'distribution',
category: 'public.app-category.finance',
Expand All @@ -34,7 +48,7 @@ const config: Configuration = {
signDlls: true,
icon: 'build/icon.ico',
publish: ['github'],
target: ['portable', 'nsis'],
target: ['nsis', 'portable'],
},
nsis: {
oneClick: false,
Expand All @@ -52,4 +66,4 @@ const config: Configuration = {
},
};

export default config;
export default frappeBooksConfig;

0 comments on commit d4b6c0d

Please sign in to comment.