Update tools dependencies

This commit is contained in:
Chocobozzz 2021-06-25 17:48:27 +02:00
parent 8cc6120118
commit 12152aa09f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
10 changed files with 25 additions and 27 deletions

View File

@ -3,12 +3,12 @@ import { getAppNumber, isTestInstance } from '../helpers/core-utils'
import { join } from 'path'
import { root } from '../../shared/extra-utils/miscs/miscs'
import { getVideoChannel } from '../../shared/extra-utils/videos/video-channels'
import { CommanderStatic } from 'commander'
import { VideoChannel, VideoPrivacy } from '../../shared/models/videos'
import { createLogger, format, transports } from 'winston'
import { getMyUserInformation } from '@shared/extra-utils/users/users'
import { User, UserRole } from '@shared/models'
import { getAccessToken } from '@shared/extra-utils/users/login'
import { Command } from 'commander'
let configName = 'PeerTube/CLI'
if (isTestInstance()) configName += `-${getAppNumber()}`
@ -69,7 +69,7 @@ function deleteSettings () {
}
function getRemoteObjectOrDie (
program: CommanderStatic,
program: Command,
settings: Settings,
netrc: Netrc
): { url: string, username: string, password: string } {
@ -106,7 +106,7 @@ function getRemoteObjectOrDie (
}
}
function buildCommonVideoOptions (command: CommanderStatic) {
function buildCommonVideoOptions (command: Command) {
function list (val) {
return val.split(',')
}
@ -128,7 +128,7 @@ function buildCommonVideoOptions (command: CommanderStatic) {
.option('-v, --verbose <verbose>', 'Verbosity, from 0/\'error\' to 4/\'debug\'', 'info')
}
async function buildVideoAttributesFromCommander (url: string, command: CommanderStatic, defaultAttributes: any = {}) {
async function buildVideoAttributesFromCommander (url: string, command: Command, defaultAttributes: any = {}) {
const options = command.opts()
const defaultBooleanAttributes = {
@ -177,7 +177,7 @@ async function buildVideoAttributesFromCommander (url: string, command: Commande
return videoAttributes
}
function getServerCredentials (program: CommanderStatic) {
function getServerCredentials (program: Command) {
return Promise.all([ getSettings(), getNetrc() ])
.then(([ settings, netrc ]) => {
return getRemoteObjectOrDie(program, settings, netrc)

View File

@ -3,7 +3,7 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import * as program from 'commander'
import { OptionValues, program } from 'commander'
import * as prompt from 'prompt'
import { getNetrc, getSettings, writeSettings } from './cli'
import { isUserUsernameValid } from '../helpers/custom-validators/users'
@ -66,7 +66,7 @@ program
.option('-U, --username <username>', 'Username')
.option('-p, --password <token>', 'Password')
.option('--default', 'add the entry as the new default')
.action((options: program.OptionValues) => {
.action((options: OptionValues) => {
/* eslint-disable no-import-assign */
prompt.override = options
prompt.start()

View File

@ -1,7 +1,7 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import * as program from 'commander'
import { program } from 'commander'
import { getClient, Server, serverLogin } from '../../shared/extra-utils'
program

View File

@ -1,7 +1,7 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import * as program from 'commander'
import { program } from 'commander'
import { accessSync, constants } from 'fs'
import { remove } from 'fs-extra'
import { truncate } from 'lodash'

View File

@ -3,13 +3,12 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import * as program from 'commander'
import { program, Command, OptionValues } from 'commander'
import { installPlugin, listPlugins, uninstallPlugin, updatePlugin } from '../../shared/extra-utils/server/plugins'
import { getAdminTokenOrDie, getServerCredentials } from './cli'
import { PeerTubePlugin, PluginType } from '../../shared/models'
import { isAbsolute } from 'path'
import * as CliTable3 from 'cli-table3'
import commander = require('commander')
program
.name('plugins')
@ -62,7 +61,7 @@ program.parse(process.argv)
// ----------------------------------------------------------------------------
async function pluginsListCLI (command: commander.CommanderStatic, options: commander.OptionValues) {
async function pluginsListCLI (command: Command, options: OptionValues) {
const { url, username, password } = await getServerCredentials(command)
const accessToken = await getAdminTokenOrDie(url, username, password)
@ -101,7 +100,7 @@ async function pluginsListCLI (command: commander.CommanderStatic, options: comm
process.exit(0)
}
async function installPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) {
async function installPluginCLI (command: Command, options: OptionValues) {
if (!options.path && !options.npmName) {
console.error('You need to specify the npm name or the path of the plugin you want to install.\n')
program.outputHelp()
@ -132,7 +131,7 @@ async function installPluginCLI (command: commander.CommanderStatic, options: co
process.exit(0)
}
async function updatePluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) {
async function updatePluginCLI (command: Command, options: OptionValues) {
if (!options.path && !options.npmName) {
console.error('You need to specify the npm name or the path of the plugin you want to update.\n')
program.outputHelp()
@ -163,7 +162,7 @@ async function updatePluginCLI (command: commander.CommanderStatic, options: com
process.exit(0)
}
async function uninstallPluginCLI (command: commander.CommanderStatic, options: commander.OptionValues) {
async function uninstallPluginCLI (command: Command, options: OptionValues) {
if (!options.npmName) {
console.error('You need to specify the npm name of the plugin/theme you want to uninstall.\n')
program.outputHelp()

View File

@ -3,7 +3,7 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import * as program from 'commander'
import { program, Command } from 'commander'
import { getAdminTokenOrDie, getServerCredentials } from './cli'
import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
import { addVideoRedundancy, listVideoRedundancies, removeVideoRedundancy } from '@shared/extra-utils/server/redundancy'
@ -14,7 +14,6 @@ import { URL } from 'url'
import { uniq } from 'lodash'
import bytes = require('bytes')
import commander = require('commander')
program
.name('plugins')
@ -105,7 +104,7 @@ async function listRedundanciesCLI (target: VideoRedundanciesTarget) {
process.exit(0)
}
async function addRedundancyCLI (options: { video: number }, command: commander.CommanderStatic) {
async function addRedundancyCLI (options: { video: number }, command: Command) {
const { url, username, password } = await getServerCredentials(command)
const accessToken = await getAdminTokenOrDie(url, username, password)
@ -138,7 +137,7 @@ async function addRedundancyCLI (options: { video: number }, command: commander.
}
}
async function removeRedundancyCLI (options: { video: number }, command: commander.CommanderStatic) {
async function removeRedundancyCLI (options: { video: number }, command: Command) {
const { url, username, password } = await getServerCredentials(command)
const accessToken = await getAdminTokenOrDie(url, username, password)

View File

@ -1,7 +1,7 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import * as program from 'commander'
import { program } from 'commander'
import { access, constants } from 'fs-extra'
import { isAbsolute } from 'path'
import { getAccessToken } from '../../shared/extra-utils'

View File

@ -1,7 +1,7 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import * as program from 'commander'
import { program, Option, OptionValues } from 'commander'
import { join } from 'path'
import { execSync } from 'child_process'
@ -9,7 +9,7 @@ program
.name('watch')
.arguments('<url>')
.addOption(
new program.Option('-g, --gui <player>', 'player type')
new Option('-g, --gui <player>', 'player type')
.default('vlc')
.choices([ 'airplay', 'stdout', 'chromecast', 'mpv', 'vlc', 'mplayer', 'xbmc' ])
)
@ -22,7 +22,7 @@ program
.action((url, options) => run(url, options))
.parse(process.argv)
function run (url: string, options: program.OptionValues) {
function run (url: string, options: OptionValues) {
if (!url) {
console.error('<url> positional argument is required.')
process.exit(-1)

View File

@ -5,7 +5,7 @@
import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import * as program from 'commander'
import { CommandOptions, program } from 'commander'
import { getSettings, version } from './cli'
program
@ -28,11 +28,11 @@ program
.command(
'diagnostic [action]',
'like couple therapy, but for your instance',
{ noHelp: true } as program.CommandOptions
{ noHelp: true } as CommandOptions
).alias('d')
.command('admin',
'manage an instance where you have elevated rights',
{ noHelp: true } as program.CommandOptions
{ noHelp: true } as CommandOptions
).alias('a')
// help on no command

View File

@ -2,7 +2,7 @@ import { registerTSPaths } from '../helpers/register-ts-paths'
registerTSPaths()
import { LiveVideo, LiveVideoCreate, VideoPrivacy } from '@shared/models'
import * as program from 'commander'
import { program } from 'commander'
import {
createLive,
flushAndRunServer,