Skip to content

Commit 8871d38

Browse files
authored
Merge pull request #308 from ThinkR-open/bs4_book
New look with bs4_book
2 parents ac5eda7 + 9c86853 commit 8871d38

17 files changed

+389
-257
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
on:
2+
pull_request:
3+
branches:
4+
- master
5+
6+
env:
7+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
8+
9+
name: renderbookpr
10+
11+
jobs:
12+
bookdown:
13+
14+
name: Render-Book
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v1
20+
21+
- uses: r-lib/actions/setup-r@v1
22+
with:
23+
crayon.enabled: 'FALSE'
24+
r-version: '3.6.1'
25+
26+
- uses: actions/cache@v1
27+
with:
28+
path: ~/.local/share/renv
29+
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
30+
restore-keys: |
31+
${{ runner.os }}-renv-
32+
33+
- uses: r-lib/actions/setup-pandoc@v1
34+
35+
- name: Install tinytex
36+
uses: r-lib/actions/setup-tinytex@master
37+
38+
- name: Install sysreq
39+
run: sudo apt update && sudo apt install -y gdal-bin git-core libcairo2-dev libgdal-dev libgeos-dev libgeos++-dev libgit2-dev libpng-dev libssh2-1-dev libssl-dev libudunits2-dev libxml2-dev make pandoc pandoc-citeproc zlib1g-dev libmagick++-dev libssl-dev libsasl2-dev
40+
41+
- name: Pulling hexmake
42+
run: docker pull colinfay/hexmake
43+
44+
- uses: nanasess/setup-chromedriver@master
45+
46+
- name: Install rmarkdown, bookdown and sysfonts
47+
run: Rscript -e 'install.packages(c("sysfonts", "rmarkdown","bookdown"), Ncpus = 4)'
48+
49+
- name: Before build
50+
run: Rscript prep.R
51+
52+
- name: Render Book
53+
run: Rscript -e 'bookdown::render_book("index.Rmd")'
54+
55+
- uses: actions/upload-artifact@v2
56+
with:
57+
name: _site
58+
path: _site/

.github/workflows/deploy_bookdown.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
branches:
44
- master
55

6+
env:
7+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
8+
69
name: renderbook
710

811
jobs:
@@ -53,7 +56,7 @@ jobs:
5356
run: Rscript prep.R
5457

5558
- name: Render Book
56-
run: docker pull colinfay/hexmake && Rscript -e 'bookdown::render_book("index.Rmd")'
59+
run: Rscript -e 'bookdown::render_book("index.Rmd")'
5760

