我正在设计一辆AT/Bluesky比R package的车,我正在try 一种非传统的 struct .由于通过JSON lexicon defined here非常详细地记录了Bluesky方法,因此我将这些文件复制到/inst目录中,因此我的包 struct 如下所示:
├── DESCRIPTION
├── LICENSE
├── LICENSE.md
├── NAMESPACE
├── R
│ ├── bluesky.R
│ ├── helpers.R
│ ├── lexicon.R
│ └── types.R
├── README.Rmd
├── README.md
├── blueRsky.Rproj
├── inst
│ └── lexicons
│ ├── app
│ │ └── bsky
│ │ ├── actor
│ │ │ ├── defs.json
│ │ │ ├── getProfile.json
│ │ │ ├── getProfiles.json
│ │ │ ├── getSuggestions.json
│ │ │ ├── profile.json
│ │ │ ├── searchActors.json
│ │ │ └── searchActorsTypeahead.json
│ │ ├── embed
│ │ │ ├── external.json
│ │ │ ├── images.json
│ │ │ ├── record.json
│ │ │ └── recordWithMedia.json
│ │ ├── feed
│ │ │ ├── defs.json
│ │ │ ├── getAuthorFeed.json
│ │ │ ├── getLikes.json
│ │ │ ├── getPostThread.json
│ │ │ ├── getPosts.json
│ │ │ ├── getRepostedBy.json
│ │ │ ├── getTimeline.json
│ │ │ ├── like.json
│ │ │ ├── post.json
│ │ │ └── repost.json
│ │ ├── graph
│ │ │ ├── follow.json
│ │ │ ├── getFollowers.json
│ │ │ ├── getFollows.json
│ │ │ ├── getMutes.json
│ │ │ ├── muteActor.json
│ │ │ └── unmuteActor.json
│ │ ├── notification
│ │ │ ├── getUnreadCount.json
│ │ │ ├── listNotifications.json
│ │ │ └── updateSeen.json
│ │ ├── richtext
│ │ │ └── facet.json
│ │ └── unspecced
│ │ └── getPopular.json
│ └── com
├── man
│ ├── bsky_get_profile.Rd
│ ├── bsky_get_session.Rd
│ ├── bsky_get_timeline.Rd
│ └── bsky_search_actors.Rd
└── tests
├── testthat
│ └── test-lexicon.R
└── testthat.R
我有一些函数可以随后查找词典模式,例如
load_schema <- function(id) {
loc <- c("lexicons", strsplit(id, "\\.")[[1]]) |>
paste0(collapse = "/") |>
paste0(".json")
file_path <- system.file(loc, package = "blueRsky", mustWork = FALSE)
cat("file_path:", file_path, "\n")
if (!file.exists(file_path)) {
stop(paste("Schema", id, "not found"))
}
jsonlite::read_json(system.file(loc, package = "blueRsky", mustWork = TRUE))
}
这非常好,因为它允许我抽象许多用于构造请求的样板.
这在本地运行得很好,我可以安装这个包,并且我的所有测试都通过了,但它没有通过R CMD判断.我认为原因是R CMD Check正在从词典目录中删除一些文件.输出为:
── R CMD build ──────────────────────────────────────────────────────────────────
✔ checking for file ‘/Users/colinfraser/projects/blueRsky/DESCRIPTION’ ...
─ preparing ‘blueRsky’: (1.1s)
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts (346ms)
─ checking for empty or unneeded directories
Removed empty directory ‘blueRsky/inst/lexicons/com’
─ building ‘blueRsky_0.0.0.9000.tar.gz’
Removed empty directory ‘blueRsky/inst/lexicons/com’.
这并不好,因为实际上该目录并不是空的,它只是在其中嵌套了文件夹.后来,它失败了,因为它不能加载包代码.
我能做些什么来阻止R CMD Check删除此文件吗?或者这里有没有其他地方出了问题?我知道这是一个有点不寻常的包 struct ,但如果我能让它工作,它似乎真的会工作得很好.