Skip to content

Commit 7b819a3

Browse files
committed
Use usethis in scaffolding; add usethis as Suggests dep
1 parent e5157a9 commit 7b819a3

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Suggests:
3838
rmarkdown,
3939
shiny,
4040
V8,
41-
knitr
41+
knitr,
42+
usethis
4243
RoxygenNote: 6.1.1
4344
VignetteBuilder: knitr

R/scaffold.R

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ scaffoldReactWidget <- function(name, npmPkg = NULL, edit = interactive()){
3333
addWebpackConfig(name)
3434
addWidgetJS(name, edit)
3535
addExampleApp(name)
36-
updateRbuildignore()
36+
37+
usethis::use_build_ignore(c("node_modules", "srcjs"))
38+
usethis::use_git_ignore(c("node_modules", "srcjs"))
39+
lapply(c("htmltools", "htmlwidgets", "reactR"), usethis::use_package)
40+
3741
message("To install dependencies from npm run: yarn install")
3842
message("To build JavaScript run: yarn run webpack --mode=development")
3943
}
@@ -150,18 +154,6 @@ addExampleApp <- function(name) {
150154
}
151155
}
152156

153-
updateRbuildignore <- function() {
154-
ignore_file <- '.Rbuildignore'
155-
if (file.exists(ignore_file)
156-
&& !("^node_modules$" %in% readLines(ignore_file))) {
157-
message('Adding node_modules to existing .Rbuildignore')
158-
write("^node_modules$", ignore_file, append = TRUE)
159-
} else if (!file.exists(ignore_file)) {
160-
message('Creating .Rbuildignore and adding node_modules')
161-
write("^node_modules$", ignore_file)
162-
}
163-
}
164-
165157
# invoke file.edit in a way that will bind to the RStudio editor
166158
# when running inside RStudio
167159
fileEdit <- function(file) {

0 commit comments

Comments
 (0)