mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 21:33:24 +03:00
Moved bridge into its proper location
- Modules in /shared are supposed to be standalone modules that can be required by the server or frontend - As the server shouldn't require the frontend, and vice versa, shared modules should require neither - Otherwise it just becomes a crutch for allowing cross-depenencies, and will create circular dependencies The Bridge - The bridge file is not meant to be a crutch sat allowing cross-dependencies, but rather a new component that manages the flow of data - That data flows from the server/boot process TO the frontend, and should not flow in the other direction - The management of that flow of data is necessarily hacky at the moment, but over time the architecture here should get clearer and better - Still, for the time being it will need to handle requiring across components until that architecture matures - Therefore, it should live in core root, not in core/shared
This commit is contained in:
parent
1025600ae1
commit
fdefa4964f
@ -143,7 +143,7 @@ async function initServices({config}) {
|
||||
// However this _must_ happen after the express Apps are loaded, hence why this is here and not in initFrontend
|
||||
// Routing is currently tightly coupled between the frontend and backend
|
||||
const routing = require('./frontend/services/routing');
|
||||
const bridge = require('./shared/bridge');
|
||||
const bridge = require('./bridge');
|
||||
// We pass the frontend API version here, so that the frontend services are slightly less tightly-coupled
|
||||
routing.bootstrap.start(bridge.getFrontendApiVersion());
|
||||
const settings = require('./server/services/settings');
|
||||
|
@ -1,7 +1,7 @@
|
||||
// @TODO: refactor constructor pattern so we don't have to require config here?
|
||||
const config = require('./config');
|
||||
const {events} = require('../server/lib/common');
|
||||
const themeEngine = require('../frontend/services/theme-engine');
|
||||
const config = require('./shared/config');
|
||||
const {events} = require('./server/lib/common');
|
||||
const themeEngine = require('./frontend/services/theme-engine');
|
||||
|
||||
class Bridge {
|
||||
constructor() {
|
@ -2,7 +2,7 @@ const _ = require('lodash');
|
||||
const debug = require('ghost-ignition').debug('frontend:services:settings:validate');
|
||||
const {i18n} = require('../proxy');
|
||||
const errors = require('@tryghost/errors');
|
||||
const bridge = require('../../../shared/bridge');
|
||||
const bridge = require('../../../bridge');
|
||||
const _private = {};
|
||||
let RESOURCE_CONFIG;
|
||||
|
||||
|
@ -52,7 +52,7 @@ class Resources {
|
||||
return this.resourceConfig;
|
||||
}
|
||||
|
||||
const bridge = require('../../../shared/bridge');
|
||||
const bridge = require('../../../bridge');
|
||||
this.resourcesAPIVersion = bridge.getFrontendApiVersion();
|
||||
this.resourcesConfig = require(`./configs/${this.resourcesAPIVersion}`);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
const ghostVersion = require('../../../lib/ghost-version');
|
||||
const bridge = require('../../../../shared/bridge');
|
||||
const bridge = require('../../../../bridge');
|
||||
|
||||
// ### GhostLocals Middleware
|
||||
// Expose the standard locals that every request will need to have available
|
||||
|
@ -6,7 +6,7 @@ const {URL} = require('url');
|
||||
const errors = require('@tryghost/errors');
|
||||
|
||||
// App requires
|
||||
const bridge = require('../../../shared/bridge');
|
||||
const bridge = require('../../../bridge');
|
||||
const config = require('../../../shared/config');
|
||||
const constants = require('@tryghost/constants');
|
||||
const storage = require('../../adapters/storage');
|
||||
|
Loading…
Reference in New Issue
Block a user