diff options
author | lutangar <johan.dufour@gmail.com> | 2021-11-02 19:11:20 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-12-16 10:08:43 +0100 |
commit | 06aad80165d09a8863ab8103149a8ff518b10641 (patch) | |
tree | a97fa31f3ade29ff807ca1b77704eb47085ab99d /shared/extra-utils/videos/videos-command.ts | |
parent | 854f533c12bd2b88c70f9d5aeab770059e9a6861 (diff) | |
download | PeerTube-06aad80165d09a8863ab8103149a8ff518b10641.tar.gz PeerTube-06aad80165d09a8863ab8103149a8ff518b10641.tar.zst PeerTube-06aad80165d09a8863ab8103149a8ff518b10641.zip |
chore(refactor): remove shared folder dependencies to the server
Many files from the `shared` folder were importing files from the `server` folder.
When attempting to use Typescript project references to describe dependencies,
it highlighted a circular dependency beetween `shared` <-> `server`.
The Typescript project forbid such usages.
Using project references greatly improve performance by rebuilding only
the updated project and not all source files.
> see https://www.typescriptlang.org/docs/handbook/project-references.html
Diffstat (limited to 'shared/extra-utils/videos/videos-command.ts')
-rw-r--r-- | shared/extra-utils/videos/videos-command.ts | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts index 7ec9c3647..8ea828b40 100644 --- a/shared/extra-utils/videos/videos-command.ts +++ b/shared/extra-utils/videos/videos-command.ts | |||
@@ -5,8 +5,7 @@ import { createReadStream, stat } from 'fs-extra' | |||
5 | import got, { Response as GotResponse } from 'got' | 5 | import got, { Response as GotResponse } from 'got' |
6 | import { omit } from 'lodash' | 6 | import { omit } from 'lodash' |
7 | import validator from 'validator' | 7 | import validator from 'validator' |
8 | import { buildUUID } from '@server/helpers/uuid' | 8 | import { buildUUID } from '@shared/core-utils/uuid' |
9 | import { loadLanguages } from '@server/initializers/constants' | ||
10 | import { pick } from '@shared/core-utils' | 9 | import { pick } from '@shared/core-utils' |
11 | import { | 10 | import { |
12 | HttpStatusCode, | 11 | HttpStatusCode, |
@@ -23,7 +22,7 @@ import { | |||
23 | } from '@shared/models' | 22 | } from '@shared/models' |
24 | import { buildAbsoluteFixturePath, wait } from '../miscs' | 23 | import { buildAbsoluteFixturePath, wait } from '../miscs' |
25 | import { unwrapBody } from '../requests' | 24 | import { unwrapBody } from '../requests' |
26 | import { PeerTubeServer, waitJobs } from '../server' | 25 | import { waitJobs } from '../server' |
27 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 26 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
28 | 27 | ||
29 | export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { | 28 | export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { |
@@ -33,13 +32,6 @@ export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile | |||
33 | } | 32 | } |
34 | 33 | ||
35 | export class VideosCommand extends AbstractCommand { | 34 | export class VideosCommand extends AbstractCommand { |
36 | |||
37 | constructor (server: PeerTubeServer) { | ||
38 | super(server) | ||
39 | |||
40 | loadLanguages() | ||
41 | } | ||
42 | |||
43 | getCategories (options: OverrideCommandOptions = {}) { | 35 | getCategories (options: OverrideCommandOptions = {}) { |
44 | const path = '/api/v1/videos/categories' | 36 | const path = '/api/v1/videos/categories' |
45 | 37 | ||