usethis 2.1.0
Git default branch support
usethis has a more sophisticated understanding of the default branch and gains several functions to support default branch renaming.
git_branch_default()
has been renamed togit_default_branch()
, to place
it logically in the new family of functions. The old name still works, but
that won't be true forever.git_default_branch()
is much more diligent about figuring out the default
branch. Instead of only consulting the local repo, now we integrate local info
with the default branch reported by theupstream
ororigin
remote, if
applicable.- This is intended to surface the case where a project has renamed its default
branch and the local repo needs sync up with that.
- This is intended to surface the case where a project has renamed its default
git_default_branch_rediscover()
is a new function that helps contributors
update their local repo (and personal fork, if applicable) when a project/repo
renames its default branch.git_default_branch_rename()
is a new function that helps a repo owner
rename the default branch (both on GitHub and locally).git_default_branch_configure()
is a new function to set the new Git
configuration optioninit.defaultBranch
, which controls the name of the
initial branch of new local repos.git_sitrep()
exposesinit.defaultBranch
and surfaces the more
sophisticated analysis ofgit_default_branch()
.
Other GitHub-related changes
-
git_sitrep()
andgh_token_help()
try even harder to help people get on the
happy path with respect to their GitHub PAT (#1400, #1413, #1488, #1489,
#1497). -
The minimum version of gh has been bumped to help / force more people to
upgrade to the gh version that supports current GitHub PAT formats
(@ijlyttle, #1454). -
use_github_file()
is a new function related touse_template()
. Instead of
starting from a local file,use_github_file()
grabs the contents of an
arbitrary file on GitHub that the user has permission to read. It supports
targeting a specific branch, tag, or commit and can follow a symlink (#1407).
use_github_file()
now powersuse_github_action()
and friends. -
use_github_release()
is much more diligent about using any information left
behind bydevtools::submit_cran()
ordevtools::release()
. Specifically,
this applies to determining which SHA is to be tagged in the release. And this
SHA, in turn, determines the consulted versions of DESCRIPTION (for package
version) and NEWS.md (for release notes) (#1380). -
use_release_issue()
also takes bullets fromrelease_questions()
,
for compatibility withdevtools::release()
. -
git_vaccinate()
,edit_git_ignore()
, andgit_sitrep()
are more careful to
consult, reveal, and set thecore.excludesFile
setting in user's Git
configuration (#1461). -
use_github_action_check_full()
has been removed. It's overkill for the
majority of R packages, which are better off withuse_github_actions()
or
use_github_action_check_standard()
(#1490). -
use_github_pages()
anduse_pkgdown_github_pages()
use a new method for
creating an empty, orphangh-pages
branch. This is necessary due to new
GitHub behaviour, where it has become essentially impossible to refer to the
empty tree (#1472). -
use_github()
can create repositories with"internal"
visibility, a feature
that exists within GitHub Enterprise products (#1505).
Package development
-
use_readme_[r]?md()
no longer includes CRAN installation instructions in the
initial template; instead, we only include GitHub-based install instructions
or otherwise prompt the user to update instructions (#1507). -
use_import_from()
is a new function that puts@importFrom pkg fun
directives into a package in a consistent location (@malcolmbarrett, #1377). -
DESCRIPTION
files generated by usethis no longer includeLazyData
by
default, as per new CRAN checks; instead,LazyData
is now added the first
time you useuse_data()
(@malcolmbarrett, #1404). -
use_tidy_eval()
has been updated to reflect current recommendations for
using (and therefore exposing) tidy eval in other packages (@lionel-, #1445). -
use_pkgdown()
automatically uses Bootstrap 5 if the pkgdown version supports
it (anticipated for pkgdown 2.0.0). -
use_lifecycle()
now importslifecycle::deprecated()
(#1419). -
use_code_of_conduct()
now requires acontact
argument to supply contact
details for reporting CoC violations (#1269). -
use_package()
no longer guides the user on how to use a dependency when no
change was made (@malcolmbarrett, #1384).
Aimed at the tidyverse team
These functions are exported for anyone to use, but are aimed primarily at the maintainers of tidyverse, r-lib, and tidymodels packages.
-
use_tidy_dependencies()
is a new function that sets up standard dependencies
used by all tidyverse packages, except those that are designed to be
dependency free (#1423). -
use_tidy_upkeep_issue()
is a new function similar touse_release_issue()
that creates a checklist-style issue to prompt various updates (#1416). -
use_tidy_release_test_env()
has been deleted since we no longer recommend
including test environments incran-comments.md
. There's no evidence that
CRAN finds it useful, and it's annoying to keep up-to-date (#1365). -
use_tidy_github_labels()
is the new name foruse_tidy_labels()
(#1430). -
use_tidy_github_actions()
takes over foruse_tidy_ci()
, which is now
deprecated.
User-level configuration
-
"usethis.overwrite"
is a new option. When set toTRUE
, usethis overwrites
an existing file without asking for user confirmation if the file is inside
a Git repo. The normal Git workflow makes it easy to see and selectively
accept/discard any proposed changes. This behaviour is strictly opt-in
(#1424). -
Functions that provide code to load packages in your
.Rprofile
now use
rlang::check_installed()
to make sure the package is installed locally
(@malcolmbarrett, #1398). -
edit_rstudio_prefs()
andedit_rstudio_snippets()
should work now on
case-sensitive OSes, due to a path fix re: the location of RStudio's config
files (@charliejhadley, #1420).