From a2a79cec0ef5f1687561c8e7bc26ffd3a886808d Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Thu, 1 Jun 2023 10:20:37 +0200 Subject: [PATCH] Added support for `yarn dev --signup` no issue Added support for `--signup` to `yarn dev`. This will make sure that the signup form preview server is served (with rebuilding) and can be used in admin (instead of using the published version). This is also automatically started when using `yarn dev --all`, but with a twist: If you only run `yarn dev --all`, it will only build and watch the production build of the signup form. If you use `yarn dev --signup` or `yarn dev --all --signup` it will also serve the demo app on `http://localhost:6173`. --- .github/dev.js | 11 +++++++++++ ghost/signup-form/README.md | 10 ++++++++-- ghost/signup-form/package.json | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/dev.js b/.github/dev.js index e441eae682..5151f3a2f1 100644 --- a/.github/dev.js +++ b/.github/dev.js @@ -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('signup') || DASH_DASH_ARGS.includes('all')) { + commands.push({ + name: 'signup-form', + command: DASH_DASH_ARGS.includes('signup') ? 'yarn dev' : 'yarn preview', + cwd: path.resolve(__dirname, '../ghost/signup-form'), + prefixColor: 'magenta', + env: {} + }); + 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')) { commands.push({ name: 'announcement-bar', diff --git a/ghost/signup-form/README.md b/ghost/signup-form/README.md index 38f763a8e2..26c27a5f51 100644 --- a/ghost/signup-form/README.md +++ b/ghost/signup-form/README.md @@ -9,9 +9,15 @@ Embed a Ghost signup form on any site. - Run `yarn` in Ghost monorepo root - Run `yarn` in this directory -### Running the development version +### Running via Ghost `yarn dev` in root folder -Run `yarn dev` to start the development server to test/develop the form standalone. +You can automatically start the signup-form dev server when developing Ghost by running Ghost (in root folder) via `yarn dev --all`. This will only build the production build, without the demo site. + +Running via `yarn dev --all --signup` or `yarn dev --signup` will also serve the demo site on `http://localhost:6173`. + +### Running the development version only + +Run `yarn dev` (in package folder) to start the development server to test/develop the form standalone. - This will generate a demo site on http://localhost:6173 - This will build and watch the production build and host it on http://localhost:6174/signup-form.min.js (different port!) diff --git a/ghost/signup-form/package.json b/ghost/signup-form/package.json index 6e2c833d5c..b74d3c28c0 100644 --- a/ghost/signup-form/package.json +++ b/ghost/signup-form/package.json @@ -18,6 +18,7 @@ }, "scripts": { "dev": "concurrently \"vite --port 6173\" \"vite preview -l silent\" \"vite build --watch\"", + "preview": "concurrently \"vite preview -l silent\" \"vite build --watch\"", "dev:test": "vite build && vite preview --port 6175", "build": "tsc && vite build", "lint": "yarn run lint:js", @@ -26,7 +27,6 @@ "test:e2e": "NODE_OPTIONS='--experimental-specifier-resolution=node --no-warnings' VITE_TEST=true playwright test", "test:slowmo": "TIMEOUT=100000 PLAYWRIGHT_SLOWMO=100 yarn test:e2e --headed", "test:e2e:full": "ALL_BROWSERS=1 yarn test:e2e", - "preview": "vite preview", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", "preship": "yarn lint",