Skip to content

Commit

Permalink
DISPLAY-1030: Improved build for local development
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi-itk committed Sep 26, 2023
1 parent dd3fefd commit 6ab3ceb
Show file tree
Hide file tree
Showing 39 changed files with 245 additions and 1,567 deletions.
50 changes: 43 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ example content for the different templates.
`index.html` serves a local setup for working with the templates.

```bash
docker-compose run node yarn
docker-compose up -d
docker compose pull
docker compose up --detach
```

The docker setup serves the files in the `build/` (see build for production) folder as `display-templates.local.itkdev.dk/build/`.
Expand Down Expand Up @@ -46,26 +46,62 @@ Add it to `const entry = {}`:
To build the templates for production

```bash
yarn build
docker compose run --rm node yarn install
docker compose run --rm node yarn build
```

To continually build components when files change

```bash
yarn build-watch
docker compose run --rm node yarn build-watch
```

The compiled files will be placed in `build/`. These should be committed to
git repository, to enable Remote Components to load them in the clients.

### Build base URL

The default base build URLs,
`https://raw.githubusercontent.com/os2display/display-templates/develop/build/`
and
`https://raw.githubusercontent.com/os2display/display-templates/main/build/`,
respectively, can be overridden via environment variables:

Override both with same value:

```sh
docker compose run --rm --env DEPLOYMENT_BUILD_BASE_URL="http://$(docker compose port nginx 80)/build/" node yarn build
```

Override "develop" base URL only:

```sh
docker compose run --rm --env DEPLOYMENT_BUILD_BASE_URL_DEVELOP="http://$(docker compose port nginx 80)/build/" node yarn build
```

Override "main" base URL only:

```sh
docker compose run --rm --env DEPLOYMENT_BUILD_BASE_URL_MAIN="http://$(docker compose port nginx 80)/build/" node yarn build
```

The default behavoir is equivalent to

```sh
docker compose run --rm \
--env DEPLOYMENT_BUILD_BASE_URL_DEVELOP="https://raw.githubusercontent.com/os2display/display-templates/develop/build/" \
--env DEPLOYMENT_BUILD_BASE_URL_MAIN="https://raw.githubusercontent.com/os2display/display-templates/main/build/" \
node yarn build
```

### Linting

```bash
docker-compose run node yarn check-coding-standards
docker compose run --rm node yarn check-coding-standards
```

```bash
docker-compose run node yarn apply-coding-standards
docker compose run --rm node yarn apply-coding-standards
```

