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
This commit is contained in:
lutangar
2021-12-16 10:08:43 +01:00
committed by Chocobozzz
parent 854f533c12
commit 06aad80165
78 changed files with 583 additions and 485 deletions
+2 -1
View File
@@ -6,7 +6,8 @@ import { VideoRedundancyConfigFilter } from '@shared/models/redundancy/video-red
import { BroadcastMessageLevel } from '@shared/models/server'
import { VideoPrivacy, VideosRedundancyStrategy } from '../../shared/models'
import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
import { buildPath, parseBytes, parseDurationToMs, root } from '../helpers/core-utils'
import { buildPath, root } from '../../shared/core-utils'
import { parseBytes, parseDurationToMs } from '../helpers/core-utils'
// Use a variable to reload the configuration if we need
let config: IConfig = require('config')
+2 -1
View File
@@ -18,8 +18,9 @@ import { FollowState } from '../../shared/models/actors'
import { NSFWPolicyType } from '../../shared/models/videos/nsfw-policy.type'
import { VideoPlaylistPrivacy } from '../../shared/models/videos/playlist/video-playlist-privacy.model'
import { VideoPlaylistType } from '../../shared/models/videos/playlist/video-playlist-type.model'
import { root } from '../../shared/core-utils'
// Do not use barrels, remain constants as independent as possible
import { isTestInstance, root, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
import { isTestInstance, sanitizeHost, sanitizeUrl } from '../helpers/core-utils'
import { CONFIG, registerConfigChangedHandler } from './config'
// ---------------------------------------------------------------------------
@@ -1,4 +1,4 @@
import { buildUUID } from '@server/helpers/uuid'
import { buildUUID } from '@shared/core-utils/uuid'
import * as Sequelize from 'sequelize'
async function up (utils: {
@@ -1,5 +1,5 @@
import * as Sequelize from 'sequelize'
import { buildUUID } from '@server/helpers/uuid'
import { buildUUID } from '@shared/core-utils/uuid'
import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos'
import { WEBSERVER } from '../constants'
@@ -1,5 +1,5 @@
import * as Sequelize from 'sequelize'
import { buildUUID } from '@server/helpers/uuid'
import { buildUUID } from '@shared/core-utils/uuid'
async function up (utils: {
transaction: Sequelize.Transaction