5861
- name: Build redirect
5962
run: Rscript redirect.R

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ _book/*
1515
!engineering-production-grade-shiny-apps.Rproj
1616
golex/
1717
todoedit
18+
_site/

.travis.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

01-big-shiny.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ This package can now be used to assess the dependencies we use in our applicatio
445445
To do that, let's create a small function that computes this metric and returns a tibble:
446446

447447
```{r 01-big-shiny-25 }
448-
library()
448+
library(packageMetrics2)
449449
# A function to turn the output of the metrics into a data.frame
450450
frame_metric <- function(pkg){
451451
metrics <- package_metrics(pkg)

06-ux-matters.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ First of all, users rarely carefully read all the instructions: they **scan** an
5050
Navigating the web, users try to optimize their decision, not by making the decision that would be "optimal", but by doing the first action that is sufficiently satisfactory in relevance.
5151
They behave like that for a lot of reasons, but notably because they want to be as quick as possible on the web, and because the cost of being wrong is very low most of the time - even if you make the wrong decision on a website, chances are that you are just a "return" or "cancel" button away from canceling your last action.
5252

53-
(ref:scanningcap) How we design a web page versus how a user will really scan it.
54-
From [@stevekrug2014].
53+
(ref:scanningcap) How we design a web page versus how a user will really scan it. From [@stevekrug2014].
54+
5555

5656
```{r 06-ux-matters-1, echo=FALSE, fig.cap="(ref:scanningcap)", out.width="100%"}
5757
knitr::include_graphics("img/scanning.png")

14-when_optimize.Rmd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,11 @@ Here is what it can look like inside a `Dockerfile` (Note that you will need to
597597

598598
FROM rocker/shiny-verse:3.6.3
599599

600-
RUN apt-get -y install curl RUN curl -sL \
600+
RUN apt-get -y install curl
601+
RUN curl -sL \
601602
<https://deb.nodesource.com/setup_14.x> \
602-
| bash - RUN apt-get install -y nodejs
603+
| bash -
604+
RUN apt-get install -y nodejs
603605

604606
RUN Rscript -e 'remotes::install_github("colinfay/minifyr")'
605607
RUN Rscript -e 'remotes::install_cran("cicerone")'

CONTRIBUTING.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,51 @@ There are two ways to contribute to the book:
2424
+ Add your name in the Acknowledgment section in the introduction.
2525

2626
+ If you want to contribute written content, you might want to open an issue first so that we can discuss the topic first.
27+
28+
## Building
29+
30+
### Build the book locally with existing cache
31+
32+
This requires Docker, Node and multiple dependencies installed using {renv}.
33+
By default, this will use the cache to restore outputs.
34+
35+
*hexmake*
36+
```sh
37+
docker pull colinfay/hexmake
38+
```
39+
40+
*minifyr*
41+
```sh
42+
sudo apt-get -y install curl
43+
sudo apt-get install -y nodejs
44+
45+
Rscript -e 'remotes::install_github("colinfay/minifyr")'
46+
Rscript -e 'remotes::install_cran("cicerone")'
47+
# Verify it works
48+
Rscript -e 'library(minifyr);
49+
minifyr_npm_install(TRUE);
50+
minify_package_js("cicerone", minifyr_js_uglify)'
51+
```
52+
53+
Then you can build it in a Terminal
54+
```sh
55+
Rscript prep.R
56+
Rscript -e 'bookdown::render_book("index.Rmd")'
57+
Rscript -e 'browseURL("_site/index.html")'
58+
```
59+
60+
### Update the list of dependencies in DESCRIPTION
61+
62+
```sh
63+
Rscript -e 'source("before-build.R")'
64+
```
65+
66+
### Update versions of packages in {renv}
67+
68+
```sh
69+
Rscript -e 'renv::snapshot()'
70+
```
71+
72+
### Recreate datasets
73+
74+
Run the content of 'render_all.R'

DESCRIPTION

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Authors@R:
2828
Description: Open source book on R for reproducible, robust and
2929
maintainable Shiny applications for production.
3030
License: MIT + file LICENSE
31-
URL: https://github.com/ThinkR-open/building-shiny-apps-workflow
31+
URL: https://github.com/ThinkR-open/engineering-shiny-book
3232
BugReports:
33-
https://github.com/ThinkR-open/building-shiny-apps-workflow/issues
33+
https://github.com/ThinkR-open/engineering-shiny-book/issues
3434
Depends:
3535
bookdown (>= 0.18)
3636
Imports:
@@ -39,6 +39,7 @@ Imports:
3939
bank (>= 0.0.0.9000),
4040
bench (>= 1.1.1),
4141
bs4Dash (>= 0.5.0),
42+
bslib (>= 0.2.5.1),
4243
bubble (>= 0.0.0.9003),
4344
chromote (>= 0.0.0.9001),
4445
cli (>= 2.0.2),
@@ -58,6 +59,7 @@ Imports:
5859
dichromat (>= 2.0.0),
5960
dockerfiler (>= 0.1.3),
6061
dockerstats (>= 0.0.0.9000),
62+
downlit (>= 0.2.1),
6163
dplyr (>= 1.0.2),
6264
DT (>= 0.15),
6365
fakir (>= 0.2.0),

_bookdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
book_filename: engineering-production-grade-shiny-apps
22
clean: [packages.bib, bookdown.bbl]
33
delete_merged_file: yes
4+
repo: https://github.com/ThinkR-open/engineering-shiny-book
45
language:
56
label:
67
fig: "FIGURE "

0 commit comments

Comments
 (0)