
## Run from the repo root: ~/gitReps/my_github/partsm/

## 1. Compile vignette manually (Sweave + pdflatex, PDF written next to .Rnw)
##    No pre-built PDF committed -- CRAN rebuilds from .Rnw source directly
tools::buildVignette("vignettes/partsm.Rnw", dir = "vignettes/")
tools::compactPDF("vignettes/partsm.pdf", gs_quality = "ebook")

## 2. Build the source tarball (compacts vignettes during build)
devtools::build(args = "--compact-vignettes=both")

## 3. Check the SOURCE package (source dir)
devtools::check()

## 4. Check the BUILT tarball (use check_built, not check)
file_check <- list.files("..", pattern = "partsm_.+\\.tar\\.gz")
devtools::check_built(path = file.path("..", file_check))


## Online Checks
# devtools::check_rhub(interactive = FALSE)
devtools::check_win_devel(args = "--compact-vignettes=both")
devtools::check_win_release(args = "--compact-vignettes=both")
devtools::check_win_oldrelease(args = "--compact-vignettes=both")

## 
# spelling::spell_check_setup(lang = "en-UK")
devtools::spell_check(use_wordlist = TRUE)

#
# usethis::use_cran_comments(open = FALSE)



## reverse dependency? not working well as of Nov 2020
# usethis::use_revdep()
# revdepcheck::revdep_check(num_workers = 4)

## Release
# devtools::release_checks()
devtools::submit_cran(args = "--compact-vignettes=both")
