Skip to content
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

Merged
merged 18 commits into from
Sep 20, 2018
Merged

Conversation

naz
Copy link
Contributor

@naz naz commented Sep 19, 2018

Migrations! 💨

refs #9589

  • var -> let / const
  • multiple declarations
  • function -> =>
  • 'a ' + 'b' -> ${a}${b}
  • _. substitution where possible
  • _. made specific imports instead of getting the entire module


let store;
let handleStoreError;
let globalBlock;

This comment was marked as abuse.

This comment was marked as abuse.


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.

This comment was marked as abuse.

const adminRedirect = function adminRedirect(path) {
return function doRedirect(req, res) {
const adminRedirect = (path) => {
return (req, res) => {

This comment was marked as abuse.

output = profiles[options];
}

return function cacheControlHeaders(req, res, next) {
return (req, res, next) => {

This comment was marked as abuse.

@@ -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.


return function serveFavicon(req, res, next) {
return (req, res, next) => {

This comment was marked as abuse.


return function servePublicFile(req, res, next) {
return (req, res, next) => {

This comment was marked as abuse.

@@ -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.


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.

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.

Copy link
Contributor

@kirrg001 kirrg001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kirrg001 kirrg001 merged commit 006c83f into TryGhost:master Sep 20, 2018
kirrg001 added a commit to kirrg001/Ghost that referenced this pull request Sep 20, 2018
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
naz pushed a commit that referenced this pull request Sep 20, 2018
no issue

- discovered here: #9886 (comment)
- `setPrototypeOf` is a npm package and a dependency of e.g. express
- we can use `Object.setPrototypeOf` instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:api Affects the Ghost API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants