Redesign the way we build a golem "here"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start from golem::create_golem(".") and inspect how it handles an existing app.R, R, tests, www, and DESCRIPTION. Compare the current behavior with each requested rule, including copying www to inst/app/www, preserving DESCRIPTION, adding the UI/server guidance, and build-ignoring app.R. Document the resulting behavior clearly, potentially in a vignette.
Written by the indexing model from the issue text.
Description
So, I think we need to change a little bit the way {golem} behaves when the user chooses to build a golem in his current directory.
Following the last changes in {shiny}, notably these two PR from @trestletech:
- https://github.com/rstudio/shiny/pull/2547, allowing to load all "helpers" from the R folder
- https://github.com/rstudio/shiny/pull/2682, creating a testing framework
There's a good chance that users will end with an app structure that looks like:
app.R
L R /
L this.R
L that.R
L tests/
...
L www (maybe)
This is very close to what we've got in {golem}, and I think that this should be facilitated by golem::create_golem(".").
The current implementation of this function throws a warning:
> golem::create_golem(".")
── Checking package name ───────────────────────────────────────────────────────
✔ Valid package name
The path . already exists, override?
1: Yeah
2: No way
3: Not yet
When it fact even if we say YES, the path is not really overriden: the files are copied, but the one that already existed are not deleted.
colin:plop colin$ cd /tmp && mkdir plouf && cd plouf
colin:plouf colin$ mkdir R tests www
colin:plouf colin$ touch app.R R/this.R R/that.R www/ping.css
colin:plouf colin$ ls
R app.R tests www
colin:plouf colin$ R --quiet
> golem::create_golem(".")
── Checking package name ───────────────────────────────────────────────────────
✔ Valid package name
The path . already exists, override?
1: No way
2: Yes
3: Nope
Selection: 2
── Creating dir ────────────────────────────────────────────────────────────────
✔ Created package directory
── Copying package skeleton ────────────────────────────────────────────────────
✔ Copied app skeleton
── Setting the default config ──────────────────────────────────────────────────
✔ Configured app
── Done ────────────────────────────────────────────────────────────────────────
A new golem named plouf was created at /private/tmp/plouf .
To continue working on your app, start editing the 01_start.R file.
> q()
Save workspace image? [y/n/c]: n
colin:plouf colin$ ls
DESCRIPTION R dev man www
NAMESPACE app.R inst tests
colin:plouf colin$ ls R
app_config.R app_server.R app_ui.R run_app.R that.R this.R
So, my take on that kind of app is:
- We should not ask to "override" as it is not really what is done
- We should copy
wwwtoinst/app/wwwif it exists - We should read the
DESCRIPTIONfile if ever it exists (and don't override it: it seems like a common thing inside the shiny example repo: https://github.com/rstudio/shiny-examples/tree/master/001-hello) - Leave a message about splitting the UI / Server into the related functions
usethis::use_buildignore("app.R")if it exists.
Also, this should be documented clearly (a vignette ?)
- Dominant language
- R
- Stars
- 945
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ThinkR-open/golem
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
ThinkR-open/golem#1253 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ThinkR-open/golem#1188 · 2 comments ·
-
ThinkR-open/golem#1185 · 6 comments · 1 assignee ·
-
enhancement
ThinkR-open/golem#1184 · 1 comment · 1 assignee ·
-
bug
ThinkR-open/golem#1167 · 6 comments · 1 assignee ·
All issues in ThinkR-open/golem
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
beginners blocker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enviPathR OpenBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Bioconductor/BiocContributions#207 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
datacarpentry/semester-biology#1255 ·