You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Declare all dependencies in DESCRIPTION during package development
54
49
55
50
What you really want is to fill and update your description file along with the modifications of your documentation. Indeed, only the following function will really be called. Use and abuse during the development of your package !
56
51
57
52
```{r, eval=FALSE}
58
53
attachment::att_amend_desc()
59
54
```
60
55
61
-
As {pkgdown} and {covr} are not listed in any script in your package, a common call for your development packages would be:
56
+
{attachment} detects all calls to `library(pkg)`, `@importFrom pkg fun`, `pkg::fun()` in the different classical directories of your R package, then list them in the correct "Imports" or "Suggests" category in the DESCRIPTION file, according to their position in the package.
57
+
58
+
### Declare extra dependencies for extra uses
59
+
60
+
If you want to add extra packages like {pkgdown} or {covr} that are not listed in any script in your package, a call for your development packages would be:
If you would like to add dependencies in the "Remotes" field of your DESCRIPTION file, to mimic your local installation, you will want to use:
65
+
Note the `update.config = TRUE` parameter that will save the parameters used in the call of `att_amend_desc()` to the package configuration file: "dev/config_attachment.yaml".
66
+
67
+
If you run `att_amend_desc()` a second time afterwards, directly from the console, it will use the last set of parameters extracted from the configuration file.
68
+
69
+
Indeed, we recommend to store the complete command line in a "dev/dev_history.R" file to update and run it when needed. If the parameters do not change, you can run `attachment::att_amend_desc()` directly in the console, wherever you are, it will use the configuration file.
70
+
71
+
### Automatically fill the "Remotes" field
72
+
73
+
If you would like to detect the sources of your installations so that you can add dependencies in the "Remotes" field of your DESCRIPTION file, to mimic your local installation, you will use:
Function `attachment::create_dependencies_file()` will create a `dependencies.R` file in `inst/` directory. This R script contains the procedure to quickly install missing dependencies:
##Allow the CI to install all dependencies required for your bookdown, pagedown, quarto, ...
143
151
144
152
If you write a {bookdown} and want to publish it on Github using GitHub Actions or GitLab CI for instance, you will need a DESCRIPTION file with list of dependencies just like for a package. In this case, you can use the function to description from import/suggest: `att_to_desc_from_is()`.
145
153
@@ -157,26 +165,28 @@ remotes::install_deps()
157
165
```
158
166
159
167
160
-
### To list information
168
+
##List packages required in any script or notebook
161
169
162
170
Of course, you can also use {attachment} out of a package to list all package dependencies of R scripts using `att_from_rscripts()` or Rmd/qmd files using `att_from_rmds()`.
163
171
If you are running this inside a Rmd, you may need parameter `inside_rmd = TRUE`.
Package {attachment} has vignettes to present the different functions available. There is also a recommendation to have a `dev_history.R` in the root directory of your package. (*Have a look at [dev_history.R](https://github.com/ThinkR-open/attachment/blob/main/dev/dev_history.R) in the present package*)
0 commit comments