[mirror] Opinionated R package quickstart
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Swapped to template files

VisruthSK 790c361e aecd84e7

+49 -42
+5 -42
R/bootstrapper.R
··· 190 190 ) 191 191 192 192 usethis::use_air() 193 - c( 194 - "{", 195 - ' "recommendations": [', 196 - ' "Posit.air-vscode",', 197 - ' "etiennebacher.jarl-vscode"', 198 - " ]", 199 - "}" 200 - ) |> 201 - write_to_path(fs::path(".vscode", "extensions.json")) 202 - c( 203 - "[lint]", 204 - "extend-select = [\"TESTTHAT\"]" 205 - ) |> 206 - write_to_path(fs::path("tests", "jarl.toml")) # TODO: need to make GHA jarl runs respect this 193 + copy_template_file("extensions.json", fs::path(".vscode", "extensions.json")) 194 + copy_template_file("jarl.toml", fs::path("tests", "jarl.toml")) # TODO: need to make GHA jarl runs respect this 207 195 } 208 196 209 197 #' Configure Dependabot Defaults ··· 214 202 #' @keywords internal 215 203 #' @noRd 216 204 setup_dependabot <- function() { 217 - c( 218 - "version: 2", 219 - "updates:", 220 - " - package-ecosystem: \"github-actions\"", 221 - " directory: \"/\"", 222 - " schedule:", 223 - " interval: \"weekly\"" 224 - ) |> # TODO: move file to inst? 225 - write_to_path(fs::path(".github", "dependabot.yml")) 205 + copy_template_file("dependabot.yml", fs::path(".github", "dependabot.yml")) 226 206 } 227 207 228 208 #' Configure AGENTS Defaults 229 209 #' 230 - #' Placeholder for AGENTS file setup. 210 + #' Copies an opinionated, concise AGENTS.md for R package development. 231 211 #' 232 212 #' @return Invisibly returns `NULL`. 233 213 #' @keywords internal 234 214 #' @noRd 235 215 setup_agents <- function() { 236 - # See https://simonwillison.net/guides/agentic-engineering-patterns/ 237 - c( 238 - "# General", 239 - "Read DESCRIPTION, README", 240 - "Red/green TDD via usethis::use_test()", 241 - "", 242 - "# Personality", 243 - "Literal, direct, concise, high-signal, non-empathic. No hedging, both-sidesing, closing summaries, or offers. Only ask questions if functionally blocked.", 244 - "", 245 - "# R Dev Rules", 246 - "No manual edits to .Rd or NAMESPACE.", 247 - "Use devtools::document(), test(), check().", 248 - "Prefer Base R, existing dep closure. Request permission for new deps which make code better.", 249 - "Add deps via usethis::use_import_from(), use_package()", 250 - "air format ., jarl check . --fix --allow-dirty, all tests, and R CMD check pass before you claim to be done." 251 - ) |> 252 - write_to_path(fs::path("AGENTS.md")) 216 + copy_template_file("AGENTS.md", "AGENTS.md") 253 217 } 254 - 255 218 256 219 #' Choose and Apply a License 257 220 #'
+17
R/utils.R
··· 13 13 writeLines(text, filepath) 14 14 } 15 15 16 + #' Copy a Template File 17 + #' 18 + #' Copies a file from `inst/templates` into the target location. 19 + #' 20 + #' @param template_file Template file name inside `inst/templates`. 21 + #' @param destination Destination file path. 22 + #' 23 + #' @return Invisibly returns `NULL`. 24 + #' @keywords internal 25 + #' @noRd 26 + copy_template_file <- function(template_file, destination) { 27 + fs::dir_create(fs::path_dir(destination)) 28 + fs::path_package("bootstrapper", "templates", template_file) |> 29 + fs::file_copy(destination, overwrite = TRUE) 30 + invisible(NULL) 31 + } 32 + 16 33 #' Find and Replace in a File 17 34 #' 18 35 #' Replaces matching text in a single file.
+13
inst/templates/AGENTS.md
··· 1 + # General 2 + Read DESCRIPTION, README 3 + Red/green TDD via usethis::use_test() 4 + 5 + # Personality 6 + Literal, direct, concise, high-signal, non-empathic. No hedging, both-sidesing, closing summaries, or offers. Only ask questions if functionally blocked. 7 + 8 + # R Dev Rules 9 + No manual edits to .Rd or NAMESPACE. 10 + Use devtools::document(), test(), check(). 11 + Prefer Base R, existing dep closure. Request permission for new deps which make code better. 12 + Add deps via usethis::use_import_from(), use_package() 13 + air format ., jarl check . --fix --allow-dirty, all tests, and R CMD check pass before you claim to be done.
+6
inst/templates/dependabot.yml
··· 1 + version: 2 2 + updates: 3 + - package-ecosystem: "github-actions" 4 + directory: "/" 5 + schedule: 6 + interval: "weekly"
+6
inst/templates/extensions.json
··· 1 + { 2 + "recommendations": [ 3 + "Posit.air-vscode", 4 + "etiennebacher.jarl-vscode" 5 + ] 6 + }
+2
inst/templates/jarl.toml
··· 1 + [lint] 2 + extend-select = ["TESTTHAT"]