diff --git a/.github/scripts/docker-dev-full.js b/.github/scripts/docker-dev-full.js index 712d163d6a..9f9c232782 100644 --- a/.github/scripts/docker-dev-full.js +++ b/.github/scripts/docker-dev-full.js @@ -34,7 +34,7 @@ const tsPackages = fs.readdirSync(path.resolve(__dirname, '../../ghost'), {withF const liveReloadBaseUrl = config.getSubdir() || '/ghost/'; 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 = []; @@ -90,17 +90,17 @@ const COMMANDS_ADMINX = [{ env: {} }]; -if (DASH_DASH_ARGS.includes('ghost')) { +if (APP_FLAGS.includes('ghost')) { commands = [COMMAND_GHOST, COMMAND_TYPESCRIPT]; -} else if (DASH_DASH_ARGS.includes('admin')) { +} else if (APP_FLAGS.includes('admin')) { 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]; } else { 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({ name: 'portal', command: 'nx run @tryghost/portal:dev', @@ -109,7 +109,7 @@ if (DASH_DASH_ARGS.includes('portal') || DASH_DASH_ARGS.includes('all')) { env: {} }); - if (DASH_DASH_ARGS.includes('https')) { + if (APP_FLAGS.includes('https')) { // Safari needs HTTPS for it to work // 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: @@ -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({ 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'), prefixColor: 'magenta', 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'; } -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({ name: 'announcement-bar', 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'; } -if (DASH_DASH_ARGS.includes('search') || DASH_DASH_ARGS.includes('all')) { +if (APP_FLAGS.includes('search') || APP_FLAGS.includes('all')) { commands.push({ name: 'search', 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'; } -if (DASH_DASH_ARGS.includes('lexical')) { - if (DASH_DASH_ARGS.includes('https')) { +if (APP_FLAGS.includes('lexical')) { + if (APP_FLAGS.includes('https')) { // Safari needs HTTPS for it to work // 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: @@ -172,8 +172,8 @@ if (DASH_DASH_ARGS.includes('lexical')) { } } -if (DASH_DASH_ARGS.includes('comments') || DASH_DASH_ARGS.includes('all')) { - if (DASH_DASH_ARGS.includes('https')) { +if (APP_FLAGS.includes('comments') || APP_FLAGS.includes('all')) { + if (APP_FLAGS.includes('https')) { // Safari needs HTTPS for it to work // 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: @@ -195,8 +195,8 @@ if (DASH_DASH_ARGS.includes('comments') || DASH_DASH_ARGS.includes('all')) { } async function handleStripe() { - if (DASH_DASH_ARGS.includes('stripe') || DASH_DASH_ARGS.includes('all')) { - if (DASH_DASH_ARGS.includes('offline') || DASH_DASH_ARGS.includes('browser-tests')) { + if (APP_FLAGS.includes('stripe') || APP_FLAGS.includes('all')) { + if (APP_FLAGS.includes('offline') || APP_FLAGS.includes('browser-tests')) { return; } diff --git a/Dockerfile b/Dockerfile index 02f00c4065..7afdd067e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,4 @@ EXPOSE 2368 EXPOSE 4200 ENTRYPOINT ["./docker-local-entrypoint.sh"] -CMD ["node", ".github/scripts/dev.js"] +CMD ["yarn", "docker:dev:entry"] diff --git a/package.json b/package.json index 54def3774b..0936848b5e 100644 --- a/package.json +++ b/package.json @@ -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: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:dev:entry": "node .github/scripts/docker-dev-full.js", "lint": "nx run-many -t lint", "test": "nx run-many -t test", "test:unit": "nx run-many -t test:unit",