### Tests
Expand All @@ -82,4 +118,4 @@ docker compose run cypress run
Or open mode
```sh
yarn cypress open
```
```
8 changes: 4 additions & 4 deletions build/book-review-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FP2SME0ENTXWF362XHM6Z1B4",
"description": "Skabelon til anmeldelser.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/book-review.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/book-review-admin.json?ts=1677590005936",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/book-review-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/book-review.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/book-review-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/book-review-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/book-review-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FP2SME0ENTXWF362XHM6Z1B4",
"description": "Skabelon til anmeldelser.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/book-review.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/book-review-admin.json?ts=1677590005936",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/book-review-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/book-review.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/book-review-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/book-review-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/calendar-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FRJPF4XATRN8PBZ35XN84PS6",
"description": "Mulighed for at vise et kalenderfeed.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/calendar.js?ts=1679479409437",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/calendar-admin.json?ts=1679479409437",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/calendar-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/calendar.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/calendar-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/calendar-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/calendar-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FRJPF4XATRN8PBZ35XN84PS6",
"description": "Mulighed for at vise et kalenderfeed.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/calendar.js?ts=1679479409437",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/calendar-admin.json?ts=1679479409437",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/calendar-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/calendar.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/calendar-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/calendar-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
6 changes: 3 additions & 3 deletions build/contacts-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FPZ19YEHX7MQ5Q6ZS0WK0VEA",
"description": "Skabelon til kontakter.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/contacts.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/contacts-admin.json?ts=1677590005936",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/contacts.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/contacts-admin.json?ts=1695729788533",
"schema": "",
"assets": [],
"options": {},
"content": {}
}
}
}
6 changes: 3 additions & 3 deletions build/contacts-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FPZ19YEHX7MQ5Q6ZS0WK0VEA",
"description": "Skabelon til kontakter.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/contacts.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/contacts-admin.json?ts=1677590005936",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/contacts.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/contacts-admin.json?ts=1695729788533",
"schema": "",
"assets": [],
"options": {},
"content": {}
}
}
}
6 changes: 3 additions & 3 deletions build/iframe-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FQBJQ2M3544ZKAADPWBXHY71",
"description": "Skabelon til iFrame.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/iframe.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/iframe-admin.json?ts=1677590005936",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/iframe.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/iframe-admin.json?ts=1695729788533",
"schema": "",
"assets": [],
"options": {},
"content": {}
}
}
}
6 changes: 3 additions & 3 deletions build/iframe-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FQBJQ2M3544ZKAADPWBXHY71",
"description": "Skabelon til iFrame.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/iframe.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/iframe-admin.json?ts=1677590005936",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/iframe.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/iframe-admin.json?ts=1695729788533",
"schema": "",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/image-text-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FP2SNGFN0BZQH03KCBXHKYHG",
"description": "Mulighed for at sætte billede og tekst, med forskellige visninger.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/image-text.js?ts=1680079550081",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/image-text-admin.json?ts=1680079550081",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/image-text-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/image-text.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/image-text-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/image-text-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/image-text-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FP2SNGFN0BZQH03KCBXHKYHG",
"description": "Mulighed for at sætte billede og tekst, med forskellige visninger.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/image-text.js?ts=1680079550081",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/image-text-admin.json?ts=1680079550081",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/image-text-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/image-text.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/image-text-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/image-text-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/instagram-feed-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FTZC0RKJYHG4JVZG5K709G46",
"description": "Mulighed for at vise instagram indhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/instagram-feed.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/instagram-feed-admin.json?ts=1677590005936",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/instagram-feed-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/instagram-feed.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/instagram-feed-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/instagram-feed-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/instagram-feed-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FTZC0RKJYHG4JVZG5K709G46",
"description": "Mulighed for at vise instagram indhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/instagram-feed.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/instagram-feed-admin.json?ts=1677590005936",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/instagram-feed-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/instagram-feed.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/instagram-feed-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/instagram-feed-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/poster-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FWJZQ25A1868V63CWYYHQFKQ",
"description": "Mulighed for at vise plakat indhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster.js?ts=1692122329501",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-admin.json?ts=1692122329501",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/poster-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/poster-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FWJZQ25A1868V63CWYYHQFKQ",
"description": "Mulighed for at vise plakat indhold.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster.js?ts=1692122329501",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-admin.json?ts=1692122329501",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/poster-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/rss-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FQC300GGWCA7A8H0SXY6P9FG",
"description": "Mulighed for at vise et rss feed.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/rss.js?ts=1692122329501",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/rss-admin.json?ts=1692122329501",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/rss-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/rss.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/rss-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/rss-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/rss-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FQC300GGWCA7A8H0SXY6P9FG",
"description": "Mulighed for at vise et rss feed.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/rss.js?ts=1692122329501",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/rss-admin.json?ts=1692122329501",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/rss-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/rss.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/rss-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/rss-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/slideshow-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FP2SNSC9VXD10ZKXQR819NS9",
"description": "Skabelon til slideshow af billeder med forskellige effekter",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow-admin.json?ts=1677590005936",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/slideshow-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/slideshow-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FP2SNSC9VXD10ZKXQR819NS9",
"description": "Skabelon til slideshow af billeder med forskellige effekter",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow-admin.json?ts=1677590005936",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/slideshow-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
Loading

0 comments on commit 6ab3ceb

Please sign in to comment.