0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Moved @tryghost/adapter-manager to core folder

fix https://linear.app/ghost/issue/ENG-2116/adapter-manager

- this commit moves the lib code and tests to the core folder so we can
  colocate code in one place rather than splitting it out across
  packages, which increases the cognitive load and overhead
This commit is contained in:
Daniel Lockyer 2025-03-31 13:36:12 +02:00 committed by Daniel Lockyer
parent ad4e9922d1
commit ee53bbbe23
11 changed files with 2 additions and 74 deletions

View file

@ -66,7 +66,6 @@ COPY apps/shade/package.json apps/shade/package.json
COPY apps/signup-form/package.json apps/signup-form/package.json
COPY apps/sodo-search/package.json apps/sodo-search/package.json
COPY ghost/adapter-cache-redis/package.json ghost/adapter-cache-redis/package.json
COPY ghost/adapter-manager/package.json ghost/adapter-manager/package.json
COPY ghost/admin/lib/asset-delivery/package.json ghost/admin/lib/asset-delivery/package.json
COPY ghost/admin/lib/ember-power-calendar-moment/package.json ghost/admin/lib/ember-power-calendar-moment/package.json
COPY ghost/admin/lib/ember-power-calendar-utils/package.json ghost/admin/lib/ember-power-calendar-utils/package.json

View file

@ -33,7 +33,6 @@ services:
## Prevent collisions between host and container node_modules
- node_modules_ghost_root:/home/ghost/node_modules:delegated
- node_modules_ghost_adapter-cache-redis:/home/ghost/ghost/adapter-cache-redis/node_modules:delegated
- node_modules_ghost_adapter-manager:/home/ghost/ghost/adapter-manager/node_modules:delegated
- node_modules_ghost_admin:/home/ghost/ghost/admin/node_modules:delegated
- node_modules_ghost_api-framework:/home/ghost/ghost/api-framework/node_modules:delegated
- node_modules_ghost_constants:/home/ghost/ghost/constants/node_modules:delegated
@ -173,7 +172,6 @@ volumes:
redis-data: {}
node_modules_ghost_root: {}
node_modules_ghost_adapter-cache-redis: {}
node_modules_ghost_adapter-manager: {}
node_modules_ghost_admin: {}
node_modules_ghost_api-framework: {}
node_modules_ghost_constants: {}

View file

@ -1,6 +0,0 @@
module.exports = {
plugins: ['ghost'],
extends: [
'plugin:ghost/node'
]
};

View file

@ -1,26 +0,0 @@
# Adapter Manager
A manager for retrieving custom "adapters" - can be used to abstract away from custom implementations
## Usage
```js
const AdapterManager = require('@tryghost/adapter-manager');
const adapterManager = new AdapterManager({
pathsToAdapters: [
'/path/to/custom/adapters',
'/path/to/default/adapters'
]
});
class MailAdapterBase {
someMethod() {}
}
adapterManager.register('mail', MailAdapterBase);
const mailAdapterInstance = adapterManager.getAdapter('mail', 'direct', mailConfig);
mailAdapterInstance.someMethod();
```

View file

@ -1 +0,0 @@
module.exports = require('./lib/AdapterManager');

View file

@ -1,29 +0,0 @@
{
"name": "@tryghost/adapter-manager",
"private": true,
"version": "0.0.0",
"author": "Ghost Foundation",
"license": "MIT",
"main": "index.js",
"scripts": {
"dev": "echo \"Implement me!\"",
"test:unit": "NODE_ENV=testing c8 --all --reporter text --reporter cobertura -- mocha --reporter dot './test/**/*.test.js'",
"test": "yarn test:unit",
"lint:code": "eslint *.js lib/ --ext .js --cache",
"lint": "yarn lint:code && yarn lint:test",
"lint:test": "eslint -c test/.eslintrc.js test/ --ext .js --cache"
},
"files": [
"index.js",
"lib"
],
"devDependencies": {
"c8": "8.0.1",
"mocha": "10.8.2",
"should": "13.2.3",
"sinon": "15.2.0"
},
"dependencies": {
"@tryghost/errors": "1.3.5"
}
}

View file

@ -1,6 +0,0 @@
module.exports = {
plugins: ['ghost'],
extends: [
'plugin:ghost/test'
]
};

View file

@ -1,4 +1,4 @@
const AdapterManager = require('@tryghost/adapter-manager');
const AdapterManager = require('./AdapterManager');
const getAdapterServiceConfig = require('./config');
const resolveAdapterOptions = require('./options-resolver');
const config = require('../../../shared/config');

View file

@ -65,7 +65,6 @@
"@slack/webhook": "7.0.5",
"@tryghost/adapter-base-cache": "0.1.12",
"@tryghost/adapter-cache-redis": "0.0.0",
"@tryghost/adapter-manager": "0.0.0",
"@tryghost/admin-api-schema": "4.5.5",
"@tryghost/api-framework": "0.0.0",
"@tryghost/bookshelf-plugins": "0.6.25",

View file

@ -1,6 +1,6 @@
const sinon = require('sinon');
const should = require('should');
const AdapterManager = require('../');
const AdapterManager = require('../../../../../core/server/services/adapter-manager/AdapterManager');
class BaseMailAdapter {
constructor() {