{"id":14066127,"url":"https://github.com/MarkMc1089/devpacker","last_synced_at":"2025-07-29T22:30:56.354Z","repository":{"id":42028130,"uuid":"448773010","full_name":"MarkMc1089/devpacker","owner":"MarkMc1089","description":"Initialise A Blank R Package With Good Practice Configuration","archived":false,"fork":false,"pushed_at":"2022-04-17T12:01:42.000Z","size":98,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-13T07:11:06.698Z","etag":null,"topics":["continuous-integration","github-actions","package-creation","r"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarkMc1089.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-17T06:05:28.000Z","updated_at":"2024-06-30T20:26:43.000Z","dependencies_parsed_at":"2022-08-12T02:50:19.622Z","dependency_job_id":null,"html_url":"https://github.com/MarkMc1089/devpacker","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMc1089%2Fdevpacker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMc1089%2Fdevpacker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMc1089%2Fdevpacker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarkMc1089%2Fdevpacker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarkMc1089","download_url":"https://codeload.github.com/MarkMc1089/devpacker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228052702,"owners_count":17862106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["continuous-integration","github-actions","package-creation","r"],"created_at":"2024-08-13T07:04:57.093Z","updated_at":"2024-12-04T05:31:24.515Z","avatar_url":"https://github.com/MarkMc1089.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"\n# devpacker\n\n_Initialise A Blank R Package Or {shiny} App With Good Practice Configuration_\n\n`devpacker` aims to provide a solid foundation for building an R package or `{shiny}` app, ready to go with test directories, continuous integration and various other development best practices configured.\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![R-CMD-check](https://github.com/MarkMc1089/devpacker/workflows/R-CMD-check/badge.svg)](https://github.com/MarkMc1089/devpacker/actions)\n[![Codecov test coverage](https://codecov.io/gh/MarkMc1089/devpacker/branch/master/graph/badge.svg)](https://codecov.io/gh/MarkMc1089/devpacker?branch=master)\n\u003c!-- badges: end --\u003e\n\n## Installation\n\nYou can install `devpacker` from this repository with:\n\n``` r\ndevtools::install.git_hub(\"MarkMc1089/devpacker\")\n```\n\n## Usage\n\nSimply run one of the below, ensuring you name the last folder on the path what you want the package to be called:\n\n``` r\ndevpacker::create_package(\"path/to/new/package\")\ndevpacker::create_shiny(\"path/to/new/app\")\n```\n\n\n### 'I Want it All!' Project Setup\n\nGiven a `path`, `create_package` will create an R package and `create_shiny` will create a `{shiny}` app as a package. The actions taken are:\n\n1. Call `usethis::create_package` or `golem::create_golem` with `path`, using default arguments.\n2. Use `{gert}` to initialise a git repo.\n3. Add the MIT license.\n4. Create a sample R file `functions.R`, which includes a `{roxygen2}` documentation block.\n5. Add `{testthat}` folders and files.\n6. Add a `{lintr}` configuration.\n7. Set up `{precommit}`, to run automated checks before commits can succeed.\n8. Create a remote repo on GitHub and pushes the package.\n9. Add a README.\n10. Set up code coverage with `{covr}`, to use the codecov service.\n11. Add GitHub Actions for running R CMD CHECK and code coverage report on commits. Badges for these are added to the README.\n12. A final push to GitHub is made.\n\n### Custom Project Setup\n\n```\ncreate_package(            # Or create_shiny\n  path,                    # A path, whose final folder will be the package name\n  use_git = TRUE,          # initialise and commit everything to a local git repository\n  use_github = use_git,    # create and push to a new repository on Github, along with a starting README\n  use_ci = use_github,     # set up a CI action with GitHub Actions to run R CMD CHECK on each push\n  use_precommit = use_ci,  # set up precommit to automatically perform checks before each commit\n  use_coverage = use_ci,   # set up code coverage; if using GitHub, adds a CI action using Codecov service\n  use_lintr = TRUE,        # set up lintr\n  use_tests = TRUE,        # set up testthat\n  fields = list(),         # {usethis} option for setting DESCRIPTION fields - for better option see below\n  roxygen = TRUE,          # {usethis} option to use roxygen (for automating a lot of documentation tasks)\n  check_name = TRUE,       # {usethis} option to check valid name for CRAN\n  open = FALSE             # set to TRUE if you want to immediately open your new project\n  project_hook = {hook}    # For create_shiny only; allows to pass a custom project_hook \"hook\" to {golem}\n)\n```\n\n#### Using a custom `project_hook` with `create_shiny`\n\nSee `vignette(\"f_extending_golem\", package = \"golem\")` for details of customising what `{golem}` creates.\n\n## Setting Default DESCRIPTION Fields\n\nFrom the documentation for `usethis::use_description`:\n\nIf you create a lot of packages, consider storing personalized defaults as a named list in an option named `usethis.description`. Here's an example of code to include in `.Rprofile`, which can be opened via `usethis::edit_r_profile()`:\n\n```\noptions(\n  usethis.description = list(\n    `Authors@R` = 'person(\"Jane\", \"Doe\", email = \"jane@example.com\",\n                          role = c(\"aut\", \"cre\"),\n                          comment = c(ORCID = \"YOUR-ORCID-ID\"))',\n    License = \"MIT + file LICENSE\",\n    Language =  \"es\"\n  )\n)\n```\n\n## Development Lifecycle\n\n1. Choose a name for the package. Can use `available::available(\"potentialpackagename\")` to find existing packages and any potential unwanted associations. MUST use A-z0-9. Best practice is to use all [lowercase letters](https://r-pkgs.org/workflows101.html#naming).\n2. Run `devpacker::createpackage(\"path/to/awesomepackagename\")`.\n3. Write your code in the `R` folder - `usethis::use_r(code)` -\u003e creates and opens `code.R` for editing.\n4. Add tests - with `code.R` focused in RStudio, run `usethis::use_test()` -\u003e creates and opens `test-code.R` for editing.\n5. When using a package for the first time - `usethis::use_package(\"packagename\")` to add it to imports in `DESCRIPTION`.\n6. Use functions from packages by pre-pending them with `packagename::`, or, especially if you use a lot of functions from a package, add `@import packagename` into the roxygen documentation block of a function to avoid need for the `::` syntax.\n7. Regularly commit to git, at least locally. This is just good practice anyway, but with `precommit` running automated tests and styling your code consistently regular committing helps to prevent the complexity of having to resolve many bugs all in one go!\n\n## TODO\n\n- [x] Add some tests.\n- [x] Add configuration options.\n- [x] Automate the updating of roxygen dependencies for `{precommit}`. DONE IN FORK OF [lorenzwalthert/precommit](https://github.com/lorenzwalthert/precommit)\n- [ ] Use the templating functions of `{usethis}` to handle various config files used.\n- [X] Extend the package by adding a similar function for `{shiny}`, making use of best practices like modules and tools like `{golem}`.\n- [ ] Increase test coverage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMarkMc1089%2Fdevpacker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMarkMc1089%2Fdevpacker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMarkMc1089%2Fdevpacker/lists"}