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 Nov 15, 2023
1 parent 133f86b commit 1b51da6
Show file tree
Hide file tree
Showing 32 changed files with 217 additions and 1,536 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

- [#141](https://github.com/os2display/display-templates/pull/141)
improve build for local development
- [#146](https://github.com/os2display/display-templates/pull/146)
- Fixed issue where image-text image cycle is not restarting when only on slide is displayed.
- Fixed issue with slideshow default duration being 5000 s.
Expand Down
49 changes: 43 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ example content for the different templates.
`index.html` serves a local setup for working with the templates.

```bash
docker-compose run --rm node yarn
docker-compose up -d
docker compose pull
docker compose run --rm node yarn
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 +47,62 @@ Add it to `const entry = {}`:
To build the templates for production

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

To continually build components when files change

```bash
docker-compose run --rm node 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 --rm node yarn check-coding-standards
docker compose run --rm node yarn check-coding-standards
```

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

### Tests
Expand Down
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/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/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/table-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FQBJFKM0YFX1VW5K94VBSNCP",
"description": "Skabelon til tabel.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/table.js?ts=1678181508750",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/table-admin.json?ts=1678181508750",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/table-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/table.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/table-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/table-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/table-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FQBJFKM0YFX1VW5K94VBSNCP",
"description": "Skabelon til tabel.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/table.js?ts=1678181508750",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/table-admin.json?ts=1678181508750",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/table-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/table.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/table-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/table-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/video-config-develop.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FQBJFKM0YFX1VW5K94VBSNCC",
"description": "Skabelon til video.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/video.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/video-admin.json?ts=1677590005936",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/video-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/video.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/video-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/develop/build/video-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
8 changes: 4 additions & 4 deletions build/video-config-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"id": "01FQBJFKM0YFX1VW5K94VBSNCC",
"description": "Skabelon til video.",
"resources": {
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/video.js?ts=1677590005936",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/video-admin.json?ts=1677590005936",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/video-schema.json",
"component": "https://raw.githubusercontent.com/os2display/display-templates/main/build/video.js?ts=1695729788533",
"admin": "https://raw.githubusercontent.com/os2display/display-templates/main/build/video-admin.json?ts=1695729788533",
"schema": "https://raw.githubusercontent.com/os2display/display-templates/main/build/video-schema.json?ts=1695729788533",
"assets": [],
"options": {},
"content": {}
}
}
}
6 changes: 3 additions & 3 deletions src/book-review/book-review-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"id": "01FP2SME0ENTXWF362XHM6Z1B4",
"description": "Skabelon til anmeldelser.",
"resources": {
"component": "https://display-templates.local.itkdev.dk/build/book-review.js",
"admin": "https://display-templates.local.itkdev.dk/build/book-review-admin.json",
"schema": "https://display-templates.local.itkdev.dk/build/book-review-schema.json",
"component": "book-review.js",
"admin": "book-review-admin.json",
"schema": "book-review-schema.json",
"assets": [],
"options": {},
"content": {}
Expand Down
6 changes: 3 additions & 3 deletions src/calendar/calendar-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"id": "01FRJPF4XATRN8PBZ35XN84PS6",
"description": "Mulighed for at vise et kalenderfeed.",
"resources": {
"component": "https://display-templates.local.itkdev.dk/build/calendar.js",
"admin": "https://display-templates.local.itkdev.dk/build/calendar-admin.json",
"schema": "https://display-templates.local.itkdev.dk/build/calendar-schema.json",
"component": "calendar.js",
"admin": "calendar-admin.json",
"schema": "calendar-schema.json",
"assets": [],
"options": {},
"content": {}
Expand Down
4 changes: 2 additions & 2 deletions src/contacts/contacts-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"id": "01FPZ19YEHX7MQ5Q6ZS0WK0VEA",
"description": "Skabelon til kontakter.",
"resources": {
"component": "https://display-templates.local.itkdev.dk/build/contacts.js",
"admin": "https://display-templates.local.itkdev.dk/build/contacts-admin.json",
"component": "contacts.js",
"admin": "contacts-admin.json",
"schema": "",
"assets": [],
"options": {},
Expand Down
Loading

0 comments on commit 1b51da6

Please sign in to comment.