mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 01:39:37 +02:00
Migrate to pnpm
This commit is contained in:
parent
bbc1afada5
commit
906b5f7f2c
47 changed files with 24183 additions and 23477 deletions
|
@ -3,17 +3,28 @@
|
|||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"main": "dist/index.js",
|
||||
"files": [ "dist" ],
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"peertube:tsx": "./src/index.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/superagent": "^8.1.9",
|
||||
"@types/supertest": "^6.0.3",
|
||||
"supertest": "^7.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"watch": "tsc -w"
|
||||
},
|
||||
"dependencies": {}
|
||||
"dependencies": {
|
||||
"@peertube/peertube-core-utils": "workspace:*",
|
||||
"@peertube/peertube-models": "workspace:*",
|
||||
"@peertube/peertube-node-utils": "workspace:*",
|
||||
"@peertube/peertube-typescript-utils": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,20 +2,19 @@ import { io } from 'socket.io-client'
|
|||
import { AbstractCommand, OverrideCommandOptions } from '../shared/index.js'
|
||||
|
||||
export class SocketIOCommand extends AbstractCommand {
|
||||
|
||||
getUserNotificationSocket (options: OverrideCommandOptions = {}) {
|
||||
getUserNotificationSocket (options: OverrideCommandOptions = {}): ReturnType<typeof io> {
|
||||
return io(this.server.url + '/user-notifications', {
|
||||
query: { accessToken: options.token ?? this.server.accessToken }
|
||||
})
|
||||
}
|
||||
|
||||
getLiveNotificationSocket () {
|
||||
getLiveNotificationSocket (): ReturnType<typeof io> {
|
||||
return io(this.server.url + '/live-videos')
|
||||
}
|
||||
|
||||
getRunnersSocket (options: {
|
||||
runnerToken: string
|
||||
}) {
|
||||
}): ReturnType<typeof io> {
|
||||
return io(this.server.url + '/runners', {
|
||||
reconnection: false,
|
||||
auth: { runnerToken: options.runnerToken }
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"@peertube/peertube-server": "workspace:*",
|
||||
"@peertube/peertube-transcription-devtools": "workspace:*",
|
||||
"@types/superagent": "^8.1.9",
|
||||
"@types/supertest": "^6.0.3",
|
||||
"supertest": "^7.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"watch": "tsc -w",
|
||||
"install-dependencies:transcription": "pip install -r ./requirements.txt -r ../transcription-devtools/requirements.txt"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -379,7 +379,6 @@ describe('Test plugins', function () {
|
|||
await wait(3000)
|
||||
|
||||
expect(await pathExists(join(baseNativeModule, 'build'))).to.be.true
|
||||
expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.true
|
||||
|
||||
await makeGetRequest({
|
||||
url: server.url,
|
||||
|
@ -393,7 +392,6 @@ describe('Test plugins', function () {
|
|||
await server.run()
|
||||
|
||||
expect(await pathExists(join(baseNativeModule, 'build'))).to.be.false
|
||||
expect(await pathExists(join(baseNativeModule, 'prebuilds'))).to.be.false
|
||||
|
||||
await makeGetRequest({
|
||||
url: server.url,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import { VideoFile } from '@peertube/peertube-models'
|
||||
import { PeerTubeServer } from '@peertube/peertube-server-commands'
|
||||
import { OverloadedParameters } from '@peertube/peertube-typescript-utils'
|
||||
import { expect } from 'chai'
|
||||
import { readFile } from 'fs/promises'
|
||||
import type { Instance as MagnetUriInstance } from 'magnet-uri'
|
||||
import type { ParseTorrent } from 'parse-torrent'
|
||||
import { basename, join } from 'path'
|
||||
import type { Torrent } from 'webtorrent'
|
||||
import WebTorrent from 'webtorrent'
|
||||
|
@ -32,7 +34,7 @@ export async function checkWebTorrentWorks (magnetUri: string, pathMatch?: RegEx
|
|||
webtorrent.destroy()
|
||||
}
|
||||
|
||||
export async function parseTorrentVideo (server: PeerTubeServer, file: VideoFile) {
|
||||
export async function parseTorrentVideo (server: PeerTubeServer, file: VideoFile): Promise<OverloadedParameters<ReturnType<ParseTorrent>>> {
|
||||
const torrentName = basename(file.torrentUrl)
|
||||
const torrentPath = server.servers.buildDirectory(join('torrents', torrentName))
|
||||
|
||||
|
|
|
@ -9,11 +9,6 @@ Npm:
|
|||
npm install --save-dev @peertube/peertube-types
|
||||
```
|
||||
|
||||
Yarn:
|
||||
```
|
||||
yarn add --dev @peertube/peertube-types
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
> See [contribute-plugins](https://docs.joinpeertube.org/contribute/plugins#typescript) **Typescript** section of the doc.
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@peertube/peertube-core-utils": "*"
|
||||
"@peertube/peertube-core-utils": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,23 +20,19 @@ export type PickWithOpt<T, KT extends keyof T, V> = {
|
|||
|
||||
// https://github.com/krzkaczor/ts-essentials Rocks!
|
||||
export type DeepPartial<T> = {
|
||||
[P in keyof T]?: T[P] extends Array<infer U>
|
||||
? Array<DeepPartial<U>>
|
||||
: T[P] extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: DeepPartial<T[P]>
|
||||
[P in keyof T]?: T[P] extends Array<infer U> ? Array<DeepPartial<U>>
|
||||
: T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
||||
: DeepPartial<T[P]>
|
||||
}
|
||||
|
||||
type Primitive = string | Function | number | boolean | symbol | undefined | null
|
||||
export type DeepOmitHelper<T, K extends keyof T> = {
|
||||
[P in K]: // extra level of indirection needed to trigger homomorhic behavior
|
||||
T[P] extends infer TP // distribute over unions
|
||||
? TP extends Primitive
|
||||
? TP // leave primitives and functions alone
|
||||
: TP extends any[]
|
||||
? DeepOmitArray<TP, K> // Array special handling
|
||||
: DeepOmit<TP, K>
|
||||
: never
|
||||
T[P] extends infer TP // distribute over unions
|
||||
? TP extends Primitive ? TP // leave primitives and functions alone
|
||||
: TP extends any[] ? DeepOmitArray<TP, K> // Array special handling
|
||||
: DeepOmit<TP, K>
|
||||
: never
|
||||
}
|
||||
export type DeepOmit<T, K> = T extends Primitive ? T : DeepOmitHelper<T, Exclude<keyof T, K>>
|
||||
|
||||
|
@ -47,3 +43,12 @@ export type DeepOmitArray<T extends any[], K> = {
|
|||
export type Unpacked<T> = T extends (infer U)[] ? U : T
|
||||
|
||||
export type Awaitable<T> = T | PromiseLike<T>
|
||||
|
||||
// Thanks https://stackoverflow.com/a/52761156
|
||||
export type OverloadedParameters<T> =
|
||||
// eslint-disable-next-line max-len
|
||||
T extends { (...args: infer A1): any, (...args: infer A2): any, (...args: infer A3): any, (...args: infer A4): any } ? A1 | A2 | A3 | A4 :
|
||||
T extends { (...args: infer A1): any, (...args: infer A2): any, (...args: infer A3): any } ? A1 | A2 | A3 :
|
||||
T extends { (...args: infer A1): any, (...args: infer A2): any } ? A1 | A2 :
|
||||
T extends (...args: infer A) => any ? A
|
||||
: any
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue