From fd35656f13631c9faa2ddba28d793f1e0154cb14 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Tue, 6 Apr 2021 22:27:54 +0200 Subject: [PATCH 1/7] fix(index)!: remove serviceClasses BREAKING CHANGE: serviceClasses will no longer be an exported member of the package. --- src/index.ts | 1 - tests/index.test.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2ae63c95..5d3834f8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,4 +10,3 @@ export * as Util from './Utils/Util' export { Service } export const getService = Service.get -export const serviceClasses = Service.getAll() diff --git a/tests/index.test.ts b/tests/index.test.ts index f61eabe3..e07b1194 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -11,6 +11,5 @@ describe('Library exports', () => { expect(typeof dbots.Util).toBe('object') expect(typeof dbots.Service).toBe('function') expect(typeof dbots.getService).toBe('function') - expect(typeof dbots.serviceClasses).toBe('object') }) }) From d1caecd5b4b9e81ce3f2d13260aaa4f3f35740cd Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Tue, 6 Apr 2021 22:36:18 +0200 Subject: [PATCH 2/7] docs: add example on service classes --- docs/examples/service-class.js | 14 ++++++++++++++ docs/index.yml | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 docs/examples/service-class.js diff --git a/docs/examples/service-class.js b/docs/examples/service-class.js new file mode 100644 index 00000000..629a0f71 --- /dev/null +++ b/docs/examples/service-class.js @@ -0,0 +1,14 @@ +const dbots = require('dbots') + +// You can get the service class through the Service util, using a service alias +const TopGG = dbots.Service.get('topgg') + +// You can craete an instance using your token, that will allow you to access the API +const serviceInstance = new TopGG('your-token') + +// You can then use every method listed in the class docs +serviceInstance.getBot('bot-id') + .then(data => { + // ... + }) + .catch(console.error) diff --git a/docs/index.yml b/docs/index.yml index 36051036..938defbd 100644 --- a/docs/index.yml +++ b/docs/index.yml @@ -16,3 +16,5 @@ path: no-client.js - name: Custom Services path: custom-service.js + - name: Using Service classes + path: service-class.js From 94917046b70b1222be421726757563f2f3eaafe5 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 7 Apr 2021 12:22:22 +0200 Subject: [PATCH 3/7] fix: improve typings on Service.get --- .eslintrc.js | 10 ++- package.json | 1 + scripts/list-index.ts | 49 ++++++++++++++ src/Interface/ListIndex.ts | 107 ++++++++++++++++++++++++++++++ src/Interface/Service.ts | 6 ++ tests/Interface/ListIndex.test.ts | 40 +++++++++++ 6 files changed, 210 insertions(+), 3 deletions(-) create mode 100644 scripts/list-index.ts create mode 100644 src/Interface/ListIndex.ts create mode 100644 tests/Interface/ListIndex.test.ts diff --git a/.eslintrc.js b/.eslintrc.js index e5844508..ba5dd5d0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,9 +15,13 @@ module.exports = { plugins: ['@typescript-eslint', 'jest'], rules: { 'prettier/prettier': 'warn', - 'no-cond-assign': [2, 'except-parens'], - 'no-unused-vars': 0, - '@typescript-eslint/no-unused-vars': 1, + 'no-cond-assign': ['error', 'except-parens'], + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'warn', + 'no-redeclare': 'off', + '@typescript-eslint/no-redeclare': 'warn', + 'no-dupe-class-members': 'off', + '@typescript-eslint/no-dupe-class-members': 'warn', 'no-empty': [ 'error', { diff --git a/package.json b/package.json index 37ec1393..152c52ff 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "jsdelivr": "./webpack/dbots.min.js", "scripts": { "build": "([ ! -d \"lib/\" ] || rm -r lib/*) && npx tsc", + "build:source": "npx ts-node scripts/list-index", "build:prepare": "[ -d \"lib/\" ] || npm run build", "changelog": "ts-node scripts/changelog && npm i --package-lock-only", "docs": "ts-node scripts/docs", diff --git a/scripts/list-index.ts b/scripts/list-index.ts new file mode 100644 index 00000000..6f61524d --- /dev/null +++ b/scripts/list-index.ts @@ -0,0 +1,49 @@ +import path from 'path' +import fs from 'fs' + +const sourcePath = path.join(__dirname, '../src/Interface/ListIndex.ts') +const listsPath = path.join(__dirname, '../src/Interface/Lists') + +var before = '', + after = '', + state = 'before' +fs.readFileSync(sourcePath, { encoding: 'utf-8' }) + .split('\n') + .map((l) => l + '\n') + .forEach((line) => { + if (line.startsWith('// +// This section is automatically generated by the 'build:source' script, any change will be overwritten + +${files + .map((filename) => { + const { name } = path.parse(filename) + return `import ${name} from './Lists/${name}'` + }) + .join('\n')} + +// prettier-ignore +export const serviceList = { +${files + .map((filename) => { + const clarse = require(path.join('../src/Interface/Lists', filename)) + .default + return clarse.aliases + ?.map((alias: string) => ` '${alias}': ${path.parse(filename).name},`) + .join('\n') + }) + .join('\n')} +} +// + +` + +fs.writeFileSync(sourcePath, before.trim() + content + after.trim() + '\n') diff --git a/src/Interface/ListIndex.ts b/src/Interface/ListIndex.ts new file mode 100644 index 00000000..361c2158 --- /dev/null +++ b/src/Interface/ListIndex.ts @@ -0,0 +1,107 @@ +// #region Generated code// +// This section is automatically generated by the 'build:source' script, any change will be overwritten + +import Arcane from './Lists/Arcane' +import AstroBotList from './Lists/AstroBotList' +import BladeBotList from './Lists/BladeBotList' +import Blist from './Lists/Blist' +import BotListSpace from './Lists/BotListSpace' +import BotsDataBase from './Lists/BotsDataBase' +import BotsForDiscord from './Lists/BotsForDiscord' +import BotsOnDiscord from './Lists/BotsOnDiscord' +import Carbon from './Lists/Carbon' +import DBots from './Lists/DBots' +import DiscordAppsDev from './Lists/DiscordAppsDev' +import DiscordBoats from './Lists/DiscordBoats' +import DiscordBotDirectory from './Lists/DiscordBotDirectory' +import DiscordBotList from './Lists/DiscordBotList' +import DiscordBotsCo from './Lists/DiscordBotsCo' +import DiscordBotsGG from './Lists/DiscordBotsGG' +import DiscordExtremeList from './Lists/DiscordExtremeList' +import DiscordLabs from './Lists/DiscordLabs' +import DiscordListology from './Lists/DiscordListology' +import DiscordServices from './Lists/DiscordServices' +import Disforge from './Lists/Disforge' +import FatesList from './Lists/FatesList' +import GlennBotList from './Lists/GlennBotList' +import InfinityBotList from './Lists/InfinityBotList' +import ListMyBots from './Lists/ListMyBots' +import ParadiseBots from './Lists/ParadiseBots' +import SpaceBotsList from './Lists/SpaceBotsList' +import TopCord from './Lists/TopCord' +import TopGG from './Lists/TopGG' +import VoidBots from './Lists/VoidBots' +import WonderBotList from './Lists/WonderBotList' +import YABL from './Lists/YABL' + +// prettier-ignore +export const serviceList = { + 'arcane': Arcane, + 'arcane-center.xyz': Arcane, + 'astrobotlist': AstroBotList, + 'botlists.com': AstroBotList, + 'bladebotlist': BladeBotList, + 'bladebotlist.xyz': BladeBotList, + 'blist': Blist, + 'blist.xyz': Blist, + 'botlistspace': BotListSpace, + 'botlist.space': BotListSpace, + 'botsdatabase': BotsDataBase, + 'botsdatabase.com': BotsDataBase, + 'botsfordiscord': BotsForDiscord, + 'botsfordiscord.com': BotsForDiscord, + 'botsondiscord': BotsOnDiscord, + 'bots.ondiscord.xyz': BotsOnDiscord, + 'carbonitex': Carbon, + 'carbonitex.net': Carbon, + 'carbon': Carbon, + 'dbots': DBots, + 'dbots.co': DBots, + 'discordappsdev': DiscordAppsDev, + 'discordapps.dev': DiscordAppsDev, + 'discordboats': DiscordBoats, + 'discord.boats': DiscordBoats, + 'discordbotdirectory': DiscordBotDirectory, + 'discordbotdirectory.net': DiscordBotDirectory, + 'discordbotlist': DiscordBotList, + 'discordbotlist.com': DiscordBotList, + 'discordbotsco': DiscordBotsCo, + 'discordbots.co': DiscordBotsCo, + 'discordbotsgg': DiscordBotsGG, + 'discord.bots.gg': DiscordBotsGG, + 'discordextremelist': DiscordExtremeList, + 'discordextremelist.xyz': DiscordExtremeList, + 'discordlabs': DiscordLabs, + 'discordlabs.org': DiscordLabs, + 'discordlistology': DiscordListology, + 'discordlistology.com': DiscordListology, + 'discordservices': DiscordServices, + 'discordservices.net': DiscordServices, + 'disforge': Disforge, + 'disforge.com': Disforge, + 'fateslist': FatesList, + 'fateslist.xyz': FatesList, + 'glennbotlist': GlennBotList, + 'glennbotlist.xyz': GlennBotList, + 'infinitybotlist': InfinityBotList, + 'infinitybotlist.com': InfinityBotList, + 'listmybots': ListMyBots, + 'listmybots.com': ListMyBots, + 'paradisebots': ParadiseBots, + 'paradisebots.net': ParadiseBots, + 'spacebotslist': SpaceBotsList, + 'space-bot-list.xyz': SpaceBotsList, + 'topcord': TopCord, + 'topcord.xyz': TopCord, + 'topgg': TopGG, + 'top.gg': TopGG, + 'voidbots': VoidBots, + 'voidbots.net': VoidBots, + 'wonderbotlist': WonderBotList, + 'wonderbotlist.com': WonderBotList, + 'yabl': YABL, + 'yabl.xyz': YABL, +} +// + +// #endregion diff --git a/src/Interface/Service.ts b/src/Interface/Service.ts index c90bc259..417de1c0 100644 --- a/src/Interface/Service.ts +++ b/src/Interface/Service.ts @@ -6,6 +6,7 @@ const { Error } = errors import buildURL from 'axios/lib/helpers/buildURL' import { CustomService, Query, Shard } from '../Utils/Constants' import { assert, CountResolvable, IDResolvable } from '../Utils/Util' +import { serviceList } from './ListIndex' /** Options provided when sending a service request */ export interface ServiceRequestOptions { @@ -62,6 +63,11 @@ export class Service { * @param key The name of the service to get * @param extras An array of {@link CustomService}s to include */ + static get( + key: T, + extras?: CustomService[] + ): typeof serviceList[T] + static get(key: string, extras?: CustomService[]): typeof Service | null static get(key: string, extras: CustomService[] = []): typeof Service | null { if (!key || typeof key !== 'string') return null diff --git a/tests/Interface/ListIndex.test.ts b/tests/Interface/ListIndex.test.ts new file mode 100644 index 00000000..e5ffdd47 --- /dev/null +++ b/tests/Interface/ListIndex.test.ts @@ -0,0 +1,40 @@ +import { Service } from '../../src/Interface/Service' +import * as ListIndexModule from '../../src/Interface/ListIndex' +import { AnyObject } from '../../src/Utils/Util' + +describe('ListIndex module', () => { + describe('serviceList constant', () => { + const { serviceList } = ListIndexModule + + it('should be an object', () => { + expect(typeof serviceList).toBe('object') + }) + + it('should be a Record', () => { + expect( + Object.keys(serviceList).every((s) => typeof s == 'string') + ).toBeTruthy() + expect( + Object.values(serviceList).every((f) => typeof f == 'function') + ).toBeTruthy() + }) + + describe('should only contain existing services', () => { + Object.entries(serviceList).forEach(([alias, clarse]) => { + test(alias, () => { + expect(Service.get(alias)).toEqual(clarse) + }) + }) + }) + + describe('should contain every existing alias', () => { + Object.values(Service.getAll()).forEach((clarse) => { + clarse.aliases.forEach((alias) => { + test(alias, () => { + expect((serviceList as AnyObject)[alias]).toEqual(clarse) + }) + }) + }) + }) + }) +}) From 637461199402c9cfd5ce3bb87801bbf305ddb435 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 7 Apr 2021 16:19:18 +0200 Subject: [PATCH 4/7] docs(Service): fix overload order for website docs --- package-lock.json | 190 +++++++++++++-------------------------- src/Interface/Service.ts | 2 +- 2 files changed, 65 insertions(+), 127 deletions(-) diff --git a/package-lock.json b/package-lock.json index dec2b6ac..b50dea01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -882,18 +882,6 @@ "node": ">=8" } }, - "node_modules/@jest/core/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/@jest/core/node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -3857,12 +3845,6 @@ "node": ">=8" } }, - "node_modules/eslint/node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "node_modules/eslint/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -4465,18 +4447,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/flat-cache/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/flatted": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz", @@ -7292,8 +7262,10 @@ "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, "dependencies": { - "graceful-fs": "^4.1.6", "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" } }, "node_modules/jsprim": { @@ -7640,9 +7612,9 @@ } }, "node_modules/lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, "node_modules/lodash.sortby": { @@ -9041,6 +9013,21 @@ "node": ">=0.10.0" } }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/rsvp": { "version": "4.8.5", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", @@ -10162,18 +10149,6 @@ "node": ">=8.17.0" } }, - "node_modules/tmp/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, "node_modules/tmpl": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", @@ -10268,8 +10243,10 @@ } }, "node_modules/ts-docgen": { - "resolved": "git+ssh://git@github.com/dbots-pkg/ts-docgen.git#f8c6ae74e4c137da3ad112f9eaad158896899905", + "version": "2.0.1", + "resolved": "git+ssh://git@github.com/dbots-pkg/ts-docgen.git#69c0fe58f4b947a0a3ec99604f47fb8f75a3d559", "dev": true, + "license": "MIT", "dependencies": { "@types/yargs": "^15.0.9", "js-yaml": "^3.14.0", @@ -10650,9 +10627,9 @@ } }, "node_modules/typedoc": { - "version": "0.20.33", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.33.tgz", - "integrity": "sha512-jzNdHmjZRQKwguhpXjIPuIjz+TpdgG2AVY8ta+qpAukv+3rBhTs4AAVd+mkonrHVYlC0EAbuAJ4urkfnn42Hwg==", + "version": "0.20.35", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.35.tgz", + "integrity": "sha512-7sNca19LXg2hgyGHq3b33tQ1YFApmd8aBDEzWQ2ry4VDkw/NdFWkysGiGRY1QckDCB0gVH8+MlXA4K71IB3azg==", "dev": true, "dependencies": { "colors": "^1.4.0", @@ -10672,12 +10649,15 @@ }, "engines": { "node": ">= 10.8.0" + }, + "peerDependencies": { + "typescript": "3.9.x || 4.0.x || 4.1.x || 4.2.x" } }, "node_modules/typedoc-default-themes": { - "version": "0.12.9", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.9.tgz", - "integrity": "sha512-Jd5fYTiqzinZdoIY382W7tQXTwAzWRdg8KbHfaxmb78m1/3jL9riXtk23oBOKwhi8GFVykCOdPzEJKY87/D0LQ==", + "version": "0.12.10", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", + "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", "dev": true, "engines": { "node": ">= 8" @@ -10689,12 +10669,6 @@ "integrity": "sha512-M7nC4i42HOGmbZValMq99Uh5gNJoaOYif5/p/CQR3kXOD3E1qaPu1Aj1MHdRwHE2V1yUeeEbILQVMMkkLJ4JuQ==", "dev": true }, - "node_modules/typedoc/node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "node_modules/typescript": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.3.tgz", @@ -10709,9 +10683,9 @@ } }, "node_modules/uglify-js": { - "version": "3.13.2", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.2.tgz", - "integrity": "sha512-SbMu4D2Vo95LMC/MetNaso1194M1htEA+JrqE9Hk+G2DhI+itfS9TRu9ZKeCahLDNa/J3n4MqUJ/fOHMzQpRWw==", + "version": "3.13.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.3.tgz", + "integrity": "sha512-otIc7O9LyxpUcQoXzj2hL4LPWKklO6LJWoJUzNa8A17Xgi4fOeDC8FBDOLHnC/Slo1CQgsZMcM6as0M76BZaig==", "dev": true, "optional": true, "bin": { @@ -10893,9 +10867,9 @@ } }, "node_modules/vscode-textmate": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", - "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.4.0.tgz", + "integrity": "sha512-c0Q4zYZkcLizeYJ3hNyaVUM2AA8KDhNCA3JvXY8CeZSJuBdAy3bAvSbv46RClC4P3dSO9BdwhnKEx2zOo6vP/w==", "dev": true }, "node_modules/w3c-hr-time": { @@ -12237,15 +12211,6 @@ "picomatch": "^2.0.5" } }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -14580,12 +14545,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -15136,17 +15095,6 @@ "requires": { "flatted": "^3.1.0", "rimraf": "^3.0.2" - }, - "dependencies": { - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } } }, "flatted": { @@ -17654,9 +17602,9 @@ "dev": true }, "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, "lodash.sortby": { @@ -18787,6 +18735,15 @@ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "rsvp": { "version": "4.8.5", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", @@ -19696,17 +19653,6 @@ "dev": true, "requires": { "rimraf": "^3.0.0" - }, - "dependencies": { - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } } }, "tmpl": { @@ -19784,7 +19730,7 @@ } }, "ts-docgen": { - "version": "git+ssh://git@github.com/dbots-pkg/ts-docgen.git#f8c6ae74e4c137da3ad112f9eaad158896899905", + "version": "git+ssh://git@github.com/dbots-pkg/ts-docgen.git#69c0fe58f4b947a0a3ec99604f47fb8f75a3d559", "dev": true, "from": "ts-docgen@github:dbots-pkg/ts-docgen#v2", "requires": { @@ -20068,9 +20014,9 @@ } }, "typedoc": { - "version": "0.20.33", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.33.tgz", - "integrity": "sha512-jzNdHmjZRQKwguhpXjIPuIjz+TpdgG2AVY8ta+qpAukv+3rBhTs4AAVd+mkonrHVYlC0EAbuAJ4urkfnn42Hwg==", + "version": "0.20.35", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.20.35.tgz", + "integrity": "sha512-7sNca19LXg2hgyGHq3b33tQ1YFApmd8aBDEzWQ2ry4VDkw/NdFWkysGiGRY1QckDCB0gVH8+MlXA4K71IB3azg==", "dev": true, "requires": { "colors": "^1.4.0", @@ -20084,20 +20030,12 @@ "shelljs": "^0.8.4", "shiki": "^0.9.3", "typedoc-default-themes": "^0.12.9" - }, - "dependencies": { - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - } } }, "typedoc-default-themes": { - "version": "0.12.9", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.9.tgz", - "integrity": "sha512-Jd5fYTiqzinZdoIY382W7tQXTwAzWRdg8KbHfaxmb78m1/3jL9riXtk23oBOKwhi8GFVykCOdPzEJKY87/D0LQ==", + "version": "0.12.10", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz", + "integrity": "sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA==", "dev": true }, "typedoc-plugin-as-member-of": { @@ -20113,9 +20051,9 @@ "dev": true }, "uglify-js": { - "version": "3.13.2", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.2.tgz", - "integrity": "sha512-SbMu4D2Vo95LMC/MetNaso1194M1htEA+JrqE9Hk+G2DhI+itfS9TRu9ZKeCahLDNa/J3n4MqUJ/fOHMzQpRWw==", + "version": "3.13.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.3.tgz", + "integrity": "sha512-otIc7O9LyxpUcQoXzj2hL4LPWKklO6LJWoJUzNa8A17Xgi4fOeDC8FBDOLHnC/Slo1CQgsZMcM6as0M76BZaig==", "dev": true, "optional": true }, @@ -20264,9 +20202,9 @@ } }, "vscode-textmate": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz", - "integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.4.0.tgz", + "integrity": "sha512-c0Q4zYZkcLizeYJ3hNyaVUM2AA8KDhNCA3JvXY8CeZSJuBdAy3bAvSbv46RClC4P3dSO9BdwhnKEx2zOo6vP/w==", "dev": true }, "w3c-hr-time": { diff --git a/src/Interface/Service.ts b/src/Interface/Service.ts index 417de1c0..2325cde9 100644 --- a/src/Interface/Service.ts +++ b/src/Interface/Service.ts @@ -63,11 +63,11 @@ export class Service { * @param key The name of the service to get * @param extras An array of {@link CustomService}s to include */ + static get(key: string, extras?: CustomService[]): typeof Service | null static get( key: T, extras?: CustomService[] ): typeof serviceList[T] - static get(key: string, extras?: CustomService[]): typeof Service | null static get(key: string, extras: CustomService[] = []): typeof Service | null { if (!key || typeof key !== 'string') return null From 4661d4e6e76a9f6ae361e4be511388ad28ce3ad8 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 7 Apr 2021 16:20:20 +0200 Subject: [PATCH 5/7] chore: npm audit fix --- package-lock.json | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index b50dea01..8ec9ca0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11306,10 +11306,13 @@ "dev": true }, "node_modules/y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.2.tgz", + "integrity": "sha512-DnBDwcL54b5xWMM/7RfFg4xs5amYxq2ot49aUfLjQSAracXkGvlZq0txzqr3Pa6Q0ayuCxBcwTzrPUScKY0O8w==", + "dev": true, + "engines": { + "node": ">=10" + } }, "node_modules/yallist": { "version": "4.0.0", @@ -20540,9 +20543,9 @@ "dev": true }, "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.2.tgz", + "integrity": "sha512-DnBDwcL54b5xWMM/7RfFg4xs5amYxq2ot49aUfLjQSAracXkGvlZq0txzqr3Pa6Q0ayuCxBcwTzrPUScKY0O8w==", "dev": true }, "yallist": { From f6faa4ade7e606235efe160ebdc4dc58160aa292 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 7 Apr 2021 16:32:45 +0200 Subject: [PATCH 6/7] fix: improve list-index script --- scripts/list-index.ts | 9 ++++++--- src/Interface/ListIndex.ts | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/list-index.ts b/scripts/list-index.ts index 6f61524d..9553c1fc 100644 --- a/scripts/list-index.ts +++ b/scripts/list-index.ts @@ -20,7 +20,8 @@ fs.readFileSync(sourcePath, { encoding: 'utf-8' }) const files = fs.readdirSync(listsPath) -const content = `// +const content = ` +// // This section is automatically generated by the 'build:source' script, any change will be overwritten ${files @@ -43,7 +44,9 @@ ${files .join('\n')} } // - ` -fs.writeFileSync(sourcePath, before.trim() + content + after.trim() + '\n') +fs.writeFileSync( + sourcePath, + before.trimLeft() + content.trim() + '\n' + after.trimRight() + '\n' +) diff --git a/src/Interface/ListIndex.ts b/src/Interface/ListIndex.ts index 361c2158..942386d2 100644 --- a/src/Interface/ListIndex.ts +++ b/src/Interface/ListIndex.ts @@ -1,4 +1,5 @@ -// #region Generated code// +// #region Generated code +// // This section is automatically generated by the 'build:source' script, any change will be overwritten import Arcane from './Lists/Arcane' @@ -103,5 +104,4 @@ export const serviceList = { 'yabl.xyz': YABL, } // - // #endregion From ccf9e7f5140284f2018a00ee0163f14d50d30767 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 7 Apr 2021 16:42:55 +0200 Subject: [PATCH 7/7] fix: update listIndex to match master --- src/Interface/ListIndex.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Interface/ListIndex.ts b/src/Interface/ListIndex.ts index 942386d2..cdb5f5c2 100644 --- a/src/Interface/ListIndex.ts +++ b/src/Interface/ListIndex.ts @@ -6,7 +6,6 @@ import Arcane from './Lists/Arcane' import AstroBotList from './Lists/AstroBotList' import BladeBotList from './Lists/BladeBotList' import Blist from './Lists/Blist' -import BotListSpace from './Lists/BotListSpace' import BotsDataBase from './Lists/BotsDataBase' import BotsForDiscord from './Lists/BotsForDiscord' import BotsOnDiscord from './Lists/BotsOnDiscord' @@ -21,6 +20,7 @@ import DiscordBotsGG from './Lists/DiscordBotsGG' import DiscordExtremeList from './Lists/DiscordExtremeList' import DiscordLabs from './Lists/DiscordLabs' import DiscordListology from './Lists/DiscordListology' +import DiscordListSpace from './Lists/DiscordListSpace' import DiscordServices from './Lists/DiscordServices' import Disforge from './Lists/Disforge' import FatesList from './Lists/FatesList' @@ -45,8 +45,6 @@ export const serviceList = { 'bladebotlist.xyz': BladeBotList, 'blist': Blist, 'blist.xyz': Blist, - 'botlistspace': BotListSpace, - 'botlist.space': BotListSpace, 'botsdatabase': BotsDataBase, 'botsdatabase.com': BotsDataBase, 'botsfordiscord': BotsForDiscord, @@ -76,6 +74,10 @@ export const serviceList = { 'discordlabs.org': DiscordLabs, 'discordlistology': DiscordListology, 'discordlistology.com': DiscordListology, + 'discordlistspace': DiscordListSpace, + 'discordlist.space': DiscordListSpace, + 'botlistspace': DiscordListSpace, + 'botlist.space': DiscordListSpace, 'discordservices': DiscordServices, 'discordservices.net': DiscordServices, 'disforge': Disforge,