Skip to content

Commit

Permalink
Bump dependencies (#694)
Browse files Browse the repository at this point in the history
* ⬆️ Bump dependencies

* 🏷️ Fix types due to discord.js update

* Use flat ESLint configuration

* Convert replacePaths script to an ES module

* 👷 Add build step in CI script

* 👷 Update dependabot configuration
  • Loading branch information
utarwyn authored Sep 25, 2024
1 parent ab49c44 commit 1427664
Show file tree
Hide file tree
Showing 11 changed files with 939 additions and 963 deletions.
28 changes: 0 additions & 28 deletions .eslintrc.json

This file was deleted.

55 changes: 39 additions & 16 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
reviewers:
- utarwyn
ignore:
- dependency-name: "@types/node"
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
time: '04:00'
open-pull-requests-limit: 10
reviewers:
- utarwyn
ignore:
- dependency-name: '@types/node'
versions: ['>=18'] # stick to node 16
groups:
minor-all:
patterns:
- '*'
exclude-patterns:
- 'typescript'
update-types:
- 'minor'
- 'patch'
major-all:
patterns:
- '*'
exclude-patterns:
- 'typescript'
update-types:
- 'major'
major-typescript:
patterns:
- 'typescript'
update-types:
- 'patch'
- 'major'

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
reviewers:
- utarwyn
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
reviewers:
- utarwyn
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
pnpm run lint
pnpm run test
- name: 📦 Build
run: pnpm run build

- name: ⛳ SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
Expand Down
13 changes: 13 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import globals from 'globals';
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, {
languageOptions: { globals: globals.node },
rules: {
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-unused-expressions': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }]
}
});
37 changes: 0 additions & 37 deletions lib/replacePaths.js

This file was deleted.

38 changes: 38 additions & 0 deletions lib/replacePaths.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Inspired from https://github.com/markokajzer/discord-soundbot
// MIT License - Copyright (c) 2020 Marko Kajzer
import { readFileSync } from 'fs';
import { dirname, join, relative } from 'path';
import { replaceInFileSync } from 'replace-in-file';

const tsconfig = JSON.parse(readFileSync('./tsconfig.json', 'utf-8'));
const pathAliases = tsconfig.compilerOptions.paths;

const from = Object.keys(pathAliases).map(key => new RegExp(`${key.split('/*')[0]}/[^'"]*`, 'g'));

const to = {};
Object.entries(pathAliases).forEach(([key, value]) => {
const match = key.split('/*')[0];
to[match] = value[0].split('/*')[0];
});

const options = {
files: ['dist/**/*.@(j|t)s'],
from,
to: (...args) => {
const [match, , , filename] = args;
const [replacePattern, ...file] = match.split('/');

const normalizedRelativePath = relative(
join(process.cwd(), dirname(filename)),
join(process.cwd(), 'dist', to[replacePattern], ...file)
);

const relativePath = normalizedRelativePath.startsWith('.')
? normalizedRelativePath
: `./${normalizedRelativePath}`;

return relativePath.replace(/\\/g, '/');
}
};

replaceInFileSync(options);
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,33 @@
"typescript"
],
"dependencies": {
"discord.js": "^14.15.3"
"discord.js": "^14.16.2"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/node": "^16.18.98",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.57.0",
"@types/jest": "^29.5.13",
"@types/node": "^16.18.108",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jest": "^28.8.3",
"globals": "^15.9.0",
"jest": "^29.7.0",
"prettier": "^3.3.2",
"replace-in-file": "^7.2.0",
"rimraf": "^5.0.7",
"ts-jest": "^29.1.4",
"typescript": "^5.4.5"
"prettier": "^3.3.3",
"replace-in-file": "^8.2.0",
"rimraf": "^6.0.1",
"ts-jest": "^29.2.5",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0"
},
"engines": {
"node": ">=18"
},
"scripts": {
"clean": "rimraf coverage dist tmp",
"build": "tsc -p tsconfig.release.json && node lib/replacePaths.js",
"build": "tsc -p tsconfig.release.json && node lib/replacePaths.mjs",
"build:watch": "tsc -w -p tsconfig.release.json",
"format:check": "prettier --check \"**/**.ts\"",
"format": "prettier --write \"**/**.ts\"",
"lint": "eslint . --ext .ts",
"lint": "eslint src",
"serve": "node dist/bin/tictactoe.js",
"start": "pnpm run build && pnpm run serve",
"test": "jest --coverage",
Expand Down
Loading

0 comments on commit 1427664

Please sign in to comment.