mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-04 02:01:58 -05:00
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:
parent
cbc4859bbf
commit
03122cde77
4 changed files with 13 additions and 25 deletions
11
.github/dev.js
vendored
11
.github/dev.js
vendored
|
@ -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';
|
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')) {
|
if (DASH_DASH_ARGS.includes('search') || DASH_DASH_ARGS.includes('all')) {
|
||||||
commands.push({
|
commands.push({
|
||||||
name: 'search',
|
name: 'search',
|
||||||
|
|
|
@ -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.
|
This section is mostly relevant for core team only for active development.
|
||||||
|
|
||||||
- Run `yarn start:dev` to start project in development mode
|
Run `yarn dev` with `--announcement-bar` to start Ghost with a development version of Announcement Bar
|
||||||
- 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`.
|
|
||||||
|
|
||||||
## Available Scripts
|
## Available Scripts
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,6 @@
|
||||||
"eslint-plugin-ghost": "3.0.0",
|
"eslint-plugin-ghost": "3.0.0",
|
||||||
"minimist": "1.2.8",
|
"minimist": "1.2.8",
|
||||||
"nock": "13.3.0",
|
"nock": "13.3.0",
|
||||||
"ora": "5.4.1",
|
|
||||||
"postcss": "8.4.23",
|
"postcss": "8.4.23",
|
||||||
"rewire": "6.0.0",
|
"rewire": "6.0.0",
|
||||||
"serve-handler": "6.1.5",
|
"serve-handler": "6.1.5",
|
||||||
|
|
|
@ -4,7 +4,6 @@ const chokidar = require('chokidar');
|
||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
const {spawn} = require('child_process');
|
const {spawn} = require('child_process');
|
||||||
const minimist = require('minimist');
|
const minimist = require('minimist');
|
||||||
const ora = require('ora');
|
|
||||||
|
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
const log = console.log;
|
const log = console.log;
|
||||||
|
@ -16,7 +15,7 @@ let spinner;
|
||||||
let stdOutChunks = [];
|
let stdOutChunks = [];
|
||||||
let stdErrChunks = [];
|
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 showVerbose = !!(v || verbose);
|
||||||
const showBasic = !!(b || basic);
|
const showBasic = !!(b || basic);
|
||||||
|
|
||||||
|
@ -78,15 +77,6 @@ function printBuildComplete(code) {
|
||||||
log();
|
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) {
|
function onBuildComplete(code) {
|
||||||
buildProcess = null;
|
buildProcess = null;
|
||||||
printBuildComplete(code);
|
printBuildComplete(code);
|
||||||
|
@ -114,7 +104,6 @@ function buildPortal() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printFileChanges();
|
printFileChanges();
|
||||||
printBuildStart();
|
|
||||||
fileChanges = [];
|
fileChanges = [];
|
||||||
const options = getBuildOptions();
|
const options = getBuildOptions();
|
||||||
buildProcess = spawn('yarn build', options);
|
buildProcess = spawn('yarn build', options);
|
||||||
|
@ -171,7 +160,6 @@ function startDevServer() {
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(port, () => {
|
server.listen(port, () => {
|
||||||
log(chalk.whiteBright(`Announcement-Bar dev server is running on http://localhost:${port}`));
|
|
||||||
watchFiles();
|
watchFiles();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue