0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Added support for app flags

This commit is contained in:
Chris Raible 2024-10-09 23:45:25 +01:00
parent 541b8450d1
commit f10f9a6de1
3 changed files with 18 additions and 17 deletions

View file

@ -34,7 +34,7 @@ const tsPackages = fs.readdirSync(path.resolve(__dirname, '../../ghost'), {withF
const liveReloadBaseUrl = config.getSubdir() || '/ghost/'; const liveReloadBaseUrl = config.getSubdir() || '/ghost/';
const siteUrl = config.getSiteUrl(); const siteUrl = config.getSiteUrl();
const DASH_DASH_ARGS = process.argv.filter(a => a.startsWith('--')).map(a => a.slice(2)); const APP_FLAGS = process.env.APP_FLAGS?.split(',') || [];
let commands = []; let commands = [];
@ -90,17 +90,17 @@ const COMMANDS_ADMINX = [{
env: {} env: {}
}]; }];
if (DASH_DASH_ARGS.includes('ghost')) { if (APP_FLAGS.includes('ghost')) {
commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT]; commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT];
} else if (DASH_DASH_ARGS.includes('admin')) { } else if (APP_FLAGS.includes('admin')) {
commands = [COMMAND_ADMIN, ...COMMANDS_ADMINX]; commands = [COMMAND_ADMIN, ...COMMANDS_ADMINX];
} else if (DASH_DASH_ARGS.includes('browser-tests')) { } else if (APP_FLAGS.includes('browser-tests')) {
commands = [COMMAND_BROWSERTESTS, COMMAND_TYPESCRIPT]; commands = [COMMAND_BROWSERTESTS, COMMAND_TYPESCRIPT];
} else { } else {
commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT, COMMAND_ADMIN, ...COMMANDS_ADMINX]; commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT, COMMAND_ADMIN, ...COMMANDS_ADMINX];
} }
if (DASH_DASH_ARGS.includes('portal') || DASH_DASH_ARGS.includes('all')) { if (APP_FLAGS.includes('portal') || APP_FLAGS.includes('all')) {
commands.push({ commands.push({
name: 'portal', name: 'portal',
command: 'nx run @tryghost/portal:dev', command: 'nx run @tryghost/portal:dev',
@ -109,7 +109,7 @@ if (DASH_DASH_ARGS.includes('portal') || DASH_DASH_ARGS.includes('all')) {
env: {} env: {}
}); });
if (DASH_DASH_ARGS.includes('https')) { if (APP_FLAGS.includes('https')) {
// Safari needs HTTPS for it to work // Safari needs HTTPS for it to work
// To make this work, you'll need a CADDY server running in front // To make this work, you'll need a CADDY server running in front
// Note the port is different because of this extra layer. Use the following Caddyfile: // Note the port is different because of this extra layer. Use the following Caddyfile:
@ -123,10 +123,10 @@ if (DASH_DASH_ARGS.includes('portal') || DASH_DASH_ARGS.includes('all')) {
} }
} }
if (DASH_DASH_ARGS.includes('signup') || DASH_DASH_ARGS.includes('all')) { if (APP_FLAGS.includes('signup') || APP_FLAGS.includes('all')) {
commands.push({ commands.push({
name: 'signup-form', name: 'signup-form',
command: DASH_DASH_ARGS.includes('signup') ? 'nx run @tryghost/signup-form:dev' : 'nx run @tryghost/signup-form:preview', command: APP_FLAGS.includes('signup') ? 'nx run @tryghost/signup-form:dev' : 'nx run @tryghost/signup-form:preview',
cwd: path.resolve(__dirname, '../../apps/signup-form'), cwd: path.resolve(__dirname, '../../apps/signup-form'),
prefixColor: 'magenta', prefixColor: 'magenta',
env: {} env: {}
@ -134,7 +134,7 @@ if (DASH_DASH_ARGS.includes('signup') || DASH_DASH_ARGS.includes('all')) {
COMMAND_GHOST.env['signupForm__url'] = 'http://localhost:6174/signup-form.min.js'; COMMAND_GHOST.env['signupForm__url'] = 'http://localhost:6174/signup-form.min.js';
} }
if (DASH_DASH_ARGS.includes('announcement-bar') || DASH_DASH_ARGS.includes('announcementBar') || DASH_DASH_ARGS.includes('announcementbar') || DASH_DASH_ARGS.includes('all')) { if (APP_FLAGS.includes('announcement-bar') || APP_FLAGS.includes('announcementBar') || APP_FLAGS.includes('announcementbar') || APP_FLAGS.includes('all')) {
commands.push({ commands.push({
name: 'announcement-bar', name: 'announcement-bar',
command: 'nx run @tryghost/announcement-bar:dev', command: 'nx run @tryghost/announcement-bar:dev',
@ -145,7 +145,7 @@ if (DASH_DASH_ARGS.includes('announcement-bar') || DASH_DASH_ARGS.includes('anno
COMMAND_GHOST.env['announcementBar__url'] = 'http://localhost:4177/announcement-bar.min.js'; COMMAND_GHOST.env['announcementBar__url'] = 'http://localhost:4177/announcement-bar.min.js';
} }
if (DASH_DASH_ARGS.includes('search') || DASH_DASH_ARGS.includes('all')) { if (APP_FLAGS.includes('search') || APP_FLAGS.includes('all')) {
commands.push({ commands.push({
name: 'search', name: 'search',
command: 'nx run @tryghost/sodo-search:dev', command: 'nx run @tryghost/sodo-search:dev',
@ -157,8 +157,8 @@ if (DASH_DASH_ARGS.includes('search') || DASH_DASH_ARGS.includes('all')) {
COMMAND_GHOST.env['sodoSearch__styles'] = 'http://localhost:4178/main.css'; COMMAND_GHOST.env['sodoSearch__styles'] = 'http://localhost:4178/main.css';
} }
if (DASH_DASH_ARGS.includes('lexical')) { if (APP_FLAGS.includes('lexical')) {
if (DASH_DASH_ARGS.includes('https')) { if (APP_FLAGS.includes('https')) {
// Safari needs HTTPS for it to work // Safari needs HTTPS for it to work
// To make this work, you'll need a CADDY server running in front // To make this work, you'll need a CADDY server running in front
// Note the port is different because of this extra layer. Use the following Caddyfile: // Note the port is different because of this extra layer. Use the following Caddyfile:
@ -172,8 +172,8 @@ if (DASH_DASH_ARGS.includes('lexical')) {
} }
} }
if (DASH_DASH_ARGS.includes('comments') || DASH_DASH_ARGS.includes('all')) { if (APP_FLAGS.includes('comments') || APP_FLAGS.includes('all')) {
if (DASH_DASH_ARGS.includes('https')) { if (APP_FLAGS.includes('https')) {
// Safari needs HTTPS for it to work // Safari needs HTTPS for it to work
// To make this work, you'll need a CADDY server running in front // To make this work, you'll need a CADDY server running in front
// Note the port is different because of this extra layer. Use the following Caddyfile: // Note the port is different because of this extra layer. Use the following Caddyfile:
@ -195,8 +195,8 @@ if (DASH_DASH_ARGS.includes('comments') || DASH_DASH_ARGS.includes('all')) {
} }
async function handleStripe() { async function handleStripe() {
if (DASH_DASH_ARGS.includes('stripe') || DASH_DASH_ARGS.includes('all')) { if (APP_FLAGS.includes('stripe') || APP_FLAGS.includes('all')) {
if (DASH_DASH_ARGS.includes('offline') || DASH_DASH_ARGS.includes('browser-tests')) { if (APP_FLAGS.includes('offline') || APP_FLAGS.includes('browser-tests')) {
return; return;
} }

View file

@ -11,4 +11,4 @@ EXPOSE 2368
EXPOSE 4200 EXPOSE 4200
ENTRYPOINT ["./docker-local-entrypoint.sh"] ENTRYPOINT ["./docker-local-entrypoint.sh"]
CMD ["node", ".github/scripts/dev.js"] CMD ["yarn", "docker:dev:entry"]

View file

@ -34,6 +34,7 @@
"reset:data:empty": "cd ghost/core && node index.js generate-data --clear-database --quantities members:0,posts:0 --seed 123", "reset:data:empty": "cd ghost/core && node index.js generate-data --clear-database --quantities members:0,posts:0 --seed 123",
"reset:data:xxl": "cd ghost/core && node index.js generate-data --clear-database --quantities members:2000000,posts:0,emails:0,members_stripe_customers:0,members_login_events:0,members_status_events:0 --seed 123", "reset:data:xxl": "cd ghost/core && node index.js generate-data --clear-database --quantities members:2000000,posts:0,emails:0,members_stripe_customers:0,members_login_events:0,members_status_events:0 --seed 123",
"docker:reset": "docker-compose -f .github/scripts/docker-compose.yml down -v && docker-compose -f .github/scripts/docker-compose.yml up -d --wait", "docker:reset": "docker-compose -f .github/scripts/docker-compose.yml down -v && docker-compose -f .github/scripts/docker-compose.yml up -d --wait",
"docker:dev:entry": "node .github/scripts/docker-dev-full.js",
"lint": "nx run-many -t lint", "lint": "nx run-many -t lint",
"test": "nx run-many -t test", "test": "nx run-many -t test",
"test:unit": "nx run-many -t test:unit", "test:unit": "nx run-many -t test:unit",