From c5944527111aa57e59e029bc984bdbb869fad337 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 20:54:57 +0100 Subject: [PATCH 01/10] Create node.yml --- .github/workflows/node.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/node.yml diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml new file mode 100644 index 00000000..5077ec66 --- /dev/null +++ b/.github/workflows/node.yml @@ -0,0 +1,39 @@ +# 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, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./website + + strategy: + matrix: + node-version: [18.20.2, 20.x] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: "web: install" + run: yarn install --immutable --immutable-cache --check-cache + - name: "web: lint" + run: yarn lint + - name: "web: build" + run: yarn build + + - name: "server: install" + working-directory: ./server + run: yarn install --immutable --immutable-cache --check-cache + - name: "server: lint" + working-directory: ./server + run: yarn lint From 3813c16cac2fab634d33d19f1d09b4ca44198ac2 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 21:06:48 +0100 Subject: [PATCH 02/10] Update node.yml --- .github/workflows/node.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 5077ec66..8f53ad69 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -14,26 +14,23 @@ jobs: strategy: matrix: - node-version: [18.20.2, 20.x] + folder: [website, server] steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - run: cd ${{ matrix.folder }} + - name: Use Node.js 18.20.2 uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} + node-version: 18.20.2 cache: 'yarn' - - name: "web: install" + - name: "${{ matrix.folder }}: install" run: yarn install --immutable --immutable-cache --check-cache - - name: "web: lint" + working-directory: ./${{ matrix.folder }} + - name: "${{ matrix.folder }}: lint" run: yarn lint - - name: "web: build" + working-directory: ./${{ matrix.folder }} + - name: "${{ matrix.folder }}: build" run: yarn build - - - name: "server: install" - working-directory: ./server - run: yarn install --immutable --immutable-cache --check-cache - - name: "server: lint" - working-directory: ./server - run: yarn lint + working-directory: ./${{ matrix.folder }} From 2d67769b0914e285b5273860acace366f90c2c27 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 21:13:26 +0100 Subject: [PATCH 03/10] Update node.yml --- .github/workflows/node.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 8f53ad69..e2ec505f 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -18,6 +18,7 @@ jobs: steps: - uses: actions/checkout@v4 + - run: ls -la - run: cd ${{ matrix.folder }} - name: Use Node.js 18.20.2 uses: actions/setup-node@v3 From 2571c80ac2473cd8a711dfe08051ef36d93c17f5 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 21:14:43 +0100 Subject: [PATCH 04/10] me when i'm stupid --- .github/workflows/node.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index e2ec505f..01b476b8 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -8,10 +8,7 @@ on: [push, pull_request] jobs: build: runs-on: ubuntu-latest - defaults: - run: - working-directory: ./website - + strategy: matrix: folder: [website, server] From 1dee2a89d8063d52473a4885104f5eeda144e03d Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 21:18:53 +0100 Subject: [PATCH 05/10] hey do you like this folder --- .github/workflows/node.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 01b476b8..73f0da40 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -15,13 +15,12 @@ jobs: steps: - uses: actions/checkout@v4 - - run: ls -la - - run: cd ${{ matrix.folder }} - name: Use Node.js 18.20.2 uses: actions/setup-node@v3 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 From 2aca86ac74fb2916665d2d44775e92088a4ea1b6 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 21:22:39 +0100 Subject: [PATCH 06/10] Update node.yml to only push events --- .github/workflows/node.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 73f0da40..42ddff06 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -3,7 +3,7 @@ name: lint_build -on: [push, pull_request] +on: push jobs: build: From 70d1fd6544ea2723fbe004570f8acf0c8c3f3c04 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 21:26:21 +0100 Subject: [PATCH 07/10] add commands to server directory --- server/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/package.json b/server/package.json index cf75363b..ca82a0e4 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": "", From 1d039ab3661969e0987a64cd6f5219857a0cec68 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 21:33:22 +0100 Subject: [PATCH 08/10] cleaning up server see https://github.com/zusorio/slmngg-sfc/commit/c4513f21f031084d4322e45d742b64f7f2fdf63d --- .github/workflows/node.yml | 1 + server/.eslintrc.json | 3 ++- server/src/{ => _deprecated}/airtable-interface.js | 6 +++--- server/src/{ => _deprecated}/api/EventHandler.js | 0 server/src/{discord => _deprecated}/auction.js | 0 server/src/{discord => _deprecated}/new_auction.js | 4 ++-- server/src/{ => _deprecated}/st4.js | 0 server/src/discord/staff.js | 1 + 8 files changed, 9 insertions(+), 6 deletions(-) rename server/src/{ => _deprecated}/airtable-interface.js (98%) rename server/src/{ => _deprecated}/api/EventHandler.js (100%) rename server/src/{discord => _deprecated}/auction.js (100%) rename server/src/{discord => _deprecated}/new_auction.js (99%) rename server/src/{ => _deprecated}/st4.js (100%) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 42ddff06..790648d3 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: folder: [website, server] 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/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"); From 6391a79116a3919f2000e4b449c964958441791f Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 21:35:13 +0100 Subject: [PATCH 09/10] go away deprecated files i should just delete --- server/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/package.json b/server/package.json index ca82a0e4..add7e1cc 100644 --- a/server/package.json +++ b/server/package.json @@ -6,7 +6,7 @@ "scripts": { "serve-server": "nodemon src/index.js", "register-commands": "node src/discord/register-slash-commands.js", - "lint": "eslint --ext .js,.ts --ignore-path .gitignore --ignore-pattern \"_deprecated/*\" --fix src --quiet", + "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", From 7e65fb366c0f9423dc5b0dcafdf864950fd31824 Mon Sep 17 00:00:00 2001 From: Solomon Cammack Date: Wed, 1 May 2024 21:37:17 +0100 Subject: [PATCH 10/10] avoid v16 warnings --- .github/workflows/node.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 790648d3..d842e250 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Use Node.js 18.20.2 - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18.20.2 cache: 'yarn'