projax 1.0.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/database.d.ts +34 -0
- package/dist/api/database.d.ts.map +1 -0
- package/dist/api/database.js +318 -0
- package/dist/api/database.js.map +1 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +130 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/migrate.d.ts +2 -0
- package/dist/api/migrate.d.ts.map +1 -0
- package/dist/api/migrate.js +158 -0
- package/dist/api/migrate.js.map +1 -0
- package/dist/api/package.json +27 -0
- package/dist/api/routes/index.d.ts +3 -0
- package/dist/api/routes/index.d.ts.map +1 -0
- package/dist/api/routes/index.js +17 -0
- package/dist/api/routes/index.js.map +1 -0
- package/dist/api/routes/projects.d.ts +3 -0
- package/dist/api/routes/projects.d.ts.map +1 -0
- package/dist/api/routes/projects.js +198 -0
- package/dist/api/routes/projects.js.map +1 -0
- package/dist/api/routes/settings.d.ts +3 -0
- package/dist/api/routes/settings.d.ts.map +1 -0
- package/dist/api/routes/settings.js +33 -0
- package/dist/api/routes/settings.js.map +1 -0
- package/dist/api/services/scanner.d.ts +9 -0
- package/dist/api/services/scanner.d.ts.map +1 -0
- package/dist/api/services/scanner.js +172 -0
- package/dist/api/services/scanner.js.map +1 -0
- package/dist/api/types.d.ts +48 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +3 -0
- package/dist/api/types.js.map +1 -0
- package/dist/core/database.d.ts +15 -5
- package/dist/core/database.js +136 -208
- package/dist/core/detector.d.ts +5 -0
- package/dist/core/detector.js +135 -0
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.js +2 -4
- package/dist/core/scanner.js +2 -105
- package/dist/core/settings.d.ts +50 -0
- package/dist/core/settings.js +102 -0
- package/dist/electron/main.js +86 -28
- package/dist/electron/port-scanner.js +4 -4
- package/dist/electron/preload.d.ts +1 -1
- package/dist/electron/renderer/assets/index-7KIJIiIM.js +42 -0
- package/dist/electron/renderer/assets/{index-CdMlFqhB.js → index-BRymlmJj.js} +10 -10
- package/dist/electron/renderer/assets/{index-DohAcUCg.css → index-ezVMxZrM.css} +1 -1
- package/dist/electron/renderer/index.html +2 -2
- package/dist/electron/script-runner.js +4 -4
- package/dist/index.js +240 -75
- package/dist/port-scanner.js +4 -4
- package/dist/script-runner.js +4 -4
- package/package.json +13 -11
- package/dist/electron/renderer/assets/index-BZ6USRnW.js +0 -42
- package/dist/electron/renderer/assets/index-DNtxfrZe.js +0 -42
- package/dist/electron/renderer/assets/index-khk3K-qG.css +0 -1
package/dist/core/scanner.js
CHANGED
|
@@ -1,114 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.scanProject = scanProject;
|
|
37
4
|
exports.scanAllProjects = scanAllProjects;
|
|
38
|
-
const fs = __importStar(require("fs"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
|
-
const detector_1 = require("./detector");
|
|
41
5
|
const database_1 = require("./database");
|
|
42
6
|
function scanProject(projectId) {
|
|
43
|
-
|
|
44
|
-
const project = db.getProject(projectId);
|
|
45
|
-
if (!project) {
|
|
46
|
-
throw new Error(`Project with id ${projectId} not found`);
|
|
47
|
-
}
|
|
48
|
-
if (!fs.existsSync(project.path)) {
|
|
49
|
-
throw new Error(`Project path does not exist: ${project.path}`);
|
|
50
|
-
}
|
|
51
|
-
// Detect framework first
|
|
52
|
-
const framework = (0, detector_1.detectTestFramework)(project.path);
|
|
53
|
-
// Remove existing tests for this project
|
|
54
|
-
db.removeTestsByProject(projectId);
|
|
55
|
-
// Scan for test files
|
|
56
|
-
const tests = [];
|
|
57
|
-
const testFiles = findTestFiles(project.path, framework);
|
|
58
|
-
for (const testFile of testFiles) {
|
|
59
|
-
const relativePath = path.relative(project.path, testFile);
|
|
60
|
-
const test = db.addTest(projectId, relativePath, framework);
|
|
61
|
-
tests.push(test);
|
|
62
|
-
}
|
|
63
|
-
// Update last scanned timestamp
|
|
64
|
-
db.updateProjectLastScanned(projectId);
|
|
65
|
-
return {
|
|
66
|
-
project: db.getProject(projectId),
|
|
67
|
-
testsFound: tests.length,
|
|
68
|
-
tests,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function findTestFiles(dir, framework, results = []) {
|
|
72
|
-
if (!fs.existsSync(dir)) {
|
|
73
|
-
return results;
|
|
74
|
-
}
|
|
75
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
76
|
-
for (const entry of entries) {
|
|
77
|
-
const fullPath = path.join(dir, entry.name);
|
|
78
|
-
// Skip node_modules, .git, and other common ignore directories
|
|
79
|
-
if (entry.isDirectory()) {
|
|
80
|
-
if (entry.name === 'node_modules' ||
|
|
81
|
-
entry.name === '.git' ||
|
|
82
|
-
entry.name === 'dist' ||
|
|
83
|
-
entry.name === 'build' ||
|
|
84
|
-
entry.name === '.next' ||
|
|
85
|
-
entry.name === '.nuxt' ||
|
|
86
|
-
entry.name === 'coverage' ||
|
|
87
|
-
entry.name.startsWith('.')) {
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
findTestFiles(fullPath, framework, results);
|
|
91
|
-
}
|
|
92
|
-
else if (entry.isFile()) {
|
|
93
|
-
if ((0, detector_1.isTestFile)(fullPath, framework)) {
|
|
94
|
-
results.push(fullPath);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return results;
|
|
7
|
+
return (0, database_1.getDatabaseManager)().scanProject(projectId);
|
|
99
8
|
}
|
|
100
9
|
function scanAllProjects() {
|
|
101
|
-
|
|
102
|
-
const projects = db.getAllProjects();
|
|
103
|
-
const results = [];
|
|
104
|
-
for (const project of projects) {
|
|
105
|
-
try {
|
|
106
|
-
const result = scanProject(project.id);
|
|
107
|
-
results.push(result);
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
console.error(`Error scanning project ${project.name}:`, error);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return results;
|
|
10
|
+
return (0, database_1.getDatabaseManager)().scanAllProjects();
|
|
114
11
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type EditorType = 'vscode' | 'cursor' | 'windsurf' | 'zed' | 'custom';
|
|
2
|
+
export type BrowserType = 'chrome' | 'firefox' | 'safari' | 'edge' | 'custom';
|
|
3
|
+
export interface EditorSettings {
|
|
4
|
+
type: EditorType;
|
|
5
|
+
customPath?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface BrowserSettings {
|
|
8
|
+
type: BrowserType;
|
|
9
|
+
customPath?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AppSettings {
|
|
12
|
+
editor: EditorSettings;
|
|
13
|
+
browser: BrowserSettings;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get a setting value by key
|
|
17
|
+
*/
|
|
18
|
+
export declare function getSetting(key: string): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Set a setting value by key
|
|
21
|
+
*/
|
|
22
|
+
export declare function setSetting(key: string, value: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get all settings as a key-value object
|
|
25
|
+
*/
|
|
26
|
+
export declare function getAllSettings(): Record<string, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Get editor settings
|
|
29
|
+
*/
|
|
30
|
+
export declare function getEditorSettings(): EditorSettings;
|
|
31
|
+
/**
|
|
32
|
+
* Set editor settings
|
|
33
|
+
*/
|
|
34
|
+
export declare function setEditorSettings(settings: EditorSettings): void;
|
|
35
|
+
/**
|
|
36
|
+
* Get browser settings
|
|
37
|
+
*/
|
|
38
|
+
export declare function getBrowserSettings(): BrowserSettings;
|
|
39
|
+
/**
|
|
40
|
+
* Set browser settings
|
|
41
|
+
*/
|
|
42
|
+
export declare function setBrowserSettings(settings: BrowserSettings): void;
|
|
43
|
+
/**
|
|
44
|
+
* Get all app settings
|
|
45
|
+
*/
|
|
46
|
+
export declare function getAppSettings(): AppSettings;
|
|
47
|
+
/**
|
|
48
|
+
* Set all app settings
|
|
49
|
+
*/
|
|
50
|
+
export declare function setAppSettings(settings: AppSettings): void;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSetting = getSetting;
|
|
4
|
+
exports.setSetting = setSetting;
|
|
5
|
+
exports.getAllSettings = getAllSettings;
|
|
6
|
+
exports.getEditorSettings = getEditorSettings;
|
|
7
|
+
exports.setEditorSettings = setEditorSettings;
|
|
8
|
+
exports.getBrowserSettings = getBrowserSettings;
|
|
9
|
+
exports.setBrowserSettings = setBrowserSettings;
|
|
10
|
+
exports.getAppSettings = getAppSettings;
|
|
11
|
+
exports.setAppSettings = setAppSettings;
|
|
12
|
+
const database_1 = require("./database");
|
|
13
|
+
const DEFAULT_SETTINGS = {
|
|
14
|
+
editor: {
|
|
15
|
+
type: 'vscode',
|
|
16
|
+
},
|
|
17
|
+
browser: {
|
|
18
|
+
type: 'chrome',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Get a setting value by key
|
|
23
|
+
*/
|
|
24
|
+
function getSetting(key) {
|
|
25
|
+
return (0, database_1.getDatabaseManager)().getSetting(key);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Set a setting value by key
|
|
29
|
+
*/
|
|
30
|
+
function setSetting(key, value) {
|
|
31
|
+
(0, database_1.getDatabaseManager)().setSetting(key, value);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get all settings as a key-value object
|
|
35
|
+
*/
|
|
36
|
+
function getAllSettings() {
|
|
37
|
+
return (0, database_1.getDatabaseManager)().getAllSettings();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get editor settings
|
|
41
|
+
*/
|
|
42
|
+
function getEditorSettings() {
|
|
43
|
+
const db = (0, database_1.getDatabaseManager)();
|
|
44
|
+
const type = db.getSetting('editor.type') || DEFAULT_SETTINGS.editor.type;
|
|
45
|
+
const customPath = db.getSetting('editor.customPath') || undefined;
|
|
46
|
+
return {
|
|
47
|
+
type,
|
|
48
|
+
customPath,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Set editor settings
|
|
53
|
+
*/
|
|
54
|
+
function setEditorSettings(settings) {
|
|
55
|
+
const db = (0, database_1.getDatabaseManager)();
|
|
56
|
+
db.setSetting('editor.type', settings.type);
|
|
57
|
+
if (settings.customPath) {
|
|
58
|
+
db.setSetting('editor.customPath', settings.customPath);
|
|
59
|
+
}
|
|
60
|
+
// Note: Removing settings is not yet supported via the API
|
|
61
|
+
// Setting to empty string would achieve similar effect if needed
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get browser settings
|
|
65
|
+
*/
|
|
66
|
+
function getBrowserSettings() {
|
|
67
|
+
const db = (0, database_1.getDatabaseManager)();
|
|
68
|
+
const type = db.getSetting('browser.type') || DEFAULT_SETTINGS.browser.type;
|
|
69
|
+
const customPath = db.getSetting('browser.customPath') || undefined;
|
|
70
|
+
return {
|
|
71
|
+
type,
|
|
72
|
+
customPath,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Set browser settings
|
|
77
|
+
*/
|
|
78
|
+
function setBrowserSettings(settings) {
|
|
79
|
+
const db = (0, database_1.getDatabaseManager)();
|
|
80
|
+
db.setSetting('browser.type', settings.type);
|
|
81
|
+
if (settings.customPath) {
|
|
82
|
+
db.setSetting('browser.customPath', settings.customPath);
|
|
83
|
+
}
|
|
84
|
+
// Note: Removing settings is not yet supported via the API
|
|
85
|
+
// Setting to empty string would achieve similar effect if needed
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Get all app settings
|
|
89
|
+
*/
|
|
90
|
+
function getAppSettings() {
|
|
91
|
+
return {
|
|
92
|
+
editor: getEditorSettings(),
|
|
93
|
+
browser: getBrowserSettings(),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Set all app settings
|
|
98
|
+
*/
|
|
99
|
+
function setAppSettings(settings) {
|
|
100
|
+
setEditorSettings(settings.editor);
|
|
101
|
+
setBrowserSettings(settings.browser);
|
|
102
|
+
}
|
package/dist/electron/main.js
CHANGED
|
@@ -36,24 +36,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
const electron_1 = require("electron");
|
|
37
37
|
const path = __importStar(require("path"));
|
|
38
38
|
const fs = __importStar(require("fs"));
|
|
39
|
-
|
|
39
|
+
const child_process_1 = require("child_process");
|
|
40
|
+
// Import from bundled core in CLI package
|
|
40
41
|
let coreModule;
|
|
41
42
|
try {
|
|
42
|
-
// Try relative import first (when bundled in CLI: dist/electron/main.js -> dist
|
|
43
|
-
coreModule = require('
|
|
43
|
+
// Try relative import first (when bundled in CLI: dist/electron/main.js -> ../../core/dist)
|
|
44
|
+
coreModule = require('../../core/dist');
|
|
44
45
|
}
|
|
45
46
|
catch {
|
|
46
47
|
try {
|
|
47
|
-
// Try alternative path (local development: packages/
|
|
48
|
-
coreModule = require('../../
|
|
48
|
+
// Try alternative path (local development: packages/desktop/dist/main.js -> ../../core/dist)
|
|
49
|
+
coreModule = require('../../core/dist');
|
|
49
50
|
}
|
|
50
51
|
catch {
|
|
51
|
-
//
|
|
52
|
-
coreModule = require('
|
|
52
|
+
// Last try
|
|
53
|
+
coreModule = require('../../../core/dist');
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
const { getDatabaseManager, getAllProjects, addProject, removeProject, scanProject, scanAllProjects, getTestsByProject, } = coreModule;
|
|
56
57
|
let mainWindow = null;
|
|
58
|
+
let apiProcess = null;
|
|
57
59
|
// Prevent multiple instances
|
|
58
60
|
const gotTheLock = electron_1.app.requestSingleInstanceLock();
|
|
59
61
|
if (!gotTheLock) {
|
|
@@ -93,7 +95,7 @@ else {
|
|
|
93
95
|
}
|
|
94
96
|
else {
|
|
95
97
|
// Try bundled renderer path first (when bundled in CLI: dist/electron/renderer/index.html)
|
|
96
|
-
// Then try local dev path (packages/
|
|
98
|
+
// Then try local dev path (packages/desktop/dist/renderer/index.html)
|
|
97
99
|
const bundledRenderer = path.join(__dirname, 'renderer', 'index.html');
|
|
98
100
|
const localRenderer = path.join(__dirname, '..', 'renderer', 'index.html');
|
|
99
101
|
if (fs.existsSync(bundledRenderer)) {
|
|
@@ -113,7 +115,49 @@ else {
|
|
|
113
115
|
mainWindow = null;
|
|
114
116
|
});
|
|
115
117
|
}
|
|
118
|
+
// Start API server
|
|
119
|
+
function startAPIServer() {
|
|
120
|
+
try {
|
|
121
|
+
// Try to find API server in various locations
|
|
122
|
+
const apiPaths = [
|
|
123
|
+
path.join(__dirname, '..', '..', '..', 'api', 'dist', 'index.js'),
|
|
124
|
+
path.join(__dirname, '..', '..', 'api', 'dist', 'index.js'),
|
|
125
|
+
path.join(process.cwd(), 'packages', 'api', 'dist', 'index.js'),
|
|
126
|
+
];
|
|
127
|
+
let apiPath = null;
|
|
128
|
+
for (const p of apiPaths) {
|
|
129
|
+
if (fs.existsSync(p)) {
|
|
130
|
+
apiPath = p;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!apiPath) {
|
|
135
|
+
console.warn('API server not found. Some features may not work.');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
console.log('Starting API server...');
|
|
139
|
+
apiProcess = (0, child_process_1.spawn)('node', [apiPath], {
|
|
140
|
+
detached: false,
|
|
141
|
+
stdio: 'pipe',
|
|
142
|
+
env: { ...process.env },
|
|
143
|
+
});
|
|
144
|
+
apiProcess.stdout?.on('data', (data) => {
|
|
145
|
+
console.log(`[API] ${data.toString().trim()}`);
|
|
146
|
+
});
|
|
147
|
+
apiProcess.stderr?.on('data', (data) => {
|
|
148
|
+
console.error(`[API Error] ${data.toString().trim()}`);
|
|
149
|
+
});
|
|
150
|
+
apiProcess.on('exit', (code) => {
|
|
151
|
+
console.log(`API server exited with code ${code}`);
|
|
152
|
+
apiProcess = null;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
console.error('Failed to start API server:', error);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
116
159
|
electron_1.app.whenReady().then(() => {
|
|
160
|
+
startAPIServer();
|
|
117
161
|
createWindow();
|
|
118
162
|
electron_1.app.on('activate', () => {
|
|
119
163
|
// On macOS, re-create window when dock icon is clicked and no windows are open
|
|
@@ -127,10 +171,24 @@ else {
|
|
|
127
171
|
});
|
|
128
172
|
}
|
|
129
173
|
electron_1.app.on('window-all-closed', () => {
|
|
174
|
+
// Kill API server
|
|
175
|
+
if (apiProcess) {
|
|
176
|
+
console.log('Stopping API server...');
|
|
177
|
+
apiProcess.kill();
|
|
178
|
+
apiProcess = null;
|
|
179
|
+
}
|
|
130
180
|
if (process.platform !== 'darwin') {
|
|
131
181
|
electron_1.app.quit();
|
|
132
182
|
}
|
|
133
183
|
});
|
|
184
|
+
electron_1.app.on('before-quit', () => {
|
|
185
|
+
// Kill API server before quitting
|
|
186
|
+
if (apiProcess) {
|
|
187
|
+
console.log('Stopping API server...');
|
|
188
|
+
apiProcess.kill();
|
|
189
|
+
apiProcess = null;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
134
192
|
// IPC Handlers
|
|
135
193
|
electron_1.ipcMain.handle('get-projects', async () => {
|
|
136
194
|
try {
|
|
@@ -218,9 +276,9 @@ electron_1.ipcMain.handle('rename-project', async (_, projectId, newName) => {
|
|
|
218
276
|
// Get project scripts
|
|
219
277
|
electron_1.ipcMain.handle('get-project-scripts', async (_, projectPath) => {
|
|
220
278
|
// Try bundled path first (when bundled in CLI: dist/electron/main.js -> dist/script-runner.js)
|
|
221
|
-
// Then try local dev path (packages/
|
|
279
|
+
// Then try local dev path (packages/desktop/dist/main.js -> packages/cli/dist/script-runner.js)
|
|
222
280
|
const bundledScriptRunnerPath = path.join(__dirname, '..', 'script-runner.js');
|
|
223
|
-
const localScriptRunnerPath = path.join(__dirname, '..', '..', '
|
|
281
|
+
const localScriptRunnerPath = path.join(__dirname, '..', '..', 'cli', 'dist', 'script-runner.js');
|
|
224
282
|
let scriptRunnerPath;
|
|
225
283
|
if (fs.existsSync(bundledScriptRunnerPath)) {
|
|
226
284
|
scriptRunnerPath = bundledScriptRunnerPath;
|
|
@@ -243,9 +301,9 @@ electron_1.ipcMain.handle('get-project-scripts', async (_, projectPath) => {
|
|
|
243
301
|
// Run script
|
|
244
302
|
electron_1.ipcMain.handle('run-script', async (_, projectPath, scriptName, args = [], background = false) => {
|
|
245
303
|
// Try bundled path first (when bundled in CLI: dist/electron/main.js -> dist/script-runner.js)
|
|
246
|
-
// Then try local dev path (packages/
|
|
304
|
+
// Then try local dev path (packages/desktop/dist/main.js -> packages/cli/dist/script-runner.js)
|
|
247
305
|
const bundledScriptRunnerPath = path.join(__dirname, '..', 'script-runner.js');
|
|
248
|
-
const localScriptRunnerPath = path.join(__dirname, '..', '..', '
|
|
306
|
+
const localScriptRunnerPath = path.join(__dirname, '..', '..', 'cli', 'dist', 'script-runner.js');
|
|
249
307
|
let scriptRunnerPath;
|
|
250
308
|
if (fs.existsSync(bundledScriptRunnerPath)) {
|
|
251
309
|
scriptRunnerPath = bundledScriptRunnerPath;
|
|
@@ -266,9 +324,9 @@ electron_1.ipcMain.handle('run-script', async (_, projectPath, scriptName, args
|
|
|
266
324
|
// Scan ports
|
|
267
325
|
electron_1.ipcMain.handle('scan-project-ports', async (_, projectId) => {
|
|
268
326
|
// Try bundled path first (when bundled in CLI: dist/electron/main.js -> dist/port-scanner.js)
|
|
269
|
-
// Then try local dev path (packages/
|
|
327
|
+
// Then try local dev path (packages/desktop/dist/main.js -> packages/cli/dist/port-scanner.js)
|
|
270
328
|
const bundledPortScannerPath = path.join(__dirname, '..', 'port-scanner.js');
|
|
271
|
-
const localPortScannerPath = path.join(__dirname, '..', '..', '
|
|
329
|
+
const localPortScannerPath = path.join(__dirname, '..', '..', 'cli', 'dist', 'port-scanner.js');
|
|
272
330
|
let portScannerPath;
|
|
273
331
|
if (fs.existsSync(bundledPortScannerPath)) {
|
|
274
332
|
portScannerPath = bundledPortScannerPath;
|
|
@@ -283,9 +341,9 @@ electron_1.ipcMain.handle('scan-project-ports', async (_, projectId) => {
|
|
|
283
341
|
});
|
|
284
342
|
electron_1.ipcMain.handle('scan-all-ports', async () => {
|
|
285
343
|
// Try bundled path first (when bundled in CLI: dist/electron/main.js -> dist/port-scanner.js)
|
|
286
|
-
// Then try local dev path (packages/
|
|
344
|
+
// Then try local dev path (packages/desktop/dist/main.js -> packages/cli/dist/port-scanner.js)
|
|
287
345
|
const bundledPortScannerPath = path.join(__dirname, '..', 'port-scanner.js');
|
|
288
|
-
const localPortScannerPath = path.join(__dirname, '..', '..', '
|
|
346
|
+
const localPortScannerPath = path.join(__dirname, '..', '..', 'cli', 'dist', 'port-scanner.js');
|
|
289
347
|
let portScannerPath;
|
|
290
348
|
if (fs.existsSync(bundledPortScannerPath)) {
|
|
291
349
|
portScannerPath = bundledPortScannerPath;
|
|
@@ -311,9 +369,9 @@ electron_1.ipcMain.handle('get-project-ports', async (_, projectId) => {
|
|
|
311
369
|
// Get running processes
|
|
312
370
|
electron_1.ipcMain.handle('get-running-processes', async () => {
|
|
313
371
|
// Try bundled path first (when bundled in CLI: dist/electron/main.js -> dist/script-runner.js)
|
|
314
|
-
// Then try local dev path (packages/
|
|
372
|
+
// Then try local dev path (packages/desktop/dist/main.js -> packages/cli/dist/script-runner.js)
|
|
315
373
|
const bundledScriptRunnerPath = path.join(__dirname, '..', 'script-runner.js');
|
|
316
|
-
const localScriptRunnerPath = path.join(__dirname, '..', '..', '
|
|
374
|
+
const localScriptRunnerPath = path.join(__dirname, '..', '..', 'cli', 'dist', 'script-runner.js');
|
|
317
375
|
let scriptRunnerPath;
|
|
318
376
|
if (fs.existsSync(bundledScriptRunnerPath)) {
|
|
319
377
|
scriptRunnerPath = bundledScriptRunnerPath;
|
|
@@ -327,9 +385,9 @@ electron_1.ipcMain.handle('get-running-processes', async () => {
|
|
|
327
385
|
// Stop script by PID
|
|
328
386
|
electron_1.ipcMain.handle('stop-script', async (_, pid) => {
|
|
329
387
|
// Try bundled path first (when bundled in CLI: dist/electron/main.js -> dist/script-runner.js)
|
|
330
|
-
// Then try local dev path (packages/
|
|
388
|
+
// Then try local dev path (packages/desktop/dist/main.js -> packages/cli/dist/script-runner.js)
|
|
331
389
|
const bundledScriptRunnerPath = path.join(__dirname, '..', 'script-runner.js');
|
|
332
|
-
const localScriptRunnerPath = path.join(__dirname, '..', '..', '
|
|
390
|
+
const localScriptRunnerPath = path.join(__dirname, '..', '..', 'cli', 'dist', 'script-runner.js');
|
|
333
391
|
let scriptRunnerPath;
|
|
334
392
|
if (fs.existsSync(bundledScriptRunnerPath)) {
|
|
335
393
|
scriptRunnerPath = bundledScriptRunnerPath;
|
|
@@ -343,9 +401,9 @@ electron_1.ipcMain.handle('stop-script', async (_, pid) => {
|
|
|
343
401
|
// Stop all processes for a project
|
|
344
402
|
electron_1.ipcMain.handle('stop-project', async (_, projectPath) => {
|
|
345
403
|
// Try bundled path first (when bundled in CLI: dist/electron/main.js -> dist/script-runner.js)
|
|
346
|
-
// Then try local dev path (packages/
|
|
404
|
+
// Then try local dev path (packages/desktop/dist/main.js -> packages/cli/dist/script-runner.js)
|
|
347
405
|
const bundledScriptRunnerPath = path.join(__dirname, '..', 'script-runner.js');
|
|
348
|
-
const localScriptRunnerPath = path.join(__dirname, '..', '..', '
|
|
406
|
+
const localScriptRunnerPath = path.join(__dirname, '..', '..', 'cli', 'dist', 'script-runner.js');
|
|
349
407
|
let scriptRunnerPath;
|
|
350
408
|
if (fs.existsSync(bundledScriptRunnerPath)) {
|
|
351
409
|
scriptRunnerPath = bundledScriptRunnerPath;
|
|
@@ -359,7 +417,7 @@ electron_1.ipcMain.handle('stop-project', async (_, projectPath) => {
|
|
|
359
417
|
// Open URL in browser
|
|
360
418
|
electron_1.ipcMain.handle('open-url', async (_, url) => {
|
|
361
419
|
// Try bundled path first (when bundled in CLI: dist/electron/main.js -> dist/core)
|
|
362
|
-
// Then try local dev path (packages/
|
|
420
|
+
// Then try local dev path (packages/desktop/dist/main.js -> packages/core/dist)
|
|
363
421
|
const bundledCorePath = path.join(__dirname, '..', 'core');
|
|
364
422
|
const localCorePath = path.join(__dirname, '..', '..', '..', 'core', 'dist');
|
|
365
423
|
let corePath;
|
|
@@ -449,7 +507,7 @@ electron_1.ipcMain.handle('open-url', async (_, url) => {
|
|
|
449
507
|
// Open project in editor
|
|
450
508
|
electron_1.ipcMain.handle('open-in-editor', async (_, projectPath) => {
|
|
451
509
|
// Try bundled path first (when bundled in CLI: dist/electron/main.js -> dist/core)
|
|
452
|
-
// Then try local dev path (packages/
|
|
510
|
+
// Then try local dev path (packages/desktop/dist/main.js -> packages/core/dist)
|
|
453
511
|
const bundledCorePath = path.join(__dirname, '..', 'core');
|
|
454
512
|
const localCorePath = path.join(__dirname, '..', '..', '..', 'core', 'dist');
|
|
455
513
|
let corePath;
|
|
@@ -501,12 +559,12 @@ electron_1.ipcMain.handle('get-settings', async () => {
|
|
|
501
559
|
}
|
|
502
560
|
catch {
|
|
503
561
|
try {
|
|
504
|
-
// Try alternative path (local development: packages/
|
|
562
|
+
// Try alternative path (local development: packages/desktop/dist/main.js -> packages/cli/dist/core)
|
|
505
563
|
settingsModule = require('../../cli/dist/core');
|
|
506
564
|
}
|
|
507
565
|
catch {
|
|
508
566
|
// Fallback to package import
|
|
509
|
-
settingsModule = require('
|
|
567
|
+
settingsModule = require('projax-core');
|
|
510
568
|
}
|
|
511
569
|
}
|
|
512
570
|
const { getAppSettings } = settingsModule;
|
|
@@ -528,12 +586,12 @@ electron_1.ipcMain.handle('save-settings', async (_, settings) => {
|
|
|
528
586
|
}
|
|
529
587
|
catch {
|
|
530
588
|
try {
|
|
531
|
-
// Try alternative path (local development: packages/
|
|
589
|
+
// Try alternative path (local development: packages/desktop/dist/main.js -> packages/cli/dist/core)
|
|
532
590
|
settingsModule = require('../../cli/dist/core');
|
|
533
591
|
}
|
|
534
592
|
catch {
|
|
535
593
|
// Fallback to package import
|
|
536
|
-
settingsModule = require('
|
|
594
|
+
settingsModule = require('projax-core');
|
|
537
595
|
}
|
|
538
596
|
}
|
|
539
597
|
const { setAppSettings } = settingsModule;
|
|
@@ -36,14 +36,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.scanProjectPorts = scanProjectPorts;
|
|
37
37
|
exports.scanAllProjectPorts = scanAllProjectPorts;
|
|
38
38
|
exports.shouldRescanPorts = shouldRescanPorts;
|
|
39
|
-
const
|
|
39
|
+
const projax_core_1 = require("projax-core");
|
|
40
40
|
const port_extractor_1 = require("./port-extractor");
|
|
41
41
|
const fs = __importStar(require("fs"));
|
|
42
42
|
/**
|
|
43
43
|
* Scan and index ports for a specific project
|
|
44
44
|
*/
|
|
45
45
|
async function scanProjectPorts(projectId) {
|
|
46
|
-
const db = (0,
|
|
46
|
+
const db = (0, projax_core_1.getDatabaseManager)();
|
|
47
47
|
const project = db.getProject(projectId);
|
|
48
48
|
if (!project) {
|
|
49
49
|
throw new Error(`Project with id ${projectId} not found`);
|
|
@@ -64,7 +64,7 @@ async function scanProjectPorts(projectId) {
|
|
|
64
64
|
* Scan ports for all projects
|
|
65
65
|
*/
|
|
66
66
|
async function scanAllProjectPorts() {
|
|
67
|
-
const db = (0,
|
|
67
|
+
const db = (0, projax_core_1.getDatabaseManager)();
|
|
68
68
|
const projects = db.getAllProjects();
|
|
69
69
|
for (const project of projects) {
|
|
70
70
|
try {
|
|
@@ -81,7 +81,7 @@ async function scanAllProjectPorts() {
|
|
|
81
81
|
* Returns true if ports haven't been scanned in the last 24 hours
|
|
82
82
|
*/
|
|
83
83
|
function shouldRescanPorts(projectId) {
|
|
84
|
-
const db = (0,
|
|
84
|
+
const db = (0, projax_core_1.getDatabaseManager)();
|
|
85
85
|
const ports = db.getProjectPorts(projectId);
|
|
86
86
|
if (ports.length === 0) {
|
|
87
87
|
return true; // No ports found, should scan
|