diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml new file mode 100644 index 00000000..d842e250 --- /dev/null +++ b/.github/workflows/node.yml @@ -0,0 +1,34 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: lint_build + +on: push + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + folder: [website, server] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 18.20.2 + uses: actions/setup-node@v4 + with: + node-version: 18.20.2 + cache: 'yarn' + cache-dependency-path: ./${{ matrix.folder }}/yarn.lock + + - name: "${{ matrix.folder }}: install" + run: yarn install --immutable --immutable-cache --check-cache + working-directory: ./${{ matrix.folder }} + - name: "${{ matrix.folder }}: lint" + run: yarn lint + working-directory: ./${{ matrix.folder }} + - name: "${{ matrix.folder }}: build" + run: yarn build + working-directory: ./${{ matrix.folder }} diff --git a/server/.eslintrc.json b/server/.eslintrc.json index 7699bca7..489beeee 100644 --- a/server/.eslintrc.json +++ b/server/.eslintrc.json @@ -28,6 +28,7 @@ "no-unused-vars": [ "warn" ], - "no-multiple-empty-lines": ["warn", { "max": 2 }] + "no-multiple-empty-lines": ["warn", { "max": 2 }], + "no-useless-escape": ["warn"] } } diff --git a/server/package.json b/server/package.json index cf75363b..add7e1cc 100644 --- a/server/package.json +++ b/server/package.json @@ -5,7 +5,9 @@ "main": "index.js", "scripts": { "serve-server": "nodemon src/index.js", - "register-commands": "node src/discord/register-slash-commands.js" + "register-commands": "node src/discord/register-slash-commands.js", + "lint": "eslint --ext .js,.ts --ignore-path .gitignore --ignore-pattern \"**/_deprecated/*\" --fix src --quiet", + "build": "echo \"No build stage for server - skipping\"" }, "repository": "git+https://github.com/slmnio/slmngg-server.git", "author": "", diff --git a/server/src/airtable-interface.js b/server/src/_deprecated/airtable-interface.js similarity index 98% rename from server/src/airtable-interface.js rename to server/src/_deprecated/airtable-interface.js index 3beb7821..bcd244fa 100644 --- a/server/src/airtable-interface.js +++ b/server/src/_deprecated/airtable-interface.js @@ -1,6 +1,6 @@ const Airtable = require("airtable"); const airtable = new Airtable({ apiKey: process.env.AIRTABLE_KEY }); -const Cache = require("./cache.js"); +const Cache = require("../cache.js"); const slmngg = airtable.base(process.env.AIRTABLE_APP); const ora = require("ora"); const chalk = require("chalk"); @@ -168,8 +168,8 @@ async function processTableData(tableName, data, linkRecords = false) { customTableUpdate(tableName, Cache); } -const customTableUpdate = require("./custom-datasets"); -const { log } = require("./discord/slmngg-log"); +const customTableUpdate = require("../custom-datasets.js"); +const { log } = require("../discord/slmngg-log.js"); function registerUpdater(tableName, options) { let pollRate = 5000; diff --git a/server/src/api/EventHandler.js b/server/src/_deprecated/api/EventHandler.js similarity index 100% rename from server/src/api/EventHandler.js rename to server/src/_deprecated/api/EventHandler.js diff --git a/server/src/discord/auction.js b/server/src/_deprecated/auction.js similarity index 100% rename from server/src/discord/auction.js rename to server/src/_deprecated/auction.js diff --git a/server/src/discord/new_auction.js b/server/src/_deprecated/new_auction.js similarity index 99% rename from server/src/discord/new_auction.js rename to server/src/_deprecated/new_auction.js index 8d33f139..c2bbda83 100644 --- a/server/src/discord/new_auction.js +++ b/server/src/_deprecated/new_auction.js @@ -1,6 +1,6 @@ -const client = require("./client.js"); +const client = require("../discord/client.js"); const Cache = require("../cache.js"); -const { update, select } = require("../airtable-interface.js"); +const { update, select } = require("./airtable-interface.js"); const Discord = require("discord.js"); let io; diff --git a/server/src/st4.js b/server/src/_deprecated/st4.js similarity index 100% rename from server/src/st4.js rename to server/src/_deprecated/st4.js diff --git a/server/src/discord/staff.js b/server/src/discord/staff.js index 53280bf3..3408bdec 100644 --- a/server/src/discord/staff.js +++ b/server/src/discord/staff.js @@ -1,3 +1,4 @@ +/* eslint-disable */ /* BPL Staff Automation */ const client = require("./client.js");