mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-22 19:32:54 +03:00
Extracted oembed service to separate package
refs https://github.com/TryGhost/Toolbox/issues/363 - the oembed service is completely standalone and could do with some individual unit tests - moving it out to a package allows us to draw the boundaries better and allows us to remove some dependencies from the core package.json
This commit is contained in:
parent
dfbe8ee296
commit
d2eda5cf51
@ -1,7 +1,7 @@
|
|||||||
const config = require('../../../shared/config');
|
const config = require('../../../shared/config');
|
||||||
const externalRequest = require('../../lib/request-external');
|
const externalRequest = require('../../lib/request-external');
|
||||||
|
|
||||||
const OEmbed = require('../../services/oembed');
|
const OEmbed = require('@tryghost/oembed-service');
|
||||||
const oembed = new OEmbed({config, externalRequest});
|
const oembed = new OEmbed({config, externalRequest});
|
||||||
|
|
||||||
const NFT = require('../../services/nft-oembed');
|
const NFT = require('../../services/nft-oembed');
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
"@tryghost/mw-vhost": "0.0.0",
|
"@tryghost/mw-vhost": "0.0.0",
|
||||||
"@tryghost/nodemailer": "0.3.25",
|
"@tryghost/nodemailer": "0.3.25",
|
||||||
"@tryghost/nql": "0.9.2",
|
"@tryghost/nql": "0.9.2",
|
||||||
|
"@tryghost/oembed-service": "0.0.0",
|
||||||
"@tryghost/package-json": "0.0.0",
|
"@tryghost/package-json": "0.0.0",
|
||||||
"@tryghost/pretty-cli": "1.2.30",
|
"@tryghost/pretty-cli": "1.2.30",
|
||||||
"@tryghost/promise": "0.1.21",
|
"@tryghost/promise": "0.1.21",
|
||||||
@ -159,15 +160,6 @@
|
|||||||
"knex-migrator": "5.0.3",
|
"knex-migrator": "5.0.3",
|
||||||
"lodash": "4.17.21",
|
"lodash": "4.17.21",
|
||||||
"luxon": "3.0.1",
|
"luxon": "3.0.1",
|
||||||
"metascraper": "5.30.1",
|
|
||||||
"metascraper-author": "5.29.15",
|
|
||||||
"metascraper-description": "5.29.15",
|
|
||||||
"metascraper-image": "5.29.15",
|
|
||||||
"metascraper-logo": "5.29.15",
|
|
||||||
"metascraper-logo-favicon": "5.30.1",
|
|
||||||
"metascraper-publisher": "5.29.15",
|
|
||||||
"metascraper-title": "5.29.15",
|
|
||||||
"metascraper-url": "5.29.15",
|
|
||||||
"moment": "2.24.0",
|
"moment": "2.24.0",
|
||||||
"moment-timezone": "0.5.23",
|
"moment-timezone": "0.5.23",
|
||||||
"multer": "1.4.4",
|
"multer": "1.4.4",
|
||||||
@ -181,7 +173,6 @@
|
|||||||
"sanitize-html": "2.7.1",
|
"sanitize-html": "2.7.1",
|
||||||
"semver": "7.3.7",
|
"semver": "7.3.7",
|
||||||
"stoppable": "1.1.0",
|
"stoppable": "1.1.0",
|
||||||
"tough-cookie": "4.0.0",
|
|
||||||
"uuid": "8.3.2",
|
"uuid": "8.3.2",
|
||||||
"xml": "1.0.1"
|
"xml": "1.0.1"
|
||||||
},
|
},
|
||||||
|
6
ghost/oembed-service/.eslintrc.js
Normal file
6
ghost/oembed-service/.eslintrc.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: ['ghost'],
|
||||||
|
extends: [
|
||||||
|
'plugin:ghost/node'
|
||||||
|
]
|
||||||
|
};
|
23
ghost/oembed-service/README.md
Normal file
23
ghost/oembed-service/README.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Oembed Service
|
||||||
|
|
||||||
|
Oembed service for Ghost
|
||||||
|
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
|
||||||
|
## Develop
|
||||||
|
|
||||||
|
This is a monorepo package.
|
||||||
|
|
||||||
|
Follow the instructions for the top-level repo.
|
||||||
|
1. `git clone` this repo & `cd` into it as usual
|
||||||
|
2. Run `yarn` to install top-level dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Test
|
||||||
|
|
||||||
|
- `yarn lint` run just eslint
|
||||||
|
- `yarn test` run lint and tests
|
||||||
|
|
1
ghost/oembed-service/index.js
Normal file
1
ghost/oembed-service/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
module.exports = require('./lib/oembed-service');
|
42
ghost/oembed-service/package.json
Normal file
42
ghost/oembed-service/package.json
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"name": "@tryghost/oembed-service",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"repository": "https://github.com/TryGhost/Ghost/tree/main/packages/oembed-service",
|
||||||
|
"author": "Ghost Foundation",
|
||||||
|
"private": true,
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "echo \"Implement me!\"",
|
||||||
|
"test": "NODE_ENV=testing c8 --all --reporter text --reporter cobertura mocha './test/**/*.test.js'",
|
||||||
|
"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": "7.12.0",
|
||||||
|
"mocha": "10.0.0",
|
||||||
|
"should": "13.2.3",
|
||||||
|
"sinon": "14.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@tryghost/errors": "1.2.15",
|
||||||
|
"@tryghost/logging": "2.2.4",
|
||||||
|
"@tryghost/tpl": "0.1.18",
|
||||||
|
"lodash": "4.17.21",
|
||||||
|
"metascraper": "5.30.1",
|
||||||
|
"metascraper-author": "5.29.15",
|
||||||
|
"metascraper-description": "5.29.15",
|
||||||
|
"metascraper-image": "5.29.15",
|
||||||
|
"metascraper-logo": "5.29.15",
|
||||||
|
"metascraper-logo-favicon": "5.30.1",
|
||||||
|
"metascraper-publisher": "5.29.15",
|
||||||
|
"metascraper-title": "5.29.15",
|
||||||
|
"metascraper-url": "5.29.15",
|
||||||
|
"oembed-parser": "1.4.9",
|
||||||
|
"tough-cookie": "4.0.0"
|
||||||
|
}
|
||||||
|
}
|
6
ghost/oembed-service/test/.eslintrc.js
Normal file
6
ghost/oembed-service/test/.eslintrc.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: ['ghost'],
|
||||||
|
extends: [
|
||||||
|
'plugin:ghost/test'
|
||||||
|
]
|
||||||
|
};
|
7
ghost/oembed-service/test/hello.test.js
Normal file
7
ghost/oembed-service/test/hello.test.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
|
describe('Hello world', function () {
|
||||||
|
it('Runs a test', function () {
|
||||||
|
assert.equal('hello', 'hello');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user