jobtrack 1.0.12 → 1.2.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/package.json +2 -2
- package/src/cli.ts +2 -1
- package/src/server.ts +11 -3
- package/src/tray.ts +1 -1
- package/vendor/web-dist/assets/index-DN_P3r0S.js +437 -0
- package/vendor/web-dist/index.html +1 -1
- package/vendor/web-dist/assets/index-eY39aBQj.js +0 -446
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jobtrack",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Runs the JobTrack API + web UI as one background process with a Windows tray icon",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@fastify/static": "^10.1.3",
|
|
33
|
-
"@jobtrack/api": "^1.0
|
|
33
|
+
"@jobtrack/api": "^1.2.0",
|
|
34
34
|
"fastify": "^5.12.1",
|
|
35
35
|
"systray": "^1.0.5",
|
|
36
36
|
"tsx": "^4.23.12"
|
package/src/cli.ts
CHANGED
|
@@ -36,7 +36,7 @@ if (home) process.env.JOBTRACK_HOME = resolve(home);
|
|
|
36
36
|
|
|
37
37
|
const noTray = argv.includes('--no-tray') || process.env.JOBTRACK_NO_TRAY === '1';
|
|
38
38
|
|
|
39
|
-
const { app, config, repos, search } = await startServer();
|
|
39
|
+
const { app, config, repos, search, jobs } = await startServer();
|
|
40
40
|
|
|
41
41
|
const url = `http://${config.host === '0.0.0.0' ? '127.0.0.1' : config.host}:${config.port}`;
|
|
42
42
|
console.log(`JobTrack v${APP_VERSION} running at ${url} (driver: ${config.driver})`);
|
|
@@ -57,6 +57,7 @@ let shuttingDown = false;
|
|
|
57
57
|
async function shutdown(): Promise<void> {
|
|
58
58
|
if (shuttingDown) return;
|
|
59
59
|
shuttingDown = true;
|
|
60
|
+
jobs.stop();
|
|
60
61
|
search.stop();
|
|
61
62
|
await app.close();
|
|
62
63
|
await repos.close();
|
package/src/server.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { RepoBundle } from '@jobtrack/api/db/repos';
|
|
|
14
14
|
import { SearchIndex } from '@jobtrack/api/search';
|
|
15
15
|
import { DisabledEmbedder, type Embedder } from '@jobtrack/api/search/embedder';
|
|
16
16
|
import { TransformersEmbedder } from '@jobtrack/api/search/transformers-embedder';
|
|
17
|
+
import { startBackgroundJobs, type BackgroundJobs } from '@jobtrack/api/jobs/scheduler';
|
|
17
18
|
import { resolveWebDist } from './assets.js';
|
|
18
19
|
import { APP_PACKAGE } from './version.js';
|
|
19
20
|
|
|
@@ -28,6 +29,7 @@ export interface RunningServer {
|
|
|
28
29
|
config: Config;
|
|
29
30
|
repos: RepoBundle;
|
|
30
31
|
search: SearchIndex;
|
|
32
|
+
jobs: BackgroundJobs;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export async function startServer(): Promise<RunningServer> {
|
|
@@ -70,7 +72,7 @@ export async function startServer(): Promise<RunningServer> {
|
|
|
70
72
|
return reply.status(404).send({ error: 'not_found', message: 'Not found' });
|
|
71
73
|
});
|
|
72
74
|
} else {
|
|
73
|
-
console.warn('[tray] no built web UI found
|
|
75
|
+
console.warn('[tray] no built web UI found. Run "npm run build" to serve it. API-only for now.');
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
await search.start();
|
|
@@ -86,7 +88,7 @@ export async function startServer(): Promise<RunningServer> {
|
|
|
86
88
|
`JOBTRACK_ERROR ${JSON.stringify({ code: 'EADDRINUSE', host: config.host, port: config.port })}`,
|
|
87
89
|
);
|
|
88
90
|
console.error(
|
|
89
|
-
`Port ${config.port} is already in use
|
|
91
|
+
`Port ${config.port} is already in use. JobTrack may already be running. Stop it, or set PORT in .env to something else.`,
|
|
90
92
|
);
|
|
91
93
|
search.stop();
|
|
92
94
|
await app.close();
|
|
@@ -94,5 +96,11 @@ export async function startServer(): Promise<RunningServer> {
|
|
|
94
96
|
process.exit(EXIT_PORT_IN_USE);
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
// Only once listening: a second JobTrack that lost the port race exits above, and must not
|
|
100
|
+
// have started running rules against the shared database first.
|
|
101
|
+
const jobs = startBackgroundJobs({ repos, search, config }, {
|
|
102
|
+
log: (message, error) => console.warn(`[jobs] ${message}`, error ?? ''),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return { app, config, repos, search, jobs };
|
|
98
106
|
}
|
package/src/tray.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface TrayHandlers {
|
|
|
36
36
|
export function createTray(handlers: TrayHandlers): InstanceType<SysTrayCtor> {
|
|
37
37
|
const webDist = resolveWebDist();
|
|
38
38
|
if (!webDist) {
|
|
39
|
-
throw new Error('No built web UI found
|
|
39
|
+
throw new Error('No built web UI found. Run "npm run build" before starting the tray.');
|
|
40
40
|
}
|
|
41
41
|
const icon = readFileSync(resolve(webDist, 'favicon.ico')).toString('base64');
|
|
42
42
|
|