Added support to yarn dev for --announcement-bar

refs https://github.com/TryGhost/Toolbox/issues/584

- we should strive to provide a good development experience by keeping
  the number of "other" setup steps to a minimum
- this adds support for the Announcement Bar app to the dev script so a
  simple flag spins up the dev server too
This commit is contained in:
Daniel Lockyer 2023-05-22 15:23:17 +02:00
parent cbc4859bbf
commit 03122cde77
No known key found for this signature in database
4 changed files with 13 additions and 25 deletions

11
.github/dev.js vendored
View File

@ -82,6 +82,17 @@ if (DASH_DASH_ARGS.includes('portal') || DASH_DASH_ARGS.includes('all')) {
COMMAND_GHOST.env['portal__url'] = 'http://localhost:5368/umd/portal.min.js';
}
if (DASH_DASH_ARGS.includes('announcement-bar') || DASH_DASH_ARGS.includes('announcementBar') || DASH_DASH_ARGS.includes('announcementbar') || DASH_DASH_ARGS.includes('all')) {
commands.push({
name: 'announcement-bar',
command: 'yarn dev',
cwd: path.resolve(__dirname, '../ghost/announcement-bar'),
prefixColor: '#DC9D00',
env: {}
});
COMMAND_GHOST.env['announcementBar__url'] = 'http://localhost:5371/announcement-bar';
}
if (DASH_DASH_ARGS.includes('search') || DASH_DASH_ARGS.includes('all')) {
commands.push({
name: 'search',

View File

@ -8,17 +8,7 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo
This section is mostly relevant for core team only for active development.
- Run `yarn start:dev` to start project in development mode
- Update `config.local.json` in Ghost repo:
```json
{
...
"announcementBar": {
"url": "http://localhost:5370/announcement-bar"
}
}
```
It's also possible to specify a custom port when running the script using - `--port=xxxx`.
Run `yarn dev` with `--announcement-bar` to start Ghost with a development version of Announcement Bar
## Available Scripts

View File

@ -82,7 +82,6 @@
"eslint-plugin-ghost": "3.0.0",
"minimist": "1.2.8",
"nock": "13.3.0",
"ora": "5.4.1",
"postcss": "8.4.23",
"rewire": "6.0.0",
"serve-handler": "6.1.5",

View File

@ -4,7 +4,6 @@ const chokidar = require('chokidar');
const chalk = require('chalk');
const {spawn} = require('child_process');
const minimist = require('minimist');
const ora = require('ora');
/* eslint-disable no-console */
const log = console.log;
@ -16,7 +15,7 @@ let spinner;
let stdOutChunks = [];
let stdErrChunks = [];
const {v, verbose, port = 5370, basic, b} = minimist(process.argv.slice(2));
const {v, verbose, port = 5371, basic, b} = minimist(process.argv.slice(2));
const showVerbose = !!(v || verbose);
const showBasic = !!(b || basic);
@ -78,15 +77,6 @@ function printBuildComplete(code) {
log();
}
function printBuildStart() {
if (showVerbose) {
log(chalk.bold.greenBright.bgBlackBright(`${'-'.repeat(32)}Building${'-'.repeat(32)}`));
log();
} else {
spinner = ora(chalk.magentaBright.bold('Bundling files, hang on...')).start();
}
}
function onBuildComplete(code) {
buildProcess = null;
printBuildComplete(code);
@ -114,7 +104,6 @@ function buildPortal() {
return;
}
printFileChanges();
printBuildStart();
fileChanges = [];
const options = getBuildOptions();
buildProcess = spawn('yarn build', options);
@ -171,7 +160,6 @@ function startDevServer() {
});
server.listen(port, () => {
log(chalk.whiteBright(`Announcement-Bar dev server is running on http://localhost:${port}`));
watchFiles();
});
}