mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-26 04:08:01 +03:00
Moved Cache-Control middleware to separate package
refs https://github.com/TryGhost/Toolbox/issues/363 - this middleware is standalone and I suspect we're going to be touching it further when we work on Ghost's caching in the near future
This commit is contained in:
parent
18cd104510
commit
42e722d627
@ -8,7 +8,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
get cacheControl() {
|
||||
return require('./cache-control');
|
||||
return require('@tryghost/mw-cache-control');
|
||||
},
|
||||
|
||||
get prettyUrls() {
|
||||
|
@ -92,6 +92,7 @@
|
||||
"@tryghost/metrics": "1.0.15",
|
||||
"@tryghost/minifier": "0.0.0",
|
||||
"@tryghost/mw-api-version-mismatch": "0.0.0",
|
||||
"@tryghost/mw-cache-control": "0.0.0",
|
||||
"@tryghost/mw-error-handler": "0.0.0",
|
||||
"@tryghost/mw-session-from-token": "0.0.0",
|
||||
"@tryghost/mw-vhost": "0.0.0",
|
||||
|
6
ghost/mw-cache-control/.eslintrc.js
Normal file
6
ghost/mw-cache-control/.eslintrc.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
plugins: ['ghost'],
|
||||
extends: [
|
||||
'plugin:ghost/node'
|
||||
]
|
||||
};
|
23
ghost/mw-cache-control/README.md
Normal file
23
ghost/mw-cache-control/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
# Mw Cache Control
|
||||
|
||||
Cache-Control middleware 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/mw-cache-control/index.js
Normal file
1
ghost/mw-cache-control/index.js
Normal file
@ -0,0 +1 @@
|
||||
module.exports = require('./lib/mw-cache-control');
|
28
ghost/mw-cache-control/package.json
Normal file
28
ghost/mw-cache-control/package.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "@tryghost/mw-cache-control",
|
||||
"version": "0.0.0",
|
||||
"repository": "https://github.com/TryGhost/Ghost/tree/main/packages/mw-cache-control",
|
||||
"author": "Ghost Foundation",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev": "echo \"Implement me!\"",
|
||||
"test": "NODE_ENV=testing c8 --all --check-coverage --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": {
|
||||
"lodash": "4.17.21"
|
||||
}
|
||||
}
|
6
ghost/mw-cache-control/test/.eslintrc.js
Normal file
6
ghost/mw-cache-control/test/.eslintrc.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
plugins: ['ghost'],
|
||||
extends: [
|
||||
'plugin:ghost/test'
|
||||
]
|
||||
};
|
@ -1,8 +1,9 @@
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const cacheControl = require('../../../../../../core/server/web/shared/middleware/cache-control');
|
||||
|
||||
describe('Middleware: cacheControl', function () {
|
||||
const cacheControl = require('../');
|
||||
|
||||
describe('Cache-Control middleware', function () {
|
||||
let res;
|
||||
|
||||
beforeEach(function () {
|
Loading…
Reference in New Issue
Block a user