mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-18 14:16:36 +02:00
Fix package commands by adding .argument() call
This commit is contained in:
parent
21b52a99a0
commit
afba008363
|
@ -171,7 +171,7 @@ async function navigate(routeName: string, params: any = {}) {
|
|||
}
|
||||
|
||||
function switchToChannel(channel: ClientChan) {
|
||||
return void navigate("RoutedChat", {id: channel.id});
|
||||
void navigate("RoutedChat", {id: channel.id});
|
||||
}
|
||||
|
||||
if ("serviceWorker" in navigator) {
|
||||
|
|
|
@ -2,7 +2,7 @@ import socket from "../socket";
|
|||
import {switchToChannel, navigate} from "../router";
|
||||
import {store} from "../store";
|
||||
|
||||
socket.on("quit", function (data) {
|
||||
socket.on("quit", async function (data) {
|
||||
// If we're in a channel, and it's on the network that is being removed,
|
||||
// then open another channel window
|
||||
const isCurrentNetworkBeingRemoved =
|
||||
|
@ -17,6 +17,6 @@ socket.on("quit", function (data) {
|
|||
if (store.state.networks.length > 0) {
|
||||
switchToChannel(store.state.networks[0].channels[0]);
|
||||
} else {
|
||||
navigate("Connect");
|
||||
await navigate("Connect");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,9 +9,10 @@ import {Command} from "commander";
|
|||
const program = new Command("install");
|
||||
program
|
||||
.usage("install <package>")
|
||||
.argument("<package>", "package to install")
|
||||
.description("Install a theme or a package")
|
||||
.on("--help", Utils.extraHelp)
|
||||
.action(async function (packageName) {
|
||||
.action(async function (packageName: string) {
|
||||
const fs = await import("fs");
|
||||
const fspromises = fs.promises;
|
||||
const path = await import("path");
|
||||
|
@ -31,7 +32,7 @@ program
|
|||
isLocalFile = true;
|
||||
readFile = fspromises
|
||||
.readFile(path.join(packageName.substr("file:".length), "package.json"), "utf-8")
|
||||
.then((data) => JSON.parse(data));
|
||||
.then((data) => JSON.parse(data) as typeof packageJson);
|
||||
} else {
|
||||
const split = packageName.split("@");
|
||||
packageName = split[0];
|
||||
|
|
|
@ -7,10 +7,13 @@ import Utils from "./utils";
|
|||
const program = new Command("uninstall");
|
||||
program
|
||||
.usage("uninstall <package>")
|
||||
.argument("<package>", "The package to uninstall")
|
||||
.description("Uninstall a theme or a package")
|
||||
.on("--help", Utils.extraHelp)
|
||||
.action(function (packageName) {
|
||||
.action(function (packageName: string) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const fs = require("fs");
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const path = require("path");
|
||||
|
||||
const packagesConfig = path.join(Config.getPackagesPath(), "package.json");
|
||||
|
@ -20,20 +23,22 @@ program
|
|||
!packages.dependencies ||
|
||||
!Object.prototype.hasOwnProperty.call(packages.dependencies, packageName)
|
||||
) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
log.warn(`${colors.green(packageName)} is not installed.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
log.info(`Uninstalling ${colors.green(packageName)}...`);
|
||||
|
||||
return Utils.executeYarnCommand("remove", packageName)
|
||||
.then(() => {
|
||||
try {
|
||||
void Utils.executeYarnCommand("remove", packageName).then(() => {
|
||||
log.info(`${colors.green(packageName)} has been successfully uninstalled.`);
|
||||
})
|
||||
.catch((code) => {
|
||||
log.error(`Failed to uninstall ${colors.green(packageName)}. Exit code: ${code}`);
|
||||
process.exit(1);
|
||||
});
|
||||
} catch (code_1) {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
log.error(`Failed to uninstall ${colors.green(packageName)}. Exit code: ${code_1}`);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
export default program;
|
||||
|
|
|
@ -8,6 +8,7 @@ import Utils from "./utils";
|
|||
const program = new Command("upgrade");
|
||||
program
|
||||
.usage("upgrade [packages...]")
|
||||
.arguments("[packages...]")
|
||||
.description("Upgrade installed themes and packages to their latest versions")
|
||||
.on("--help", Utils.extraHelp)
|
||||
.action(function (packages) {
|
||||
|
|
|
@ -9,6 +9,7 @@ program
|
|||
.description("List all users")
|
||||
.on("--help", Utils.extraHelp)
|
||||
.action(function () {
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const ClientManager = require("../../clientManager");
|
||||
const users = new ClientManager().getUsers();
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ program
|
|||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const ClientManager = require("../../clientManager");
|
||||
const manager = new ClientManager();
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ program
|
|||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const ClientManager = require("../../clientManager");
|
||||
const users = new ClientManager().getUsers();
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
import _ from "lodash";
|
||||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ import _ from "lodash";
|
|||
import {IrcEventHandler} from "../../client";
|
||||
|
||||
import Msg, {MessageType} from "../../models/msg";
|
||||
import User from "../../models/user";
|
||||
|
||||
export default <IrcEventHandler>function (irc, network) {
|
||||
const client = this;
|
||||
|
@ -35,6 +34,7 @@ export default <IrcEventHandler>function (irc, network) {
|
|||
|
||||
const msg = new Msg({
|
||||
type: MessageType.MODE_CHANNEL,
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
text: `${data.raw_modes} ${data.raw_params.join(" ")}`,
|
||||
});
|
||||
targetChan.pushMessage(client, msg);
|
||||
|
|
|
@ -13,6 +13,7 @@ export default <IrcEventHandler>function (irc, network) {
|
|||
|
||||
const lobby = network.channels[0];
|
||||
const msg = new Msg({
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
text: `You're now known as ${data.new_nick}`,
|
||||
});
|
||||
lobby.pushMessage(client, msg, true);
|
||||
|
|
2
src/types/modules/irc-framework.d.ts
vendored
2
src/types/modules/irc-framework.d.ts
vendored
|
@ -1,5 +1,5 @@
|
|||
// @ts-nocheck
|
||||
// @eslint-disable
|
||||
// eslint-disable
|
||||
|
||||
// https://raw.githubusercontent.com/eternagame/HTML-Chat/vue-rewrite/src/app/types/modules/irc-framework/irc-framework.d.ts
|
||||
// TODO: Fix this
|
||||
|
|
8
src/types/socket-events.d.ts
vendored
8
src/types/socket-events.d.ts
vendored
|
@ -1,6 +1,7 @@
|
|||
import {ClientNetwork} from "../../client/js/types";
|
||||
import {ClientMessage, ClientNetwork} from "../../client/js/types";
|
||||
import {Mention} from "../client";
|
||||
import Msg from "../models/msg";
|
||||
import Network from "../models/network";
|
||||
import {ChangelogData} from "../plugins/changelog";
|
||||
import {ClientConfiguration} from "../server";
|
||||
|
||||
|
@ -37,7 +38,6 @@ interface ServerToClientEvents {
|
|||
"mentions:list": (data: Mention[]) => void;
|
||||
|
||||
"setting:new": ({name: string, value: any}) => void;
|
||||
|
||||
"setting:all": (settings: {[key: string]: any}) => void;
|
||||
|
||||
more: ({
|
||||
|
@ -61,6 +61,10 @@ interface ServerToClientEvents {
|
|||
networks: ClientNetwork[];
|
||||
token: string;
|
||||
}) => void;
|
||||
|
||||
"search:results": (response: {results: ClientMessage[]}) => void;
|
||||
|
||||
quit: ({network}: {network: string}) => void;
|
||||
}
|
||||
|
||||
interface ClientToServerEvents {
|
||||
|
|
2
test/fixtures/.thelounge/sts-policies.json
vendored
2
test/fixtures/.thelounge/sts-policies.json
vendored
|
@ -3,6 +3,6 @@
|
|||
"host": "irc.example.com",
|
||||
"port": 7000,
|
||||
"duration": 3600,
|
||||
"expires": 1654030206992
|
||||
"expires": 1654030493590
|
||||
}
|
||||
]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
"use strict";
|
||||
|
||||
import {expect} from "chai";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"use strict";
|
||||
|
||||
import util from "util";
|
||||
import _ from "lodash";
|
||||
import express from "express";
|
||||
import Network from "../src/models/network";
|
||||
import Chan from "../src/models/chan";
|
||||
import {EventEmitter} from "events";
|
||||
import {Message} from "../src/models/msg";
|
||||
|
||||
class MockClient extends EventEmitter {
|
||||
config: {
|
||||
|
@ -29,7 +29,7 @@ class MockClient extends EventEmitter {
|
|||
previews: [],
|
||||
},
|
||||
opts
|
||||
);
|
||||
) as Message;
|
||||
|
||||
return message;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue