diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 97495a46b..5b7ca5843 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,11 +64,11 @@ check: # some scripts are left out because they need special configuration or are not safe to smoke test - start_section "Smoke test server scripts" - pnpm run-file server/migrate.ts || record_failure "Smoke test migrate" - - pnpm run-file server/calendarBot.js en,pl,es,pt,de,nl,fr,ja,ru,sv,lad,ua,vi "" || record_failure "Smoke test calendarBot" - - pnpm run-file server/cleanupAccounts.js || record_failure "Smoke test cleanupAccounts" - - pnpm run-file server/notify.js || record_failure "Smoke test notify" + - pnpm run-file server/calendarBot.ts en,pl,es,pt,de,nl,fr,ja,ru,sv,lad,ua,vi "" || record_failure "Smoke test calendarBot" + - pnpm run-file server/cleanupAccounts.ts || record_failure "Smoke test cleanupAccounts" + - pnpm run-file server/notify.ts || record_failure "Smoke test notify" - pnpm run-file server/stats.ts || record_failure "Smoke test stats" - - pnpm run-file server/subscriptions.js || record_failure "Smoke test subscriptions" + - pnpm run-file server/subscriptions.ts || record_failure "Smoke test subscriptions" - end_section - > diff --git a/package.json b/package.json index a3d8c1801..bdb91dffe 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,14 @@ "prepare-dev": "nuxi prepare && pnpm run-file locale/generate.ts", "dev": "nuxi dev", "build": "NODE_OPTIONS=\"--max-old-space-size=5120\" nuxi build", - "run-file": "node --import=./server/ts-node-esm.js --env-file=.env", + "run-file": "JITI_ALIAS='{\"~\":\"#root\"}' node --import=jiti/register --env-file=.env", "typecheck": "nuxi typecheck", "lint": "eslint . --fix", "test": "vitest" }, + "imports": { + "#root/*": "./*" + }, "dependencies": { "@atproto/api": "^0.13.16", "@aws-sdk/client-polly": "^3.525.0", @@ -33,6 +36,7 @@ "he-date": "^1.2.2", "html2canvas": "^1.4.1", "ics": "^3.7.6", + "jiti": "^2.4.2", "jose": "^5.9.6", "js-base64": "^3.5.2", "jsdom": "^26.0.0", @@ -51,8 +55,6 @@ "sqlite": "^4.0.12", "sqlite3": "^5.1.6", "suml": "^0.2.3", - "ts-node": "^10.9.2", - "tsconfig-paths": "3.14.2", "twitter": "^1.7.1", "ulid": "^2.3.0", "uuid": "^11.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 86f10e32c..8914837d2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -59,6 +59,9 @@ importers: ics: specifier: ^3.7.6 version: 3.8.0 + jiti: + specifier: ^2.4.2 + version: 2.4.2 jose: specifier: ^5.9.6 version: 5.9.6 @@ -113,12 +116,6 @@ importers: suml: specifier: ^0.2.3 version: 0.2.3 - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@types/node@22.15.29)(typescript@5.8.3) - tsconfig-paths: - specifier: 3.14.2 - version: 3.14.2 twitter: specifier: ^1.7.1 version: 1.7.1 @@ -1075,10 +1072,6 @@ packages: resolution: {integrity: sha512-Ir+AOibqzrIsL6ajt3Rz3LskB7OiMVHqltZmspbW/TJuTVuyOMirVqAkjfY6JISiLHgyNqicAC8AyHHGzNd/dA==} engines: {node: '>=0.1.90'} - '@cspotcode/source-map-support@0.8.1': - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} - '@csstools/color-helpers@5.0.2': resolution: {integrity: sha512-JqWH1vsgdGcw2RR6VliXXdA0/59LttzlU8UlRT/iUUsEeWfYq8I+K0yhihEUTTHLRm1EXvpsCx3083EU15ecsA==} engines: {node: '>=18'} @@ -1684,9 +1677,6 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - '@jridgewell/trace-mapping@0.3.9': - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - '@jsdevtools/ono@7.1.3': resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} @@ -2725,18 +2715,6 @@ packages: resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==} engines: {node: '>=10.13.0'} - '@tsconfig/node10@1.0.11': - resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} - - '@tsconfig/node12@1.0.11': - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - - '@tsconfig/node14@1.0.3': - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - - '@tsconfig/node16@1.0.4': - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - '@tybys/wasm-util@0.9.0': resolution: {integrity: sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==} @@ -2791,9 +2769,6 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/json5@0.0.29': - resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} - '@types/keyv@3.1.4': resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} @@ -3256,10 +3231,6 @@ packages: peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - acorn-walk@8.3.4: - resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} - engines: {node: '>=0.4.0'} - acorn@8.15.0: resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} engines: {node: '>=0.4.0'} @@ -3338,9 +3309,6 @@ packages: engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} deprecated: This package is no longer supported. - arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} @@ -3898,9 +3866,6 @@ packages: resolution: {integrity: sha512-gYTKKexFO3kh200H1Nit76sRwRtOY32vQd3jpAQKpLtZqyNsSQNfI4N7o3eP2wUjV35pTWKRYqFUDBvUha/Pkw==} engines: {node: '>=0.10.0'} - create-require@1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - cron-parser@4.9.0: resolution: {integrity: sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==} engines: {node: '>=12.0.0'} @@ -4235,10 +4200,6 @@ packages: devtools-protocol@0.0.1232444: resolution: {integrity: sha512-pM27vqEfxSxRkTMnF+XCmxSEb6duO5R+t8A9DEEJgy4Wz2RVanje2mmj99B6A3zv2r/qGfYlOvYznUhuokizmg==} - diff@4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} - diff@8.0.2: resolution: {integrity: sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg==} engines: {node: '>=0.3.1'} @@ -5664,10 +5625,6 @@ packages: json-stringify-safe@5.0.1: resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} - json5@1.0.2: - resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} - hasBin: true - json5@2.2.3: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} @@ -5891,9 +5848,6 @@ packages: resolution: {integrity: sha512-G0yBotnlWVonPClw+tq+xi4K7DZC9n96HjGTBDdHkstAVsDkfZhi1sTvZypXLpyQTbISBkDtK0E5XlUqDsShQg==} engines: {node: '>=18'} - make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - make-fetch-happen@9.1.0: resolution: {integrity: sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==} engines: {node: '>= 10'} @@ -7521,10 +7475,6 @@ packages: resolution: {integrity: sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==} engines: {node: '>=0.10.0'} - strip-bom@3.0.0: - resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} - engines: {node: '>=4'} - strip-comments@2.0.1: resolution: {integrity: sha512-ZprKx+bBLXv067WTCALv8SSz5l2+XhpYCsVtSqlMnkAXMWDq+/ekVbl1ghqP9rUHTzv6sm/DwCOiYutU/yp1fw==} engines: {node: '>=10'} @@ -7796,23 +7746,6 @@ packages: engines: {node: '>=10.0.0'} hasBin: true - ts-node@10.9.2: - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - - tsconfig-paths@3.14.2: - resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} - tslib@2.7.0: resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} @@ -8132,9 +8065,6 @@ packages: resolution: {integrity: sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==} hasBin: true - v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} @@ -8602,10 +8532,6 @@ packages: yauzl@2.10.0: resolution: {integrity: sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==} - yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -9956,10 +9882,6 @@ snapshots: '@colors/colors@1.6.0': {} - '@cspotcode/source-map-support@0.8.1': - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - '@csstools/color-helpers@5.0.2': {} '@csstools/css-calc@2.1.2(@csstools/css-parser-algorithms@3.0.4(@csstools/css-tokenizer@3.0.3))(@csstools/css-tokenizer@3.0.3)': @@ -10409,11 +10331,6 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@jridgewell/trace-mapping@0.3.9': - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.0 - '@jsdevtools/ono@7.1.3': {} '@kurkle/color@0.3.4': {} @@ -11821,14 +11738,6 @@ snapshots: '@trysound/sax@0.2.0': {} - '@tsconfig/node10@1.0.11': {} - - '@tsconfig/node12@1.0.11': {} - - '@tsconfig/node14@1.0.3': {} - - '@tsconfig/node16@1.0.4': {} - '@tybys/wasm-util@0.9.0': dependencies: tslib: 2.7.0 @@ -11894,8 +11803,6 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/json5@0.0.29': {} - '@types/keyv@3.1.4': dependencies: '@types/node': 22.15.29 @@ -12491,10 +12398,6 @@ snapshots: dependencies: acorn: 8.15.0 - acorn-walk@8.3.4: - dependencies: - acorn: 8.15.0 - acorn@8.15.0: {} agent-base@6.0.2: @@ -12582,8 +12485,6 @@ snapshots: readable-stream: 3.6.2 optional: true - arg@4.1.3: {} - argparse@2.0.1: {} array-buffer-byte-length@1.0.2: @@ -13173,8 +13074,6 @@ snapshots: dependencies: capture-stack-trace: 1.0.2 - create-require@1.1.1: {} - cron-parser@4.9.0: dependencies: luxon: 3.6.1 @@ -13489,8 +13388,6 @@ snapshots: devtools-protocol@0.0.1232444: {} - diff@4.0.2: {} - diff@8.0.2: {} dom-serializer@0.1.1: @@ -15194,10 +15091,6 @@ snapshots: json-stringify-safe@5.0.1: {} - json5@1.0.2: - dependencies: - minimist: 1.2.8 - json5@2.2.3: {} jsonc-eslint-parser@2.4.0: @@ -15442,8 +15335,6 @@ snapshots: make-dir@5.0.0: {} - make-error@1.3.6: {} - make-fetch-happen@9.1.0: dependencies: agentkeepalive: 4.5.0 @@ -17459,8 +17350,6 @@ snapshots: dependencies: is-utf8: 0.2.1 - strip-bom@3.0.0: {} - strip-comments@2.0.1: {} strip-final-newline@3.0.0: {} @@ -17719,31 +17608,6 @@ snapshots: safe-stable-stringify: 2.5.0 typescript: 5.4.5 - ts-node@10.9.2(@types/node@22.15.29)(typescript@5.8.3): - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.11 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 22.15.29 - acorn: 8.15.0 - acorn-walk: 8.3.4 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.8.3 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - - tsconfig-paths@3.14.2: - dependencies: - '@types/json5': 0.0.29 - json5: 1.0.2 - minimist: 1.2.8 - strip-bom: 3.0.0 - tslib@2.7.0: {} tunnel-agent@0.6.0: @@ -18072,8 +17936,6 @@ snapshots: uuid@9.0.1: {} - v8-compile-cache-lib@3.0.1: {} - validate-npm-package-license@3.0.4: dependencies: spdx-correct: 3.2.0 @@ -18657,8 +18519,6 @@ snapshots: buffer-crc32: 0.2.13 fd-slicer: 1.1.0 - yn@3.1.1: {} - yocto-queue@0.1.0: {} yocto-queue@1.2.0: {} diff --git a/server/calendarBot.ts b/server/calendarBot.ts index 93244f82c..ab7c2cd19 100644 --- a/server/calendarBot.ts +++ b/server/calendarBot.ts @@ -207,7 +207,7 @@ const publish = async

