projax 1.3.0 → 1.3.1
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/core-bridge.d.ts +2 -0
- package/dist/core-bridge.js +73 -0
- package/dist/core.d.ts +2 -0
- package/dist/core.js +76 -0
- package/dist/electron/core/database.d.ts +76 -0
- package/dist/electron/core/database.js +240 -0
- package/dist/electron/core/detector.d.ts +14 -0
- package/dist/electron/core/detector.js +284 -0
- package/dist/electron/core/index.d.ts +10 -0
- package/dist/electron/core/index.js +41 -0
- package/dist/electron/core/scanner.d.ts +8 -0
- package/dist/electron/core/scanner.js +11 -0
- package/dist/electron/core/settings.d.ts +50 -0
- package/dist/electron/core/settings.js +102 -0
- package/dist/electron/core.d.ts +2 -0
- package/dist/electron/core.js +76 -0
- package/dist/electron/main.js +14 -30
- package/dist/electron/port-scanner.js +4 -4
- package/dist/electron/script-runner.js +4 -4
- package/dist/index.js +21 -21
- package/dist/port-scanner.js +4 -4
- package/dist/script-runner.js +4 -4
- package/package.json +2 -3
- package/dist/electron/renderer/assets/index-BRymlmJj.js +0 -42
|
@@ -0,0 +1,284 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FRAMEWORKS = void 0;
|
|
37
|
+
exports.detectTestFramework = detectTestFramework;
|
|
38
|
+
exports.isTestFile = isTestFile;
|
|
39
|
+
exports.detectProjectFramework = detectProjectFramework;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
exports.FRAMEWORKS = [
|
|
43
|
+
{
|
|
44
|
+
name: 'jest',
|
|
45
|
+
configFiles: ['jest.config.js', 'jest.config.ts', 'jest.config.json', 'jest.config.mjs', 'jest.config.cjs'],
|
|
46
|
+
testPatterns: [
|
|
47
|
+
/\.test\.(js|ts|jsx|tsx)$/i,
|
|
48
|
+
/\.spec\.(js|ts|jsx|tsx)$/i,
|
|
49
|
+
],
|
|
50
|
+
testDirs: ['__tests__', '__test__'],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'vitest',
|
|
54
|
+
configFiles: ['vitest.config.ts', 'vitest.config.js', 'vitest.config.mjs'],
|
|
55
|
+
testPatterns: [
|
|
56
|
+
/\.test\.(js|ts|jsx|tsx)$/i,
|
|
57
|
+
/\.spec\.(js|ts|jsx|tsx)$/i,
|
|
58
|
+
],
|
|
59
|
+
testDirs: ['__tests__'],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'mocha',
|
|
63
|
+
configFiles: ['.mocharc.js', '.mocharc.json', '.mocharc.yaml', '.mocharc.yml', 'mocha.opts'],
|
|
64
|
+
testPatterns: [
|
|
65
|
+
/\.test\.(js|ts|jsx|tsx)$/i,
|
|
66
|
+
/\.spec\.(js|ts|jsx|tsx)$/i,
|
|
67
|
+
],
|
|
68
|
+
testDirs: ['test', 'tests'],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
function detectTestFramework(projectPath) {
|
|
72
|
+
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
73
|
+
// Check package.json for test scripts and dependencies
|
|
74
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
75
|
+
try {
|
|
76
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
77
|
+
// Check dependencies and devDependencies
|
|
78
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
79
|
+
if (deps.jest)
|
|
80
|
+
return 'jest';
|
|
81
|
+
if (deps.vitest)
|
|
82
|
+
return 'vitest';
|
|
83
|
+
if (deps.mocha)
|
|
84
|
+
return 'mocha';
|
|
85
|
+
// Check for jest config in package.json
|
|
86
|
+
if (packageJson.jest)
|
|
87
|
+
return 'jest';
|
|
88
|
+
// Check test scripts
|
|
89
|
+
if (packageJson.scripts) {
|
|
90
|
+
const testScript = packageJson.scripts.test || '';
|
|
91
|
+
if (testScript.includes('jest'))
|
|
92
|
+
return 'jest';
|
|
93
|
+
if (testScript.includes('vitest'))
|
|
94
|
+
return 'vitest';
|
|
95
|
+
if (testScript.includes('mocha'))
|
|
96
|
+
return 'mocha';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
// Invalid JSON, continue with file-based detection
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// Check for config files
|
|
104
|
+
for (const framework of exports.FRAMEWORKS) {
|
|
105
|
+
for (const configFile of framework.configFiles) {
|
|
106
|
+
const configPath = path.join(projectPath, configFile);
|
|
107
|
+
if (fs.existsSync(configPath)) {
|
|
108
|
+
return framework.name;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
function isTestFile(filePath, detectedFramework = null) {
|
|
115
|
+
const fileName = path.basename(filePath);
|
|
116
|
+
const dirName = path.dirname(filePath);
|
|
117
|
+
const parentDirName = path.basename(dirName);
|
|
118
|
+
// If framework is detected, use its specific patterns
|
|
119
|
+
if (detectedFramework) {
|
|
120
|
+
const framework = exports.FRAMEWORKS.find(f => f.name === detectedFramework);
|
|
121
|
+
if (framework) {
|
|
122
|
+
// Check test patterns
|
|
123
|
+
for (const pattern of framework.testPatterns) {
|
|
124
|
+
if (pattern.test(fileName)) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Check test directories
|
|
129
|
+
for (const testDir of framework.testDirs) {
|
|
130
|
+
if (parentDirName === testDir) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Fallback: check all common patterns
|
|
137
|
+
for (const framework of exports.FRAMEWORKS) {
|
|
138
|
+
for (const pattern of framework.testPatterns) {
|
|
139
|
+
if (pattern.test(fileName)) {
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (const testDir of framework.testDirs) {
|
|
144
|
+
if (parentDirName === testDir) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Detect the main framework/library used in a project
|
|
153
|
+
* Returns null if no framework is detected
|
|
154
|
+
*/
|
|
155
|
+
function detectProjectFramework(projectPath) {
|
|
156
|
+
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
157
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
158
|
+
// Check for non-JS projects
|
|
159
|
+
if (fs.existsSync(path.join(projectPath, 'Cargo.toml')))
|
|
160
|
+
return 'rust';
|
|
161
|
+
if (fs.existsSync(path.join(projectPath, 'go.mod')))
|
|
162
|
+
return 'go';
|
|
163
|
+
if (fs.existsSync(path.join(projectPath, 'requirements.txt')) ||
|
|
164
|
+
fs.existsSync(path.join(projectPath, 'setup.py')) ||
|
|
165
|
+
fs.existsSync(path.join(projectPath, 'pyproject.toml'))) {
|
|
166
|
+
return 'python';
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
172
|
+
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies };
|
|
173
|
+
// Meta-frameworks (check these first as they often include the base frameworks)
|
|
174
|
+
if (deps['next'] || deps['next.js'])
|
|
175
|
+
return 'next.js';
|
|
176
|
+
if (deps['@nuxt/kit'] || deps['nuxt'] || deps['nuxt3'])
|
|
177
|
+
return 'nuxt.js';
|
|
178
|
+
if (deps['gatsby'])
|
|
179
|
+
return 'gatsby';
|
|
180
|
+
if (deps['@remix-run/react'] || deps['remix'])
|
|
181
|
+
return 'remix';
|
|
182
|
+
if (deps['@astro'] || deps['astro'])
|
|
183
|
+
return 'astro';
|
|
184
|
+
if (deps['@angular/core'])
|
|
185
|
+
return 'angular';
|
|
186
|
+
if (deps['expo'] || deps['expo-cli'])
|
|
187
|
+
return 'expo';
|
|
188
|
+
// React Native (check before React)
|
|
189
|
+
if (deps['react-native'])
|
|
190
|
+
return 'react-native';
|
|
191
|
+
// Frontend frameworks
|
|
192
|
+
if (deps['react'] || deps['react-dom'])
|
|
193
|
+
return 'react';
|
|
194
|
+
if (deps['vue']) {
|
|
195
|
+
// Check Vue version
|
|
196
|
+
const vueVersion = deps['vue']?.match(/\d+/)?.[0];
|
|
197
|
+
return vueVersion === '3' ? 'vue 3' : 'vue';
|
|
198
|
+
}
|
|
199
|
+
if (deps['svelte'])
|
|
200
|
+
return 'svelte';
|
|
201
|
+
if (deps['solid-js'])
|
|
202
|
+
return 'solid';
|
|
203
|
+
if (deps['preact'])
|
|
204
|
+
return 'preact';
|
|
205
|
+
if (deps['alpine'] || deps['alpinejs'])
|
|
206
|
+
return 'alpine.js';
|
|
207
|
+
if (deps['lit'] || deps['lit-element'])
|
|
208
|
+
return 'lit';
|
|
209
|
+
if (deps['hyperapp'])
|
|
210
|
+
return 'hyperapp';
|
|
211
|
+
if (deps['mithril'])
|
|
212
|
+
return 'mithril';
|
|
213
|
+
if (deps['inferno'])
|
|
214
|
+
return 'inferno';
|
|
215
|
+
if (deps['marko'])
|
|
216
|
+
return 'marko';
|
|
217
|
+
// Backend frameworks
|
|
218
|
+
if (deps['express'])
|
|
219
|
+
return 'express';
|
|
220
|
+
if (deps['@nestjs/core'])
|
|
221
|
+
return 'nest.js';
|
|
222
|
+
if (deps['fastify'])
|
|
223
|
+
return 'fastify';
|
|
224
|
+
if (deps['koa'])
|
|
225
|
+
return 'koa';
|
|
226
|
+
if (deps['hapi'] || deps['@hapi/hapi'])
|
|
227
|
+
return 'hapi';
|
|
228
|
+
if (deps['@apollo/server'] || deps['apollo-server'])
|
|
229
|
+
return 'apollo';
|
|
230
|
+
if (deps['graphql'] && (deps['@graphql-yoga/node'] || deps['graphql-yoga']))
|
|
231
|
+
return 'graphql-yoga';
|
|
232
|
+
if (deps['@trpc/server'])
|
|
233
|
+
return 'trpc';
|
|
234
|
+
if (deps['@redwoodjs/core'])
|
|
235
|
+
return 'redwood.js';
|
|
236
|
+
if (deps['@blitzjs/core'])
|
|
237
|
+
return 'blitz.js';
|
|
238
|
+
// Electron
|
|
239
|
+
if (deps['electron'])
|
|
240
|
+
return 'electron';
|
|
241
|
+
// Static site generators
|
|
242
|
+
if (deps['@11ty/eleventy'])
|
|
243
|
+
return '11ty';
|
|
244
|
+
if (deps['hexo'])
|
|
245
|
+
return 'hexo';
|
|
246
|
+
if (deps['jekyll'])
|
|
247
|
+
return 'jekyll';
|
|
248
|
+
if (deps['hugo'])
|
|
249
|
+
return 'hugo';
|
|
250
|
+
// Mobile development
|
|
251
|
+
if (deps['@ionic/core'] || deps['@ionic/angular'] || deps['@ionic/react'])
|
|
252
|
+
return 'ionic';
|
|
253
|
+
if (deps['@nativescript/core'])
|
|
254
|
+
return 'nativescript';
|
|
255
|
+
if (deps['@capacitor/core'])
|
|
256
|
+
return 'capacitor';
|
|
257
|
+
if (deps['cordova'])
|
|
258
|
+
return 'cordova';
|
|
259
|
+
// Desktop development
|
|
260
|
+
if (deps['tauri'])
|
|
261
|
+
return 'tauri';
|
|
262
|
+
if (deps['nw.js'] || deps['nw'])
|
|
263
|
+
return 'nw.js';
|
|
264
|
+
// Build tools / bundlers (as last resort)
|
|
265
|
+
if (deps['vite'])
|
|
266
|
+
return 'vite';
|
|
267
|
+
if (deps['webpack'])
|
|
268
|
+
return 'webpack';
|
|
269
|
+
if (deps['parcel'])
|
|
270
|
+
return 'parcel';
|
|
271
|
+
if (deps['rollup'])
|
|
272
|
+
return 'rollup';
|
|
273
|
+
if (deps['esbuild'])
|
|
274
|
+
return 'esbuild';
|
|
275
|
+
if (deps['turbopack'])
|
|
276
|
+
return 'turbopack';
|
|
277
|
+
// Generic Node.js if no specific framework found but package.json exists
|
|
278
|
+
return 'node.js';
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
// Invalid JSON or read error
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './database';
|
|
2
|
+
export * from './detector';
|
|
3
|
+
export * from './scanner';
|
|
4
|
+
export * from './settings';
|
|
5
|
+
export { getDatabaseManager } from './database';
|
|
6
|
+
import { Project, Test } from './database';
|
|
7
|
+
export declare function getAllProjects(): Project[];
|
|
8
|
+
export declare function addProject(name: string, projectPath: string): Project;
|
|
9
|
+
export declare function removeProject(id: number): void;
|
|
10
|
+
export declare function getTestsByProject(projectId: number): Test[];
|
|
@@ -0,0 +1,41 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getDatabaseManager = void 0;
|
|
18
|
+
exports.getAllProjects = getAllProjects;
|
|
19
|
+
exports.addProject = addProject;
|
|
20
|
+
exports.removeProject = removeProject;
|
|
21
|
+
exports.getTestsByProject = getTestsByProject;
|
|
22
|
+
__exportStar(require("./database"), exports);
|
|
23
|
+
__exportStar(require("./detector"), exports);
|
|
24
|
+
__exportStar(require("./scanner"), exports);
|
|
25
|
+
__exportStar(require("./settings"), exports);
|
|
26
|
+
var database_1 = require("./database");
|
|
27
|
+
Object.defineProperty(exports, "getDatabaseManager", { enumerable: true, get: function () { return database_1.getDatabaseManager; } });
|
|
28
|
+
// Convenience functions for common operations
|
|
29
|
+
const database_2 = require("./database");
|
|
30
|
+
function getAllProjects() {
|
|
31
|
+
return (0, database_2.getDatabaseManager)().getAllProjects();
|
|
32
|
+
}
|
|
33
|
+
function addProject(name, projectPath) {
|
|
34
|
+
return (0, database_2.getDatabaseManager)().addProject(name, projectPath);
|
|
35
|
+
}
|
|
36
|
+
function removeProject(id) {
|
|
37
|
+
(0, database_2.getDatabaseManager)().removeProject(id);
|
|
38
|
+
}
|
|
39
|
+
function getTestsByProject(projectId) {
|
|
40
|
+
return (0, database_2.getDatabaseManager)().getTestsByProject(projectId);
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Project, Test } from './database';
|
|
2
|
+
export interface ScanResult {
|
|
3
|
+
project: Project;
|
|
4
|
+
testsFound: number;
|
|
5
|
+
tests: Test[];
|
|
6
|
+
}
|
|
7
|
+
export declare function scanProject(projectId: number): ScanResult;
|
|
8
|
+
export declare function scanAllProjects(): ScanResult[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scanProject = scanProject;
|
|
4
|
+
exports.scanAllProjects = scanAllProjects;
|
|
5
|
+
const database_1 = require("./database");
|
|
6
|
+
function scanProject(projectId) {
|
|
7
|
+
return (0, database_1.getDatabaseManager)().scanProject(projectId);
|
|
8
|
+
}
|
|
9
|
+
function scanAllProjects() {
|
|
10
|
+
return (0, database_1.getDatabaseManager)().scanAllProjects();
|
|
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
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const getDatabaseManager: typeof import("projax-core").getDatabaseManager, addProject: typeof import("projax-core").addProject, removeProject: typeof import("projax-core").removeProject, getAllProjects: typeof import("projax-core").getAllProjects, scanProject: typeof import("projax-core").scanProject, scanAllProjects: typeof import("projax-core").scanAllProjects, getTestsByProject: typeof import("projax-core").getTestsByProject;
|
|
2
|
+
export type { Project, Test, ProjectPort, JenkinsJob } from 'projax-core';
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getTestsByProject = exports.scanAllProjects = exports.scanProject = exports.getAllProjects = exports.removeProject = exports.addProject = exports.getDatabaseManager = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
let cachedCore = null;
|
|
39
|
+
function tryRequire(candidate) {
|
|
40
|
+
try {
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
42
|
+
return require(candidate);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (!(error instanceof Error) ||
|
|
46
|
+
!('code' in error) ||
|
|
47
|
+
error.code !== 'MODULE_NOT_FOUND') {
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function resolveCore() {
|
|
54
|
+
if (cachedCore) {
|
|
55
|
+
return cachedCore;
|
|
56
|
+
}
|
|
57
|
+
const candidates = [
|
|
58
|
+
// Packaged desktop build (core copied into dist/core)
|
|
59
|
+
path.join(__dirname, 'core'),
|
|
60
|
+
// Running from workspace build output
|
|
61
|
+
path.join(__dirname, '..', '..', 'core', 'dist'),
|
|
62
|
+
path.join(__dirname, '..', 'core', 'dist'),
|
|
63
|
+
// Fallback: installed module (during development)
|
|
64
|
+
'projax-core',
|
|
65
|
+
];
|
|
66
|
+
for (const candidate of candidates) {
|
|
67
|
+
const mod = tryRequire(candidate);
|
|
68
|
+
if (mod) {
|
|
69
|
+
cachedCore = mod;
|
|
70
|
+
return mod;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
throw new Error(`Unable to load projax core module. Tried locations: ${candidates.join(', ')}`);
|
|
74
|
+
}
|
|
75
|
+
const core = resolveCore();
|
|
76
|
+
exports.getDatabaseManager = core.getDatabaseManager, exports.addProject = core.addProject, exports.removeProject = core.removeProject, exports.getAllProjects = core.getAllProjects, exports.scanProject = core.scanProject, exports.scanAllProjects = core.scanAllProjects, exports.getTestsByProject = core.getTestsByProject;
|