Reduce low risk duplication (#79)

* clean up helpers

* shared in it's own top level folder

* workspaces setup

* build fix

* disable workspaces?

* run ci

* rename job-flow to gradcracker

* optional dependencies

* formatting?

* more optional modules

* allow post install runs

* node bump

* remove post install

* add optionals

* add more

* formatting

* comments, but im unsure

* run typescript DIRECTLY

* better build

* camoufox simplification

* lint

* build process doesn't exist

* build fix

* lockfile

* type check everything, build only for client

* rename steps correctly

* import from package!

* fix formatting

* don't fetch twice

* fix concern
This commit is contained in:
Shaheer Sarfaraz
2026-02-02 21:30:14 +00:00
committed by GitHub
parent 179deffe13
commit b94f85b149
165 changed files with 8909 additions and 13638 deletions
File diff suppressed because it is too large Load Diff
+10 -8
View File
@@ -3,24 +3,26 @@
"version": "0.0.1",
"type": "module",
"description": "UK Visa Jobs extractor - fetches job listings that may sponsor work visas",
"main": "dist/main.js",
"main": "src/main.ts",
"dependencies": {
"camoufox-js": "^0.8.0",
"playwright": "^1.57.0"
"playwright": "^1.57.0",
"tsx": "^4.4.0",
"job-ops-shared": "^1.0.0"
},
"devDependencies": {
"@apify/tsconfig": "^0.1.0",
"@types/node": "^24.0.0",
"tsx": "^4.4.0",
"typescript": "~5.9.0"
},
"optionalDependencies": {
"impit-linux-x64-gnu": "^0.1.0"
},
"scripts": {
"start": "npm run start:dev",
"start:prod": "node dist/main.js",
"start": "tsx src/main.ts",
"start:dev": "tsx src/main.ts",
"build": "tsc",
"get-binaries": "camoufox-js fetch",
"postinstall": "npm run get-binaries"
"check:types": "tsc --noEmit",
"get-binaries": "camoufox-js fetch"
},
"author": "",
"license": "ISC"
+5 -24
View File
@@ -1,4 +1,4 @@
/**
/**
* UK Visa Jobs Extractor
*
* Fetches job listings from my.ukvisajobs.com that may sponsor work visas.
@@ -16,6 +16,10 @@
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import {
toNumberOrNull,
toStringOrNull,
} from "job-ops-shared/utils/type-conversion";
import type { Request } from "playwright";
const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -103,29 +107,6 @@ class UkVisaJobsAuthError extends Error {
}
}
function toStringOrNull(value: unknown): string | null {
if (value === null || value === undefined) return null;
if (typeof value === "string") {
const trimmed = value.trim();
return trimmed.length > 0 ? trimmed : null;
}
if (typeof value === "number" || typeof value === "boolean")
return String(value);
return null;
}
function toNumberOrNull(value: unknown): number | null {
if (value === null || value === undefined) return null;
if (typeof value === "number") return Number.isFinite(value) ? value : null;
if (typeof value === "string") {
const trimmed = value.trim();
if (!trimmed) return null;
const parsed = Number(trimmed);
return Number.isFinite(parsed) ? parsed : null;
}
return null;
}
async function fetchPage(
pageNo: number,
session: UkVisaJobsAuthSession,
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {
"@shared/*": ["../../shared/dist/*"]
}
}
}
+5 -1
View File
@@ -6,7 +6,11 @@
"target": "ES2022",
"outDir": "dist",
"noUnusedLocals": false,
"lib": ["DOM"]
"lib": ["DOM"],
"baseUrl": ".",
"paths": {
"@shared/*": ["../../shared/src/*"]
}
},
"include": ["./src/**/*"]
}