chore: add nocheck for TS deps

This commit is contained in:
ThaUnknown 2025-09-02 16:34:37 +02:00
parent ced4296fae
commit cbe5392d5f
No known key found for this signature in database
6 changed files with 135 additions and 2 deletions

61
nocheck.ts Normal file
View file

@ -0,0 +1,61 @@
import fs from 'node:fs'
import path from 'node:path'
import process from 'node:process'
import { glob } from 'glob'
const TS_NOCHECK_STRING = '// @ts-nocheck\n\n'
const main = (args: string[]) => {
/**
* glob patterns
*/
const patterns = args[0]!.split(',')
.map((pattern) => pattern.trim())
.filter(Boolean)
/**
* ['path/to/file.ts', 'path/to/file2.ts']
*/
const files = patterns.flatMap((pattern) =>
glob.sync(pattern)
)
const addTsNoCheck = async (file: string) => {
const resolvedFilePath = path.resolve(process.cwd(), file)
const content = fs.readFileSync(resolvedFilePath).toString()
if (content.includes(TS_NOCHECK_STRING)) {
console.log(
JSON.stringify(TS_NOCHECK_STRING),
'is already in',
resolvedFilePath
)
} else {
fs.writeFileSync(resolvedFilePath, TS_NOCHECK_STRING + content)
console.log(
JSON.stringify(TS_NOCHECK_STRING),
'added into',
resolvedFilePath
)
}
}
Promise.allSettled(files.map(addTsNoCheck)).then((results) => {
let hasErrors = false
results.forEach((result) => {
if (result.status === 'rejected') {
hasErrors = true
console.error(result.reason)
}
})
if (hasErrors) {
process.exit(1)
}
})
}
main(process.argv.slice(2))

View file

@ -8,7 +8,7 @@
"dev": "vite dev --open",
"build": "vite build && scopy ./build/index.html ./build/offline.html",
"preview": "vite preview",
"sync": "svelte-kit sync",
"sync": "svelte-kit sync && node --experimental-strip-types nocheck.ts \"node_modules/**/torrent-client/*.ts\"",
"check": "svelte-check --threshold error --tsconfig ./tsconfig.web.json",
"check:watch": "svelte-check -threshold error --tsconfig ./tsconfig.web.json --watch",
"test": "pnpm run sync && pnpm run lint && pnpm run gql:check && pnpm run check",
@ -30,6 +30,7 @@
"bits-ui": "^0.22.0",
"cmdk-sv": "^0.0.19",
"eslint-config-standard-universal": "^1.0.9",
"glob": "^11.0.3",
"gql.tada": "^1.8.13",
"hayase-extensions": "github:hayase-app/extensions",
"jassub": "^1.8.6",

View file

