fix: Bump to ESM and update all deps (#1851)

* chore: Bump various packages

* feat: Update everything to ESM

* fix: building and porting js to cjs
This commit is contained in:
Core 2024-05-18 16:29:24 +01:00 committed by GitHub
parent 89ee84b7e4
commit 05d32089dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 5919 additions and 5879 deletions

View file

@ -1,11 +1,10 @@
// import { ProviderDB } from "./db";
import * as path from "path";
const { readdir } = require("fs").promises;
import { utils } from "../../base/utils";
import * as mm from "music-metadata";
import { Md5 } from "ts-md5";
import e from "express";
import { EventEmitter } from "events";
import mm from "music-metadata";
import { resolve } from "node:path";
import { Md5 } from "ts-md5";
import { utils } from "../../base/utils.js";
import { readdirSync } from "node:fs";
export class LocalFiles {
static localSongs: any = [];
@ -127,11 +126,12 @@ export class LocalFiles {
this.localSongsArts = metadatalistart;
return metadatalist;
}
static async getFiles(dir: any) {
const dirents = await readdir(dir, { withFileTypes: true });
static async getFiles(dir: string): Promise<string[]> {
const dirents = readdirSync(dir, { withFileTypes: true });
const files = await Promise.all(
dirents.map((dirent: any) => {
const res = path.resolve(dir, dirent.name);
const res = resolve(dir, dirent.name);
return dirent.isDirectory() ? this.getFiles(res) : res;
}),
);