From 29b3da26c341edef1df98430e8b32ee1f3afec6a Mon Sep 17 00:00:00 2001 From: Naz Date: Fri, 3 Mar 2023 16:15:44 +0800 Subject: [PATCH] Added ExternalMediaInliner package scaffolding refs https://github.com/TryGhost/Toolbox/issues/524 - This is groundwork to contain logic related to external media scraping/inlining for posts. --- ghost/external-media-inliner/.eslintrc.js | 6 +++++ ghost/external-media-inliner/README.md | 23 ++++++++++++++++ ghost/external-media-inliner/index.js | 1 + .../lib/ExternalMediaInliner.js | 5 ++++ ghost/external-media-inliner/package.json | 26 +++++++++++++++++++ .../external-media-inliner/test/.eslintrc.js | 6 +++++ .../test/ExternalMediaInliner.test.js | 8 ++++++ 7 files changed, 75 insertions(+) create mode 100644 ghost/external-media-inliner/.eslintrc.js create mode 100644 ghost/external-media-inliner/README.md create mode 100644 ghost/external-media-inliner/index.js create mode 100644 ghost/external-media-inliner/lib/ExternalMediaInliner.js create mode 100644 ghost/external-media-inliner/package.json create mode 100644 ghost/external-media-inliner/test/.eslintrc.js create mode 100644 ghost/external-media-inliner/test/ExternalMediaInliner.test.js diff --git a/ghost/external-media-inliner/.eslintrc.js b/ghost/external-media-inliner/.eslintrc.js new file mode 100644 index 0000000000..c9c1bcb522 --- /dev/null +++ b/ghost/external-media-inliner/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: ['ghost'], + extends: [ + 'plugin:ghost/node' + ] +}; diff --git a/ghost/external-media-inliner/README.md b/ghost/external-media-inliner/README.md new file mode 100644 index 0000000000..ef94bdc183 --- /dev/null +++ b/ghost/external-media-inliner/README.md @@ -0,0 +1,23 @@ +# External Media Inliner + +Service that processes post contents and downloads/inlines external media + + +## 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 + diff --git a/ghost/external-media-inliner/index.js b/ghost/external-media-inliner/index.js new file mode 100644 index 0000000000..94c21484f5 --- /dev/null +++ b/ghost/external-media-inliner/index.js @@ -0,0 +1 @@ +module.exports = require('./lib/ExternalMediaInliner'); diff --git a/ghost/external-media-inliner/lib/ExternalMediaInliner.js b/ghost/external-media-inliner/lib/ExternalMediaInliner.js new file mode 100644 index 0000000000..f88e7798c0 --- /dev/null +++ b/ghost/external-media-inliner/lib/ExternalMediaInliner.js @@ -0,0 +1,5 @@ +class ExternalMediaInliner { + +} + +module.exports = ExternalMediaInliner; diff --git a/ghost/external-media-inliner/package.json b/ghost/external-media-inliner/package.json new file mode 100644 index 0000000000..d839b6fa70 --- /dev/null +++ b/ghost/external-media-inliner/package.json @@ -0,0 +1,26 @@ +{ + "name": "@tryghost/external-media-inliner", + "version": "0.0.0", + "repository": "https://github.com/TryGhost/Ghost/tree/main/packages/external-media-inliner", + "author": "Ghost Foundation", + "private": true, + "main": "index.js", + "scripts": { + "dev": "echo \"Implement me!\"", + "test:unit": "NODE_ENV=testing c8 --all --check-coverage --100 --reporter text --reporter cobertura mocha './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": "7.13.0", + "mocha": "10.2.0", + "sinon": "15.0.1" + }, + "dependencies": {} +} diff --git a/ghost/external-media-inliner/test/.eslintrc.js b/ghost/external-media-inliner/test/.eslintrc.js new file mode 100644 index 0000000000..829b601eb0 --- /dev/null +++ b/ghost/external-media-inliner/test/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: ['ghost'], + extends: [ + 'plugin:ghost/test' + ] +}; diff --git a/ghost/external-media-inliner/test/ExternalMediaInliner.test.js b/ghost/external-media-inliner/test/ExternalMediaInliner.test.js new file mode 100644 index 0000000000..cc0b295798 --- /dev/null +++ b/ghost/external-media-inliner/test/ExternalMediaInliner.test.js @@ -0,0 +1,8 @@ +const assert = require('assert'); +const ExternalMediaInliner = require('../index'); + +describe('ExternalMediaInliner', function () { + it('Creates an instance', function () { + assert.ok(new ExternalMediaInliner()); + }); +});