ditch old packages for native JS alternatives

This commit is contained in:
theofficialomega
2025-08-02 12:38:31 +02:00
parent 0158c80009
commit 048e663114
4 changed files with 14 additions and 13 deletions

4
package-lock.json generated
View File

@@ -28,7 +28,6 @@
"axios": "^1.11.0", "axios": "^1.11.0",
"chalk": "^5.4.1", "chalk": "^5.4.1",
"cli-progress": "^3.12.0", "cli-progress": "^3.12.0",
"command-exists": "^1.2.9",
"commander": "^14.0.0", "commander": "^14.0.0",
"console-table-printer": "^2.14.6", "console-table-printer": "^2.14.6",
"cross-env": "^10.0.0", "cross-env": "^10.0.0",
@@ -42,8 +41,7 @@
"lodash.uniqueid": "^4.0.1", "lodash.uniqueid": "^4.0.1",
"m3u-linter": "^0.4.2", "m3u-linter": "^0.4.2",
"node-cleanup": "^2.1.2", "node-cleanup": "^2.1.2",
"tsx": "^4.20.3", "tsx": "^4.20.3"
"valid-url": "^1.0.9"
} }
}, },
"node_modules/@ampproject/remapping": { "node_modules/@ampproject/remapping": {

View File

@@ -58,7 +58,6 @@
"axios": "^1.11.0", "axios": "^1.11.0",
"chalk": "^5.4.1", "chalk": "^5.4.1",
"cli-progress": "^3.12.0", "cli-progress": "^3.12.0",
"command-exists": "^1.2.9",
"commander": "^14.0.0", "commander": "^14.0.0",
"console-table-printer": "^2.14.6", "console-table-printer": "^2.14.6",
"cross-env": "^10.0.0", "cross-env": "^10.0.0",
@@ -72,7 +71,6 @@
"lodash.uniqueid": "^4.0.1", "lodash.uniqueid": "^4.0.1",
"m3u-linter": "^0.4.2", "m3u-linter": "^0.4.2",
"node-cleanup": "^2.1.2", "node-cleanup": "^2.1.2",
"tsx": "^4.20.3", "tsx": "^4.20.3"
"valid-url": "^1.0.9"
} }
} }

View File

@@ -4,8 +4,8 @@ import { PlaylistParser, StreamTester, CliTable, DataProcessor, DataLoader } fro
import { Stream } from '../../models' import { Stream } from '../../models'
import { program } from 'commander' import { program } from 'commander'
import { eachLimit } from 'async-es' import { eachLimit } from 'async-es'
import commandExists from 'command-exists'
import chalk from 'chalk' import chalk from 'chalk'
import child_process from 'node:child_process'
import os from 'node:os' import os from 'node:os'
import dns from 'node:dns' import dns from 'node:dns'
import type { DataLoaderData } from '../../types/dataLoader' import type { DataLoaderData } from '../../types/dataLoader'
@@ -46,10 +46,12 @@ async function main() {
return return
} }
if (!commandExists.sync('ffprobe')) { try {
child_process.execSync('ffprobe -version', { stdio: 'ignore' })
} catch {
logger.error( logger.error(
chalk.red( chalk.red(
'For the script to work, the ffprobe library must be installed (https://ffmpeg.org/download.html)' 'For the script to work, the "ffprobe" library must be installed (https://ffmpeg.org/download.html)'
) )
) )

View File

@@ -1,5 +1,8 @@
import validUrl from 'valid-url' export function isURI(string: string): boolean {
try {
export function isURI(string: string) { new URL(string)
return validUrl.isUri(encodeURI(string)) return true
} catch {
return false
}
} }