fix electron build

This commit is contained in:
Stewart Allen 2025-02-04 16:59:06 -05:00
commit ac8b9c86cb
5 changed files with 31 additions and 7 deletions

3
app.js
View file

@ -334,7 +334,7 @@ function init(mod) {
// load modules
lastmod(`${dir}/${root}`) && fs.readdirSync(`${dir}/${root}`).forEach(mdir => {
const modpath = `${root}/${mdir}`;
if (dir.charAt(0) === '.') return;
if (dir.charAt(0) === '.' && !ENV.single) return;
const stats = fs.lstatSync(`${mod.dir}/${modpath}`);
if (!(stats.isDirectory() || stats.isSymbolicLink())) return;
if (util.isfile(PATH.join(mod.dir,modpath,".disable"))) return;
@ -771,6 +771,7 @@ function getCachedFile(file, fn) {
} else {
logger.log({update_cache:filePath});
cacheData = fn(filePath);
// console.log(`NEW_CACHE_FILE: ${cachePath}`);
fs.writeFileSync(cachePath, cacheData);
}

View file

@ -10,7 +10,8 @@ const webTmp = path.join('tmp','web');
fs.copySync("web", webTmp, { dereference: true });
const modTmp = path.join('tmp','mod');
fs.existsSync("mod") && fs.copySync("mod", modTmp, { dereference: true, filter:(src,dst) => {
if (fs.existsSync("mod"))
fs.copySync("mod", modTmp, { dereference: true, filter:(src,dst) => {
const ok =
src === 'mod' ||
src.indexOf('mod/standalone') === 0 ||

View file

@ -342,7 +342,8 @@ self.kiri.load(api => {
}
function file_list() {
if (selected?.rec?.host) {
let { host, code, serial } = selected?.rec || {};
if (host && code && serial) {
filelist.selectedIndex = -1;
$('bbl_file_size').value =
$('bbl_file_date').value = '';

View file

@ -259,7 +259,7 @@ module.exports = async (server) => {
}
if (!(env.debug || env.electron)) {
util.log('no valid context for bambu');
util.log('not a valid context for bambu');
return;
}

View file

@ -86,13 +86,14 @@
"build-mac-intel": "npm run build -- --mac --x64",
"mklinks": "find src web -type l | xargs -I{} sh -c 'echo \"{},$(readlink {})\"' > links.csv",
"mac-verify": "spctl --assess -vv --type install dist/*/*.app",
"clear-cache": "rm -rf tmp/* data/cache/*",
"clear-cache": "rm -rf data/cache/* dist/ tmp/*",
"prebuild": "node bin/electron-pre.js",
"postbuild": "node bin/electron-post.js",
"preinstall": "node bin/install-pre.js; npx webpack --config bin/webpack-three.js"
},
"main": "app-el.js",
"build": {
"npmRebuild": false,
"appId": "space.grid.kiri",
"productName": "KiriMoto",
"artifactName": "KiriMoto-${os}-${arch}.${ext}",
@ -118,10 +119,30 @@
"**/*"
]
},
{
"from": "tmp/mod/node_modules",
"to": "mod/node_modules",
"filter": [
"**/*"
]
},
{
"from": "tmp/mods",
"to": "mods",
"filter": [
"**/*"
]
},
{
"from": "tmp/mods/node_modules",
"to": "mods/node_modules",
"filter": [
"**/*"
]
},
"bin/*",
"conf/**/*",
"data/**/*",
"dist/**/*",
"data/cache/**/*",
"app-el.js",
"app.js",
"package.json"