You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: shiny-apps.Rmd
+75-11Lines changed: 75 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Shiny apps {#shiny}
2
2
3
-
[Shiny apps][shiny-rstudio] can be submitted to _Bioconductor_ as software packages or as documented and tested functions within packages.
3
+
[Shiny apps][shiny-posit] can be submitted to _Bioconductor_ as software packages or as documented and tested functions within packages.
4
4
5
5
## Code organisation
6
6
@@ -14,6 +14,9 @@ Shiny apps submitted to _Bioconductor_ must store the <i class="fab fa-r-project
14
14
The bulk of the package code should _not_ be implemented directly within the `shinyApp()` function call.
15
15
Instead, internal package functions should be developed to produce and return individual components of the UI and server sides of the Shiny app.
16
16
17
+
Shiny apps can also be written using [shiny modules][shiny-modules] to allow for
18
+
better code organisation and re-usability.
19
+
17
20
We recommend the following file naming scheme for source files:
18
21
19
22
- Place internal functions that create observers -- e.g., `shiny::observeEvent()` -- in files named `observers_*.R`.
@@ -48,11 +51,36 @@ shiny::runApp(app, ...)
48
51
49
52
## Building the package
50
53
51
-
_Coming soon: comments on build issues for packages that contain Shiny apps._
54
+
Packages with `shiny` apps should be built using the standard `R CMD build`
55
+
command. The package structure should follow a standard R package structure,
56
+
with the Shiny app code stored under the `R/` directory.:
57
+
58
+
```
59
+
MyShinyPackage/
60
+
|-- app.R
61
+
|-- DESCRIPTION
62
+
|-- NAMESPACE
63
+
|-- R/
64
+
| |-- interface_*.R
65
+
| |-- observers_*.R
66
+
| |-- outputs_*.R
67
+
| |- server_*.R
68
+
| └- utils.R
69
+
|-- tests/
70
+
|-- vignettes/
71
+
|-- man/
72
+
|-- inst/
73
+
[...]
74
+
```
75
+
76
+
An optional `app.R` file can be added to the base directory of the package to
77
+
launch the Shiny app using the `shiny::runApp()` or a main shiny app deployment
78
+
function.
52
79
53
80
## Testing
54
81
55
-
All functions in the package should be testable using standard unit testing tools (e.g., `r BiocStyle::CRANpkg("testthat")`).
82
+
All plain non-reactive functions in the package should be testable using
83
+
standard unit testing tools (e.g., `r BiocStyle::CRANpkg("testthat")`).
56
84
57
85
The use of `# nocov start` and `# nocov end` is allowed to ignore part of the code that cannot be tested using traditional unit tests (e.g., `observeEvent`).
0 commit comments