From 04a7fb1d27c29400846da63a83de2517f8c91db9 Mon Sep 17 00:00:00 2001 From: Nibor <156368035+infnibor@users.noreply.github.com> Date: Fri, 4 Oct 2024 22:27:34 +0200 Subject: [PATCH 1/2] Update update_nodes.ts - Fix `SyntaxError: Cannot use import statement outside a module` with Update Nodes Workflow - Fix libsql npm i conflict --- .gitignore | 1 + package.json | 4 ++-- tsconfig.json | 11 +++++++++++ update_nodes.ts | 8 ++++---- 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index d1b29f8..ae560f5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules .env yarn.lock pnpm-lock.yaml +package-lock.json diff --git a/package.json b/package.json index 84db352..b0660fe 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,13 @@ "description": "A list of free and available public Lavalink nodes with their live status. Feel free to make a pull request!", "main": "update_nodes.js", "scripts": { - "start": "ts-node update_nodes.ts" + "start": "npx ts-node update_nodes.ts" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { - "@libsql/client": "^0.9.0", + "@libsql/client": "^0.8.0", "@prisma/adapter-libsql": "^5.18.0", "@prisma/client": "^5.18.0" }, diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..6594441 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "node", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true + } + } + \ No newline at end of file diff --git a/update_nodes.ts b/update_nodes.ts index 2294a41..c646488 100644 --- a/update_nodes.ts +++ b/update_nodes.ts @@ -1,7 +1,7 @@ -import * as fs from 'fs'; -import { PrismaClient } from '@prisma/client'; -import { PrismaLibSQL } from "@prisma/adapter-libsql"; -import { createClient } from "@libsql/client"; +const fs = require('fs'); +const { PrismaClient } = require('@prisma/client'); +const { PrismaLibSQL } = require('@prisma/adapter-libsql'); +const { createClient } = require('@libsql/client'); const libsql = createClient({ url: process.env.TURSO_DATABASE_URL || '', From 9860c4e3955405dbc763c700f439539b432e42cf Mon Sep 17 00:00:00 2001 From: infnibor <156368035+infnibor@users.noreply.github.com> Date: Fri, 4 Oct 2024 23:00:16 +0200 Subject: [PATCH 2/2] Possible fix --- nodes.json | 11 +---------- package.json | 3 ++- update_nodes.ts | 1 + 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/nodes.json b/nodes.json index dc5e3c2..24e910c 100644 --- a/nodes.json +++ b/nodes.json @@ -17,15 +17,6 @@ "restVersion": "v4", "authorId": "612666923502796818" }, - { - "identifier": "Elf Lights.out.", - "host": "lavalink3.theelf.tech", - "port": 50050, - "password": "discord.gg/PqVQgXTweC", - "secure": false, - "restVersion": "v3", - "authorId": "612666923502796818" - }, { "identifier": "MYHM.Space", "host": "ll3.myhm.space", @@ -296,4 +287,4 @@ "restVersion": "v3", "authorId": "1138138158949732483" } -] +] \ No newline at end of file diff --git a/package.json b/package.json index b0660fe..d92465b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "dependencies": { "@libsql/client": "^0.8.0", "@prisma/adapter-libsql": "^5.18.0", - "@prisma/client": "^5.18.0" + "@prisma/client": "^5.18.0", + "dotenv": "^16.4.5" }, "devDependencies": { "@types/node": "^22.5.0", diff --git a/update_nodes.ts b/update_nodes.ts index c646488..af34b29 100644 --- a/update_nodes.ts +++ b/update_nodes.ts @@ -2,6 +2,7 @@ const fs = require('fs'); const { PrismaClient } = require('@prisma/client'); const { PrismaLibSQL } = require('@prisma/adapter-libsql'); const { createClient } = require('@libsql/client'); +require('dotenv').config(); const libsql = createClient({ url: process.env.TURSO_DATABASE_URL || '',