From 8ec8a21b71810e7d9d4472414a5ebf9396626e14 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Tue, 17 May 2022 09:05:44 +0100 Subject: [PATCH] Renamed "client" references to "admin" refs: https://github.com/TryGhost/Toolbox/issues/299 - renamed lots of things that reference Ghost admin as "client" - these things make even less sense in a post core/client world --- Gruntfile.js | 40 +++++++++++++------------- README.md | 2 +- core/server/web/admin/app.js | 2 +- core/server/web/parent/frontend.js | 2 +- core/shared/config/overrides.json | 2 +- package.json | 4 +-- test/e2e-server/admin.test.js | 2 +- test/unit/shared/config/loader.test.js | 2 +- test/utils/admin-utils.js | 6 ++-- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index b7bd8c750d..bc8b3ae01f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,11 +3,11 @@ const fs = require('fs-extra'); const path = require('path'); // Utility for outputting messages indicating that the admin is building, as it can take a while. -let hasBuiltClient = false; -const logBuildingClient = function (grunt) { - if (!hasBuiltClient) { - grunt.log.writeln('Building admin client... (can take ~1min)'); - setTimeout(logBuildingClient, 5000, grunt); +let hasBuiltAdmin = false; +const logBuildingAdmin = function (grunt) { + if (!hasBuiltAdmin) { + grunt.log.writeln('Building admin app... (can take ~1min)'); + setTimeout(logBuildingAdmin, 5000, grunt); } }; @@ -15,18 +15,18 @@ module.exports = function (grunt) { // grunt dev - use yarn dev instead! // - Start a server & build assets on the fly whilst developing grunt.registerTask('dev', 'Dev Mode; watch files and restart server on changes', function () { - if (grunt.option('client')) { - grunt.task.run(['clean:built', 'bgShell:client']); + if (grunt.option('admin')) { + grunt.task.run(['clean:built', 'bgShell:admin']); } else if (grunt.option('server')) { grunt.task.run(['express:dev', 'watch']); } else { - grunt.task.run(['clean:built', 'bgShell:client', 'express:dev', 'watch']); + grunt.task.run(['clean:built', 'bgShell:admin', 'express:dev', 'watch']); } }); // grunt build -- use yarn build instead! - // - Builds the client without a watch task - grunt.registerTask('build', 'Build client app in development mode', + // - Builds the admin without a watch task + grunt.registerTask('build', 'Build admin app in development mode', ['subgrunt:init', 'clean:tmp', 'ember']); // Helpers for common deprecated tasks @@ -41,7 +41,7 @@ module.exports = function (grunt) { // --- Sub Commands // Used to make other commands work - // Updates submodules, then installs and builds the client for you + // Updates submodules, then installs and builds the admin for you grunt.registerTask('init', 'Prepare the project for development', ['update_submodules:pinned', 'build']); @@ -101,17 +101,17 @@ module.exports = function (grunt) { }, // grunt-bg-shell - // Tools for building the client + // Tools for building the admin bgShell: { - client: { + admin: { cmd: function () { - logBuildingClient(grunt); + logBuildingAdmin(grunt); return 'grunt subgrunt:watch'; }, - bg: grunt.option('client') ? false : true, + bg: grunt.option('admin') ? false : true, stdout: function (chunk) { // hide certain output to prevent confusion when running alongside server - const filter = grunt.option('client') ? false : [ + const filter = grunt.option('admin') ? false : [ /> ghost-admin/, /^Livereload/, /^Serving on/ @@ -124,24 +124,24 @@ module.exports = function (grunt) { } if (chunk.indexOf('Slowest Nodes') !== -1) { - hasBuiltClient = true; + hasBuiltAdmin = true; } }, stderr: function (chunk) { - const skipFilter = grunt.option('client') ? false : [ + const skipFilter = grunt.option('admin') ? false : [ /- building/ ].some(function (regexp) { return regexp.test(chunk); }); - const errorFilter = grunt.option('client') ? false : [ + const errorFilter = grunt.option('admin') ? false : [ /^>>/ ].some(function (regexp) { return regexp.test(chunk); }); if (!skipFilter) { - hasBuiltClient = errorFilter ? hasBuiltClient : true; + hasBuiltAdmin = errorFilter ? hasBuiltAdmin : true; grunt.log.error(chunk); } } diff --git a/README.md b/README.md index 9fe6b71602..2ec25b281b 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ Check out our [official documentation](https://ghost.org/docs/) for more informa ### Contributors & advanced developers -For anyone wishing to contribute to Ghost or to hack/customize core files we recommend following our full development setup guides: [Contributor guide](https://ghost.org/docs/contributing/) • [Developer setup](https://ghost.org/docs/install/source/) • [Admin Client dev guide](https://ghost.org/docs/install/source/#ghost-admin) +For anyone wishing to contribute to Ghost or to hack/customize core files we recommend following our full development setup guides: [Contributor guide](https://ghost.org/docs/contributing/) • [Developer setup](https://ghost.org/docs/install/source/) • [Admin App dev guide](https://ghost.org/docs/install/source/#ghost-admin)   diff --git a/core/server/web/admin/app.js b/core/server/web/admin/app.js index 12a2106bd3..f67dd7ff0f 100644 --- a/core/server/web/admin/app.js +++ b/core/server/web/admin/app.js @@ -17,7 +17,7 @@ module.exports = function setupAdminApp() { // @TODO ensure this gets a local 404 error handler const configMaxAge = config.get('caching:admin:maxAge'); adminApp.use('/assets', serveStatic( - config.get('paths').clientAssets, + config.get('paths').adminAssets, {maxAge: (configMaxAge || configMaxAge === 0) ? configMaxAge : constants.ONE_YEAR_MS, fallthrough: false} )); diff --git a/core/server/web/parent/frontend.js b/core/server/web/parent/frontend.js index b3a103f959..f15bfde0af 100644 --- a/core/server/web/parent/frontend.js +++ b/core/server/web/parent/frontend.js @@ -14,7 +14,7 @@ module.exports = (routerConfig) => { const frontendApp = express('frontend'); // Force SSL if blog url is set to https. The redirects handling must happen before asset and page routing, - // otherwise we serve assets/pages with http. This can cause mixed content warnings in the admin client. + // otherwise we serve assets/pages with http. This can cause mixed content warnings in the admin app. frontendApp.use(shared.middleware.urlRedirects.frontendSSLRedirect); frontendApp.lazyUse('/members', require('../members')); diff --git a/core/shared/config/overrides.json b/core/shared/config/overrides.json index ac95fa18e1..ef3bbf1ddb 100644 --- a/core/shared/config/overrides.json +++ b/core/shared/config/overrides.json @@ -2,7 +2,7 @@ "paths": { "appRoot": ".", "corePath": "core/", - "clientAssets": "core/built/assets", + "adminAssets": "core/built/assets", "helperTemplates": "core/frontend/helpers/tpl/", "adminViews": "core/server/web/admin/views/", "defaultViews": "core/server/views/", diff --git a/package.json b/package.json index 08a5403568..38e8dc8254 100644 --- a/package.json +++ b/package.json @@ -46,9 +46,9 @@ "lint:test": "eslint -c test/.eslintrc.js --ignore-path test/.eslintignore 'test/**/*.js'", "lint:code": "yarn lint:server && yarn lint:shared && yarn lint:frontend", "lint": "yarn lint:server && yarn lint:shared && yarn lint:frontend && yarn lint:test", - "fix:client": "yarn cache clean && cd core/admin && rm -rf node_modules tmp dist && yarn && cd ../../", + "fix:admin": "yarn cache clean && cd core/admin && rm -rf node_modules tmp dist && yarn && cd ../../", "fix:server": "yarn cache clean && rm -rf node_modules && yarn", - "fix": "yarn fix:client && yarn fix:server" + "fix": "yarn fix:admin && yarn fix:server" }, "engines": { "node": "^14.17.0 || ^16.13.0", diff --git a/test/e2e-server/admin.test.js b/test/e2e-server/admin.test.js index 4795dd4266..2b6a62ea78 100644 --- a/test/e2e-server/admin.test.js +++ b/test/e2e-server/admin.test.js @@ -22,7 +22,7 @@ function assertCorrectHeaders(res) { describe('Admin Routing', function () { before(async function () { - adminUtils.stubClientFiles(); + adminUtils.stubAdminFiles(); await testUtils.startGhost(); request = supertest.agent(config.get('url')); diff --git a/test/unit/shared/config/loader.test.js b/test/unit/shared/config/loader.test.js index a761b70f79..b38577a984 100644 --- a/test/unit/shared/config/loader.test.js +++ b/test/unit/shared/config/loader.test.js @@ -101,7 +101,7 @@ describe('Config Loader', function () { 'urlCache', 'appRoot', 'corePath', - 'clientAssets', + 'adminAssets', 'helperTemplates', 'adminViews', 'defaultViews', diff --git a/test/utils/admin-utils.js b/test/utils/admin-utils.js index 51aa271983..b85a02c449 100644 --- a/test/utils/admin-utils.js +++ b/test/utils/admin-utils.js @@ -1,7 +1,7 @@ const fs = require('fs-extra'); const path = require('path'); -const clientFiles = [ +const adminFiles = [ 'server/web/admin/views/default.html', 'built/assets/ghost.js', 'built/assets/ghost.css', @@ -9,8 +9,8 @@ const clientFiles = [ 'built/assets/vendor.css' ]; -module.exports.stubClientFiles = () => { - clientFiles.forEach((file) => { +module.exports.stubAdminFiles = () => { + adminFiles.forEach((file) => { const filePath = path.resolve(__dirname, '../../core/', file); fs.ensureFileSync(filePath); });