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
This commit is contained in:
Hannah Wolfe 2022-05-17 09:05:44 +01:00
parent bfc2ddec84
commit 8ec8a21b71
No known key found for this signature in database
GPG Key ID: AB586C3B5AE5C037
9 changed files with 31 additions and 31 deletions

View File

@ -3,11 +3,11 @@ const fs = require('fs-extra');
const path = require('path'); const path = require('path');
// Utility for outputting messages indicating that the admin is building, as it can take a while. // Utility for outputting messages indicating that the admin is building, as it can take a while.
let hasBuiltClient = false; let hasBuiltAdmin = false;
const logBuildingClient = function (grunt) { const logBuildingAdmin = function (grunt) {
if (!hasBuiltClient) { if (!hasBuiltAdmin) {
grunt.log.writeln('Building admin client... (can take ~1min)'); grunt.log.writeln('Building admin app... (can take ~1min)');
setTimeout(logBuildingClient, 5000, grunt); setTimeout(logBuildingAdmin, 5000, grunt);
} }
}; };
@ -15,18 +15,18 @@ module.exports = function (grunt) {
// grunt dev - use yarn dev instead! // grunt dev - use yarn dev instead!
// - Start a server & build assets on the fly whilst developing // - Start a server & build assets on the fly whilst developing
grunt.registerTask('dev', 'Dev Mode; watch files and restart server on changes', function () { grunt.registerTask('dev', 'Dev Mode; watch files and restart server on changes', function () {
if (grunt.option('client')) { if (grunt.option('admin')) {
grunt.task.run(['clean:built', 'bgShell:client']); grunt.task.run(['clean:built', 'bgShell:admin']);
} else if (grunt.option('server')) { } else if (grunt.option('server')) {
grunt.task.run(['express:dev', 'watch']); grunt.task.run(['express:dev', 'watch']);
} else { } 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! // grunt build -- use yarn build instead!
// - Builds the client without a watch task // - Builds the admin without a watch task
grunt.registerTask('build', 'Build client app in development mode', grunt.registerTask('build', 'Build admin app in development mode',
['subgrunt:init', 'clean:tmp', 'ember']); ['subgrunt:init', 'clean:tmp', 'ember']);
// Helpers for common deprecated tasks // Helpers for common deprecated tasks
@ -41,7 +41,7 @@ module.exports = function (grunt) {
// --- Sub Commands // --- Sub Commands
// Used to make other commands work // 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', grunt.registerTask('init', 'Prepare the project for development',
['update_submodules:pinned', 'build']); ['update_submodules:pinned', 'build']);
@ -101,17 +101,17 @@ module.exports = function (grunt) {
}, },
// grunt-bg-shell // grunt-bg-shell
// Tools for building the client // Tools for building the admin
bgShell: { bgShell: {
client: { admin: {
cmd: function () { cmd: function () {
logBuildingClient(grunt); logBuildingAdmin(grunt);
return 'grunt subgrunt:watch'; return 'grunt subgrunt:watch';
}, },
bg: grunt.option('client') ? false : true, bg: grunt.option('admin') ? false : true,
stdout: function (chunk) { stdout: function (chunk) {
// hide certain output to prevent confusion when running alongside server // hide certain output to prevent confusion when running alongside server
const filter = grunt.option('client') ? false : [ const filter = grunt.option('admin') ? false : [
/> ghost-admin/, /> ghost-admin/,
/^Livereload/, /^Livereload/,
/^Serving on/ /^Serving on/
@ -124,24 +124,24 @@ module.exports = function (grunt) {
} }
if (chunk.indexOf('Slowest Nodes') !== -1) { if (chunk.indexOf('Slowest Nodes') !== -1) {
hasBuiltClient = true; hasBuiltAdmin = true;
} }
}, },
stderr: function (chunk) { stderr: function (chunk) {
const skipFilter = grunt.option('client') ? false : [ const skipFilter = grunt.option('admin') ? false : [
/- building/ /- building/
].some(function (regexp) { ].some(function (regexp) {
return regexp.test(chunk); return regexp.test(chunk);
}); });
const errorFilter = grunt.option('client') ? false : [ const errorFilter = grunt.option('admin') ? false : [
/^>>/ /^>>/
].some(function (regexp) { ].some(function (regexp) {
return regexp.test(chunk); return regexp.test(chunk);
}); });
if (!skipFilter) { if (!skipFilter) {
hasBuiltClient = errorFilter ? hasBuiltClient : true; hasBuiltAdmin = errorFilter ? hasBuiltAdmin : true;
grunt.log.error(chunk); grunt.log.error(chunk);
} }
} }

View File

@ -79,7 +79,7 @@ Check out our [official documentation](https://ghost.org/docs/) for more informa
### Contributors & advanced developers ### 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)
   

View File

@ -17,7 +17,7 @@ module.exports = function setupAdminApp() {
// @TODO ensure this gets a local 404 error handler // @TODO ensure this gets a local 404 error handler
const configMaxAge = config.get('caching:admin:maxAge'); const configMaxAge = config.get('caching:admin:maxAge');
adminApp.use('/assets', serveStatic( adminApp.use('/assets', serveStatic(
config.get('paths').clientAssets, config.get('paths').adminAssets,
{maxAge: (configMaxAge || configMaxAge === 0) ? configMaxAge : constants.ONE_YEAR_MS, fallthrough: false} {maxAge: (configMaxAge || configMaxAge === 0) ? configMaxAge : constants.ONE_YEAR_MS, fallthrough: false}
)); ));

View File

@ -14,7 +14,7 @@ module.exports = (routerConfig) => {
const frontendApp = express('frontend'); const frontendApp = express('frontend');
// Force SSL if blog url is set to https. The redirects handling must happen before asset and page routing, // 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.use(shared.middleware.urlRedirects.frontendSSLRedirect);
frontendApp.lazyUse('/members', require('../members')); frontendApp.lazyUse('/members', require('../members'));

View File

@ -2,7 +2,7 @@
"paths": { "paths": {
"appRoot": ".", "appRoot": ".",
"corePath": "core/", "corePath": "core/",
"clientAssets": "core/built/assets", "adminAssets": "core/built/assets",
"helperTemplates": "core/frontend/helpers/tpl/", "helperTemplates": "core/frontend/helpers/tpl/",
"adminViews": "core/server/web/admin/views/", "adminViews": "core/server/web/admin/views/",
"defaultViews": "core/server/views/", "defaultViews": "core/server/views/",

View File

@ -46,9 +46,9 @@
"lint:test": "eslint -c test/.eslintrc.js --ignore-path test/.eslintignore 'test/**/*.js'", "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:code": "yarn lint:server && yarn lint:shared && yarn lint:frontend",
"lint": "yarn lint:server && yarn lint:shared && yarn lint:frontend && yarn lint:test", "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:server": "yarn cache clean && rm -rf node_modules && yarn",
"fix": "yarn fix:client && yarn fix:server" "fix": "yarn fix:admin && yarn fix:server"
}, },
"engines": { "engines": {
"node": "^14.17.0 || ^16.13.0", "node": "^14.17.0 || ^16.13.0",

View File

@ -22,7 +22,7 @@ function assertCorrectHeaders(res) {
describe('Admin Routing', function () { describe('Admin Routing', function () {
before(async function () { before(async function () {
adminUtils.stubClientFiles(); adminUtils.stubAdminFiles();
await testUtils.startGhost(); await testUtils.startGhost();
request = supertest.agent(config.get('url')); request = supertest.agent(config.get('url'));

View File

@ -101,7 +101,7 @@ describe('Config Loader', function () {
'urlCache', 'urlCache',
'appRoot', 'appRoot',
'corePath', 'corePath',
'clientAssets', 'adminAssets',
'helperTemplates', 'helperTemplates',
'adminViews', 'adminViews',
'defaultViews', 'defaultViews',

View File

@ -1,7 +1,7 @@
const fs = require('fs-extra'); const fs = require('fs-extra');
const path = require('path'); const path = require('path');
const clientFiles = [ const adminFiles = [
'server/web/admin/views/default.html', 'server/web/admin/views/default.html',
'built/assets/ghost.js', 'built/assets/ghost.js',
'built/assets/ghost.css', 'built/assets/ghost.css',
@ -9,8 +9,8 @@ const clientFiles = [
'built/assets/vendor.css' 'built/assets/vendor.css'
]; ];
module.exports.stubClientFiles = () => { module.exports.stubAdminFiles = () => {
clientFiles.forEach((file) => { adminFiles.forEach((file) => {
const filePath = path.resolve(__dirname, '../../core/', file); const filePath = path.resolve(__dirname, '../../core/', file);
fs.ensureFileSync(filePath); fs.ensureFileSync(filePath);
}); });