Skip to content

Commit e2a77d8

Browse files
authored
Introduce xb-ui-dev command React app development (#19)
1 parent 35ab671 commit e2a77d8

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ This creates and configures a DDEV project for local Drupal [Experience Builder]
99
- [Usage](#usage)
1010
- [Updating](#updating)
1111
- [Cypress](#cypress)
12-
- [Support & community](#support--community)
13-
- [FAQ & known issues](#faq--known-issues)
12+
- [Setup](#setup)
13+
- [Usage](#usage-1)
14+
- [Support \& community](#support--community)
15+
- [FAQ \& known issues](#faq--known-issues)
16+
- [Can I use Cypress on Linux or Windows?](#can-i-use-cypress-on-linux-or-windows)
17+
- [What if Cypress fails to start?](#what-if-cypress-fails-to-start)
18+
- [What if I get an HTTPS error?](#what-if-i-get-an-https-error)
1419

1520
## Requirements
1621

@@ -49,6 +54,12 @@ Any time you update the Experience Builder module or modify its front-end code,
4954
ddev ui-build
5055
```
5156

57+
When developing the React app, make sure to use the HTTPS URL of your DDEV project, then run:
58+
59+
```shell
60+
ddev xb-ui-dev
61+
```
62+
5263
To completely reinstall Drupal and the Experience Builder module, run:
5364

5465
```shell

commands/web/xb-ui-build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77

88
cd "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/modules/contrib/experience_builder/ui" || exit 1
99

10+
drush pm:uninstall xb_vite -y > /dev/null 2>&1 || :
1011
npm ci
1112
npm run build

commands/web/xb-ui-dev

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
## #ddev-generated
4+
## Description: Install dependencies and run Experience Builder's UI app development server.
5+
## Example: ddev xb-ui-dev
6+
## Aliases: ui-dev,dev
7+
8+
cd "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/modules/contrib/experience_builder/ui" || exit 1
9+
10+
drush pm:install xb_vite -y > /dev/null 2>&1 || :
11+
npm install
12+
npm run drupaldev -- --host

config.drupal-xb-dev.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ web_environment:
55
- DB_URL=sqlite://web/sites/default/files/db.sqlite
66
- DISPLAY=host.docker.internal:0
77
- DRUPAL_TEST_DB_URL=sqlite://web/sites/default/files/db.sqlite
8-
- VITE_SERVER_ORIGIN=http://localhost:5173
8+
- VITE_SERVER_ORIGIN=https://${DDEV_HOSTNAME}:5174
99
webimage_extra_packages:
1010
- libasound2
1111
- libgbm-dev
@@ -17,3 +17,8 @@ webimage_extra_packages:
1717
- libxtst6
1818
- xauth
1919
- xvfb
20+
web_extra_exposed_ports:
21+
- name: vite-dev-server
22+
container_port: 5173
23+
http_port: 5173
24+
https_port: 5174

install.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ project_files:
1717
- commands/web/xb-site-install
1818
- commands/web/xb-stylelint
1919
- commands/web/xb-ui-build
20+
- commands/web/xb-ui-dev
2021
- config.drupal-xb-dev.yaml
2122

2223
post_install_actions:

0 commit comments

Comments
 (0)