-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ES6 migrations for web folder #9886
Conversation
|
||
let store; | ||
let handleStoreError; | ||
let globalBlock; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
core/server/web/admin/app.js
Outdated
|
||
module.exports = function setupAdminApp() { | ||
debug('Admin setup start'); | ||
const adminApp = express(); | ||
|
||
// First determine whether we're serving admin or theme content | ||
// @TODO finish refactoring this away. | ||
adminApp.use(function setIsAdmin(req, res, next) { | ||
adminApp.use((req, res, next) => { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
const adminRedirect = function adminRedirect(path) { | ||
return function doRedirect(req, res) { | ||
const adminRedirect = (path) => { | ||
return (req, res) => { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
output = profiles[options]; | ||
} | ||
|
||
return function cacheControlHeaders(req, res, next) { | ||
return (req, res, next) => { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -75,7 +76,7 @@ exports.use = function use(siteApp) { | |||
|
|||
// Recommended approach by express, see https://github.com/expressjs/express/issues/2596#issuecomment-81353034. | |||
// As soon as the express router get's re-instantiated, the old router instance is not used anymore. | |||
siteApp.use(function (req, res, next) { | |||
siteApp.use((req, res, next) => { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
return function serveFavicon(req, res, next) { | ||
return (req, res, next) => { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
return function servePublicFile(req, res, next) { | ||
return (req, res, next) => { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -29,10 +31,11 @@ function forwardToExpressStatic(req, res, next) { | |||
} | |||
|
|||
function staticTheme() { | |||
return function blackListStatic(req, res, next) { | |||
return (req, res, next) => { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
module.exports = function blogIcon() { | ||
// we checked for a valid image file, now we need to do validations for blog icons | ||
return function blogIconValidation(req, res, next) { | ||
var iconExtensions = (config.get('uploads').icons && config.get('uploads').icons.extensions) || []; | ||
return (req, res, next) => { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
return function uploadValidation(req, res, next) { | ||
var extensions = (config.get('uploads')[type] && config.get('uploads')[type].extensions) || [], | ||
contentTypes = (config.get('uploads')[type] && config.get('uploads')[type].contentTypes) || []; | ||
return (req, res, next) => { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
eb56c57
to
f18bd53
Compare
no issue - discovered here: TryGhost#9886 (comment) - `setPrototypeOf` is a npm package and a dependency of e.g. express - we can use `Object.setPrototypeOf` instead
no issue - discovered here: #9886 (comment) - `setPrototypeOf` is a npm package and a dependency of e.g. express - we can use `Object.setPrototypeOf` instead
Migrations! 💨
refs #9589
var
->let
/const
function
->=>
'a ' + 'b'
->${a}${b}
_.
substitution where possible_.
made specific imports instead of getting the entire module