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 /server/initializers | |
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 'server/initializers')
-rw-r--r-- | server/initializers/config.ts | 3 | ||||
-rw-r--r-- | server/initializers/constants.ts | 3 | ||||
-rw-r--r-- | server/initializers/migrations/0080-video-channels.ts | 2 | ||||
-rw-r--r-- | server/initializers/migrations/0345-video-playlists.ts | 2 | ||||
-rw-r--r-- | server/initializers/migrations/0560-user-feed-token.ts | 2 |
5 files changed, 7 insertions, 5 deletions
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 70179d25c..e3e8c426e 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -6,7 +6,8 @@ import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-red | |||
6 | import { BroadcastMessageLevel } from '@shared/models/server' | 6 | import { BroadcastMessageLevel } from '@shared/models/server' |
7 | import { VideoPrivacy, VideosRedundancyStrategy } from '../../shared/models' | 7 | import { VideoPrivacy, VideosRedundancyStrategy } from '../../shared/models' |
8 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | 8 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' |
9 | import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils' | 9 | import { buildPath, root } from '../../shared/core-utils' |
10 | import { parseBytes, parseDurationToMs } from '../helpers/core-utils' | ||
10 | 11 | ||
11 | // Use a variable to reload the configuration if we need | 12 | // Use a variable to reload the configuration if we need |
12 | let config: IConfig = require('config') | 13 | let config: IConfig = require('config') |
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 70b8e3d27..026c715c2 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -18,8 +18,9 @@ import { FollowState } from '../../shared/models/actors' | |||
18 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' | 18 | import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type' |
19 | import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model' | 19 | import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model' |
20 | import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model' | 20 | import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model' |
21 | import { root } from '../../shared/core-utils' | ||
21 | // Do not use barrels, remain constants as independent as possible | 22 | // Do not use barrels, remain constants as independent as possible |
22 | import { isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' | 23 | import { isTestInstance, sanitizeHost, sanitizeUrl } from '../helpers/core-utils' |
23 | import { CONFIG, registerConfigChangedHandler } from './config' | 24 | import { CONFIG, registerConfigChangedHandler } from './config' |
24 | 25 | ||
25 | // --------------------------------------------------------------------------- | 26 | // --------------------------------------------------------------------------- |
diff --git a/server/initializers/migrations/0080-video-channels.ts b/server/initializers/migrations/0080-video-channels.ts index 0e6952350..82971c9f5 100644 --- a/server/initializers/migrations/0080-video-channels.ts +++ b/server/initializers/migrations/0080-video-channels.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { buildUUID } from '@server/helpers/uuid' | 1 | import { buildUUID } from '@shared/core-utils/uuid' |
2 | import * as Sequelize from 'sequelize' | 2 | import * as Sequelize from 'sequelize' |
3 | 3 | ||
4 | async function up (utils: { | 4 | async function up (utils: { |
diff --git a/server/initializers/migrations/0345-video-playlists.ts b/server/initializers/migrations/0345-video-playlists.ts index 8dd631dff..5cc52e7ee 100644 --- a/server/initializers/migrations/0345-video-playlists.ts +++ b/server/initializers/migrations/0345-video-playlists.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { buildUUID } from '@server/helpers/uuid' | 2 | import { buildUUID } from '@shared/core-utils/uuid' |
3 | import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' | 3 | import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' |
4 | import { WEBSERVER } from '../constants' | 4 | import { WEBSERVER } from '../constants' |
5 | 5 | ||
diff --git a/server/initializers/migrations/0560-user-feed-token.ts b/server/initializers/migrations/0560-user-feed-token.ts index 042301352..961777e35 100644 --- a/server/initializers/migrations/0560-user-feed-token.ts +++ b/server/initializers/migrations/0560-user-feed-token.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { buildUUID } from '@server/helpers/uuid' | 2 | import { buildUUID } from '@shared/core-utils/uuid' |
3 | 3 | ||
4 | async function up (utils: { | 4 | async function up (utils: { |
5 | transaction: Sequelize.Transaction | 5 | transaction: Sequelize.Transaction |