(publisher: P, message: stri (async () => { if (process.argv.length !== 4) { - console.error('Missing parameters. Usage: node server/calendarBot.js '); + console.error('Missing parameters. Usage: node server/calendarBot.ts '); return; } for (const locale of process.argv[2].split(',')) { diff --git a/server/load.js b/server/load.js deleted file mode 100644 index 58e47c285..000000000 --- a/server/load.js +++ /dev/null @@ -1,16 +0,0 @@ -import { pathToFileURL } from 'url'; - -import { resolve as resolveTs } from 'ts-node/esm.mjs'; -import { loadConfig, createMatchPath } from 'tsconfig-paths'; - -const { absoluteBaseUrl, paths } = loadConfig('.nuxt'); -const matchPath = createMatchPath(absoluteBaseUrl, paths); - -export async function resolve(specifier, ctx, defaultResolve) { - const match = matchPath(specifier); - return match - ? resolveTs(pathToFileURL(`${match}`).href, ctx, defaultResolve) - : resolveTs(specifier, ctx, defaultResolve); -} - -export { load, transformSource } from 'ts-node/esm.mjs'; diff --git a/server/ts-node-esm.js b/server/ts-node-esm.js deleted file mode 100644 index 8b6c9bb45..000000000 --- a/server/ts-node-esm.js +++ /dev/null @@ -1,4 +0,0 @@ -import { register } from 'node:module'; -import { pathToFileURL } from 'node:url'; - -register('./server/load.js', pathToFileURL('./'));