@@ -158,8 +158,7 @@ if (!is.null(managements_treatments)) usethis::use_data(managements_treatments,
158158if (! is.null(cultivars_pfts )) usethis :: use_data(cultivars_pfts , overwrite = TRUE , compress = " xz" )
159159
160160# --- Generate datapackage.json ---
161- log_info(" Generating inst/metadata/datapackage.json..." )
162- dir.create(" inst/metadata" , showWarnings = FALSE , recursive = TRUE )
161+ log_info(" Generating datapackage.json at repo root (Frictionless spec)..." )
163162
164163# Helper to infer Frictionless type from R class
165164r_to_frictionless_type <- function (x ) {
@@ -185,10 +184,11 @@ datasets <- c("traitsview", "species", "sites", "variables", "citations",
185184 " managements" , " entities" , " pfts_species" , " pfts_priors" ,
186185 " managements_treatments" , " cultivars_pfts" )
187186
188- # NOTE: paths are relative to the repo root, not installed package.
189- # data-raw/ is excluded from the built package via .Rbuildignore.
190- # These paths are for provenance, they point to the source CSVs
191- # in the repository, not files shipped with installed package.
187+ # datapackage.json lives at the repo root (Frictionless spec requires the
188+ # descriptor at the root of the data package). Paths are relative to the repo
189+ # root. data-raw/ is excluded from the built R package via .Rbuildignore, as
190+ # is datapackage.json itself; this descriptor is for the repository / data
191+ # release, not for the installed R package.
192192resources <- lapply(datasets , function (nm ) {
193193 df <- get(nm )
194194 base <- list (
@@ -224,6 +224,6 @@ datapackage <- list(
224224 resources = resources
225225)
226226
227- jsonlite :: write_json(datapackage , " inst/metadata/ datapackage.json" ,
227+ jsonlite :: write_json(datapackage , " datapackage.json" ,
228228 auto_unbox = TRUE , pretty = TRUE )
229- log_info(" datapackage.json written" )
229+ log_info(" datapackage.json written to repo root " )
0 commit comments