2
0
mirror of https://github.com/frappe/books.git synced 2024-09-18 18:49:01 +00:00

Build config changed from .ts to .mjs to fix contents not being used properly

This commit is contained in:
Isaac GC 2024-02-06 20:17:04 -08:00
parent dd7cb43abc
commit d4b6c0d4f6
2 changed files with 22 additions and 9 deletions

View File

@ -8,6 +8,7 @@ import * as vite from 'vite';
import { getMainProcessCommonConfig } from './helpers.mjs'; import { getMainProcessCommonConfig } from './helpers.mjs';
import yargs from 'yargs'; import yargs from 'yargs';
import { hideBin } from 'yargs/helpers'; import { hideBin } from 'yargs/helpers';
import frappeBooksConfig from '../../electron-builder-config.mjs';
const dirname = path.dirname(fileURLToPath(import.meta.url)); const dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.join(dirname, '..', '..'); const root = path.join(dirname, '..', '..');
@ -153,12 +154,10 @@ async function packageApp() {
delete builderArgs[opt]; delete builderArgs[opt];
} }
let buildOptions = { let buildOptions = {
config: { config: frappeBooksConfig,
directories: { output: packageDirPath, app: buildDirPath },
files: ['**'],
extends: null,
},
...builderArgs, ...builderArgs,
}; };

View File

@ -1,4 +1,6 @@
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. * electron-builder doesn't look for the APPLE_TEAM_ID environment variable for some reason.
@ -6,7 +8,13 @@ import type { Configuration } from 'electron-builder';
* collection. See: https://github.com/electron-userland/electron-builder/issues/7812 * 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', productName: 'Frappe Books',
appId: 'io.frappe.books', appId: 'io.frappe.books',
asarUnpack: '**/*.node', asarUnpack: '**/*.node',
@ -15,6 +23,12 @@ const config: Configuration = {
{ from: 'translations', to: '../translations' }, { from: 'translations', to: '../translations' },
{ from: 'templates', to: '../templates' }, { from: 'templates', to: '../templates' },
], ],
files: '**',
extends: null,
directories: {
output: packageDirPath,
app: buildDirPath,
},
mac: { mac: {
type: 'distribution', type: 'distribution',
category: 'public.app-category.finance', category: 'public.app-category.finance',
@ -34,7 +48,7 @@ const config: Configuration = {
signDlls: true, signDlls: true,
icon: 'build/icon.ico', icon: 'build/icon.ico',
publish: ['github'], publish: ['github'],
target: ['portable', 'nsis'], target: ['nsis', 'portable'],
}, },
nsis: { nsis: {
oneClick: false, oneClick: false,
@ -52,4 +66,4 @@ const config: Configuration = {
}, },
}; };
export default config; export default frappeBooksConfig;