Skip to content

Commit

Permalink
build works
Browse files Browse the repository at this point in the history
  • Loading branch information
jooapa committed Sep 3, 2024
1 parent d3a6d1f commit b66736d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 29 deletions.
35 changes: 20 additions & 15 deletions compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,24 @@
os.system("npm run pray")

if build:
# debug mode off for now
with open("src/config.js", "r") as f:
lines = f.readlines()
with open("src/config.js", "w") as f:
for line in lines:
if "debug" in line and "=" in line:
f.write("const debug = false\n")
else:
f.write(line)

os.system("npm run build")

# Copy backend/build directory
backend_build_src = "backend/build"
backend_build_dst = "dist/win-unpacked/resources/build"
if os.path.exists(backend_build_dst):
shutil.rmtree(backend_build_dst)
shutil.copytree(backend_build_src, backend_build_dst)

# Copy src/app directory
src_app_src = "src/app"
src_app_dst = "dist/win-unpacked/resources/app"
if os.path.exists(src_app_dst):
shutil.rmtree(src_app_dst)
shutil.copytree(src_app_src, src_app_dst)


# debug mode on for now
with open("src/config.js", "r") as f:
lines = f.readlines()
with open("src/config.js", "w") as f:
for line in lines:
if "debug" in line and "=" in line:
f.write("const debug = true\n")
else:
f.write(line)
31 changes: 21 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,25 @@
"ps-tree": "^1.2.0"
},
"build": {
"appId": "com.jooapa.jseek",
"files": [
"src/*",
"backend/build/**/*",
"package.json"
],
"directories": {
"output": "dist"
}
"appId": "com.jooapa.jseek",
"files": [
"src/**/*",
"backend/build/jseek.exe",
"backend/build/Everything64.dll",
"package.json"
],
"extraFiles": [
{
"from": "backend/build/Everything64.dll",
"to": "resources/backend/Everything64.dll"
},
{
"from": "backend/build/jseek.exe",
"to": "resources/backend/jseek.exe"
}
],
"directories": {
"output": "dist"
}
}
}
}
6 changes: 4 additions & 2 deletions src/actions.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
const { spawn } = require('child_process');
const { debug } = require('./config');
const path = require('path');

let currentJseekProcess = null;

function search(query) {
let command;
if (debug) {
command = 'backend\\build\\jseek.exe ' + query;
command = 'backend/build/jseek.exe ' + query;
} else {
command = 'jseek ' + query;
command = path.join(__dirname, "..", "..", 'backend', 'jseek.exe') + ' ' + query;
console.log(command);
}

// Kill existing jseek process if running
Expand Down
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const os = require('os'); // Import the os module

const debug = true;
const debug = false

/// intesity: means how much the macro should be used in the search query, meaning how much it will lag the search
const Keywords = [
Expand Down
5 changes: 4 additions & 1 deletion src/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const {
ipcMain,
} = require('electron');

const path = require('path');

let mainWindow;

function getWindow() {
Expand Down Expand Up @@ -38,7 +40,8 @@ function createWindow() {
}
});

mainWindow.loadFile('app/app.html');
console.log('Loading HTML from:', path.join(__dirname, 'app/app.html'));
mainWindow.loadFile(path.join(__dirname, 'app/app.html'));

// Hide window on click outside
mainWindow.on('blur', () => {
Expand Down

0 comments on commit b66736d

Please sign in to comment.