Skip to content

Commit b6a1dc8

Browse files
disable lockfile creation when no packages
+ throw a warning
1 parent 6f01409 commit b6a1dc8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ Imports:
4545
lifecycle (>= 0.2.0),
4646
logger (>= 0.2.0),
4747
methods,
48-
mirai (>= 1.1.1),
49-
renv (>= 1.0.7),
5048
rlang (>= 1.0.0),
5149
shinyjs,
5250
stats,
@@ -58,8 +56,10 @@ Imports:
5856
Suggests:
5957
bslib,
6058
knitr (>= 1.42),
59+
mirai (>= 1.1.1),
6160
MultiAssayExperiment,
6261
R6,
62+
renv (>= 1.0.7),
6363
rmarkdown (>= 2.23),
6464
rvest,
6565
shinytest2,

R/module_teal_lockfile.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ NULL
3434

3535
#' @rdname module_teal_lockfile
3636
ui_teal_lockfile <- function(id) {
37+
if (!requireNamespace("mirai", quietly = TRUE) || !requireNamespace("renv", quietly = TRUE)) {
38+
warning("lockfile feature disabled. `mirai` and `renv` packages must be installed.")
39+
return(NULL)
40+
}
41+
3742
ns <- NS(id)
3843
if (!isTRUE(getOption("teal.renv.enable"))) {
3944
return(NULL)
@@ -46,6 +51,9 @@ ui_teal_lockfile <- function(id) {
4651

4752
#' @rdname module_teal_lockfile
4853
srv_teal_lockfile <- function(id) {
54+
if (!requireNamespace(c("mirai", "renv"), quietly = TRUE)) {
55+
return(NULL)
56+
}
4957
moduleServer(id, function(input, output, session) {
5058
logger::log_debug("Initialize srv_teal_lockfile.")
5159
enable_lockfile_download <- function() {

0 commit comments

Comments
 (0)