@ -174,6 +174,9 @@ importers:
eslint-config-standard-universal:
specifier: ^1.0.9
version: 1.0.9(@typescript-eslint/parser@8.41.0(eslint@9.34.0(jiti@1.21.6))(typescript@5.9.2))(jiti@1.21.6)
glob:
specifier: ^11.0.3
version: 11.0.3
gql.tada:
specifier: ^1.8.13
version: 1.8.13(@gql.tada/svelte-support@1.0.1(svelte@4.2.19)(typescript@5.9.2))(graphql@16.10.0)(typescript@5.9.2)
@ -496,6 +499,14 @@ packages:
'@internationalized/date@3.8.0':
resolution: {integrity: sha512-J51AJ0fEL68hE4CwGPa6E0PO6JDaVLd8aln48xFCSy7CZkZc96dGEGmLs2OEEbBxcsVZtfrqkXJwI2/MSG8yKw==}
'@isaacs/balanced-match@4.0.1':
resolution: {integrity: sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==}
engines: {node: 20 || >=22}
'@isaacs/brace-expansion@5.0.0':
resolution: {integrity: sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==}
engines: {node: 20 || >=22}
'@isaacs/cliui@8.0.2':
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
engines: {node: '>=12'}
@ -1772,6 +1783,11 @@ packages:
resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==}
hasBin: true
glob@11.0.3:
resolution: {integrity: sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==}
engines: {node: 20 || >=22}
hasBin: true
glob@7.2.3:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
deprecated: Glob versions prior to v9 are no longer supported
@ -2050,6 +2066,10 @@ packages:
jackspeak@3.4.3:
resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
jackspeak@4.1.1:
resolution: {integrity: sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==}
engines: {node: 20 || >=22}
jassub@1.8.6:
resolution: {integrity: sha512-56ZTtjM7LfdKsi7boUN/seNOQSOclLuDWEXxnHO55xNakj95SlBrv36hLyNDw0NmoOtLVeqzbpBU1VxT+ubFpg==}
@ -2157,6 +2177,10 @@ packages:
lru-cache@10.4.3:
resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
lru-cache@11.1.0:
resolution: {integrity: sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==}
engines: {node: 20 || >=22}
lru@3.1.0:
resolution: {integrity: sha512-5OUtoiVIGU4VXBOshidmtOsvBIvcQR6FD/RzWSvaeHyxCGB+PCUCu+52lqMfdc0h/2CLvHhZS4TwUmMQrrMbBQ==}
engines: {node: '>= 0.4.0'}
@ -2225,6 +2249,10 @@ packages:
resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==}
engines: {node: '>=10'}
minimatch@10.0.3:
resolution: {integrity: sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==}
engines: {node: 20 || >=22}
minimatch@3.1.2:
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
@ -2450,6 +2478,10 @@ packages:
resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==}
engines: {node: '>=16 || 14 >=14.18'}
path-scurry@2.0.0:
resolution: {integrity: sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==}
engines: {node: 20 || >=22}
periscopic@3.1.0:
resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==}
@ -3549,6 +3581,12 @@ snapshots:
dependencies:
'@swc/helpers': 0.5.17
'@isaacs/balanced-match@4.0.1': {}
'@isaacs/brace-expansion@5.0.0':
dependencies:
'@isaacs/balanced-match': 4.0.1
'@isaacs/cliui@8.0.2':
dependencies:
string-width: 5.1.2
@ -5127,6 +5165,15 @@ snapshots:
package-json-from-dist: 1.0.1
path-scurry: 1.11.1
glob@11.0.3:
dependencies:
foreground-child: 3.3.1
jackspeak: 4.1.1
minimatch: 10.0.3
minipass: 7.1.2
package-json-from-dist: 1.0.1
path-scurry: 2.0.0
glob@7.2.3:
dependencies:
fs.realpath: 1.0.0
@ -5390,6 +5437,10 @@ snapshots:
optionalDependencies:
'@pkgjs/parseargs': 0.11.0
jackspeak@4.1.1:
dependencies:
'@isaacs/cliui': 8.0.2
jassub@1.8.6:
dependencies:
rvfc-polyfill: 1.0.7
@ -5491,6 +5542,8 @@ snapshots:
lru-cache@10.4.3: {}
lru-cache@11.1.0: {}
lru@3.1.0:
dependencies:
inherits: 2.0.4
@ -5554,6 +5607,10 @@ snapshots:
mimic-response@3.1.0: {}
minimatch@10.0.3:
dependencies:
'@isaacs/brace-expansion': 5.0.0
minimatch@3.1.2:
dependencies:
brace-expansion: 1.1.11
@ -5760,6 +5817,11 @@ snapshots:
lru-cache: 10.4.3
minipass: 7.1.2
path-scurry@2.0.0:
dependencies:
lru-cache: 11.1.0
minipass: 7.1.2
periscopic@3.1.0:
dependencies:
'@types/estree': 1.0.7

5
src/types/fs.d.ts vendored
View file

@ -4,6 +4,11 @@ declare module 'fs' {
data: string | Uint8Array,
options?: { encoding?: string, mode?: number, flag?: string }
) => void
export const readFileSync: (
file: string | URL,
options?: { encoding?: string, flag?: string }
) => string | Uint8Array
}
declare module 'node:fs' {

View file

@ -1,5 +1,8 @@
declare module 'process' {
export const env: Record<string, string | undefined>
export const cwd: () => string
export const exit: (code?: number) => never
export const argv: string[]
}
declare module 'node:process' {

View file

@ -42,7 +42,8 @@
"generateALIntrospection.ts",
"src/types/**/*.d.ts",
"postcss.config.js",
"tsconfig.web.json"
"tsconfig.web.json",
"nocheck.ts"
],
"exclude": [
"../node_modules/**"