11## Setting up the development environment
22
33``` r
4- install.packages(c(' devtools' , ' pkgdown' , ' styler' , ' lintr' )) # install dev dependencies
5- devtools :: install_deps(dependencies = TRUE ) # install package dependencies
6- devtools :: document() # generate package meta data and man files
7- devtools :: build() # build package
4+ install.packages(c(' devtools' , ' pkgdown' , ' styler' , ' lintr' , ' pak' )) # install dev dependencies
5+ pak :: pkg_install(" ." ) # install package and dependencies
86```
97
108## Validating the package
@@ -13,8 +11,12 @@ devtools::build() # build package
1311styler :: style_pkg() # format code
1412lintr :: lint_package() # lint code
1513
14+ devtools :: check() # run R CMD check, which runs everything below
15+ devtools :: document() # generate package meta data and man files
1616devtools :: test() # test package
17- devtools :: check() # check package for errors
17+ devtools :: build_vignettes() # build vignettes only
18+ devtools :: run_examples() # run doc examples
19+ devtools :: check(vignettes = FALSE ) # check package without vignettes
1820```
1921
2022## Developing the documentation site
@@ -24,20 +26,16 @@ Our CI builds two version of the documentation:
2426- https://cmu-delphi.github.io/epiprocess/ from the ` main ` branch and
2527- https://cmu-delphi.github.io/epiprocess/dev from the ` dev ` branch.
2628
27- The documentation site can be previewed locally by running in R:
28-
29- ``` r
30- # Should automatically open a browser
31- pkgdown :: build_site(preview = TRUE )
32- ```
33-
34- If the above does not open a browser, you can try using a Python server from the
35- command line:
29+ We include the script ` pkgdown-watch.R ` that will automatically rebuild the
30+ documentation locally and preview it. It can be used with:
3631
37- ``` bash
38- R -e ' devtools::document()'
39- R -e ' pkgdown::build_site()'
40- python -m http.server -d docs
32+ ``` sh
33+ # Make sure you have servr installed
34+ R -e ' renv::install("servr")'
35+ # Will start a local server
36+ Rscript pkgdown-watch.R
37+ # You may need to first build the site with
38+ R -e ' pkgdown::build_site(".", examples = FALSE, devel = TRUE, preview = FALSE)'
4139```
4240
4341## Versioning
0 commit comments