This commit is contained in:
Max Leiter 2022-05-31 13:56:33 -07:00
parent 96aa50c673
commit 3d4d29bca4
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
5 changed files with 31 additions and 18 deletions

View file

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import log from "../log"; import log from "../log";
import colors from "chalk"; import colors from "chalk";
import semver from "semver"; import semver from "semver";
@ -5,6 +6,13 @@ import Helper from "../helper";
import Config from "../config"; import Config from "../config";
import Utils from "./utils"; import Utils from "./utils";
import {Command} from "commander"; import {Command} from "commander";
import {FullMetadata} from "package-json";
type CustomMetadata = FullMetadata & {
thelounge: {
supports: string;
};
};
const program = new Command("install"); const program = new Command("install");
program program
@ -50,7 +58,7 @@ program
} }
readFile readFile
.then((json) => { .then((json: CustomMetadata) => {
const humanVersion = isLocalFile ? packageName : `${json.name} v${json.version}`; const humanVersion = isLocalFile ? packageName : `${json.name} v${json.version}`;
if (!("thelounge" in json)) { if (!("thelounge" in json)) {

View file

@ -8,9 +8,8 @@ program
.usage("list") .usage("list")
.description("List all users") .description("List all users")
.on("--help", Utils.extraHelp) .on("--help", Utils.extraHelp)
.action(function () { .action(async function () {
// eslint-disable-next-line @typescript-eslint/no-var-requires const ClientManager = (await import("../../clientManager")).default;
const ClientManager = require("../../clientManager");
const users = new ClientManager().getUsers(); const users = new ClientManager().getUsers();
if (users === undefined) { if (users === undefined) {

View file

@ -1,4 +1,5 @@
import Client from "../../client"; import Client from "../../client";
import log from "../../log";
import Chan, {Channel} from "../../models/chan"; import Chan, {Channel} from "../../models/chan";
import Network, {NetworkWithIrcFramework} from "../../models/network"; import Network, {NetworkWithIrcFramework} from "../../models/network";
import {PackageInfo} from "../packages"; import {PackageInfo} from "../packages";
@ -59,19 +60,23 @@ const builtInInputs = [
]; ];
for (const input of builtInInputs) { for (const input of builtInInputs) {
import(`./${input}`).then( import(`./${input}`)
(plugin: { .then(
default: { (plugin: {
commands: string[]; default: {
input: (network: Network, chan: Chan, cmd: string, args: string[]) => void; commands: string[];
allowDisconnected?: boolean; input: (network: Network, chan: Chan, cmd: string, args: string[]) => void;
}; allowDisconnected?: boolean;
}) => { };
plugin.default.commands.forEach((command: string) => }) => {
userInputs.set(command, plugin.default) plugin.default.commands.forEach((command: string) =>
); userInputs.set(command, plugin.default)
} );
); }
)
.catch((err) => {
log.error(err);
});
} }
// .reduce(async function (plugins, name) { // .reduce(async function (plugins, name) {

View file

@ -3,6 +3,6 @@
"host": "irc.example.com", "host": "irc.example.com",
"port": 7000, "port": 7000,
"duration": 3600, "duration": 3600,
"expires": 1654033556780 "expires": 1654033745673
} }
] ]

View file

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-empty-function */
"use strict"; "use strict";
import {expect} from "chai"; import {expect} from "chai";