commit
4a21b0f763
@ -1,3 +1,5 @@
|
|||||||
^LICENSE\.md$
|
^LICENSE\.md$
|
||||||
^README\.Rmd$
|
^README\.Rmd$
|
||||||
^Makefile$
|
^Makefile$
|
||||||
|
node_modules
|
||||||
|
^\.github$
|
||||||
|
|||||||
1
.github/.gitignore
vendored
Normal file
1
.github/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.html
|
||||||
29
.github/workflows/R-CMD-check.yaml
vendored
Normal file
29
.github/workflows/R-CMD-check.yaml
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
|
||||||
|
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
|
||||||
|
on: [push, pull_request]
|
||||||
|
name: R CMD check
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
R-CMD-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
R_KEEP_PKG_SOURCE: yes
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: r-lib/actions/setup-r@v2
|
||||||
|
with:
|
||||||
|
use-public-rspm: true
|
||||||
|
|
||||||
|
- uses: r-lib/actions/setup-r-dependencies@v2
|
||||||
|
with:
|
||||||
|
extra-packages: any::rcmdcheck
|
||||||
|
needs: check
|
||||||
|
|
||||||
|
- uses: r-lib/actions/check-r-package@v2
|
||||||
|
with:
|
||||||
|
upload-snapshots: true
|
||||||
|
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
|
||||||
42
.github/workflows/check-demo.yaml
vendored
Normal file
42
.github/workflows/check-demo.yaml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
|
||||||
|
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
|
||||||
|
on: [push, pull_request]
|
||||||
|
name: Check demo
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run-sampler:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
R_KEEP_PKG_SOURCE: yes
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: r-lib/actions/setup-r@v2
|
||||||
|
with:
|
||||||
|
use-public-rspm: true
|
||||||
|
|
||||||
|
- uses: r-lib/actions/setup-r-dependencies@v2
|
||||||
|
with:
|
||||||
|
extra-packages: any::rcmdcheck, local::.
|
||||||
|
needs: check
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 9.12
|
||||||
|
|
||||||
|
# the rest of this must run from tests/testthat/sampler
|
||||||
|
- run: pnpm install --frozen-lockfile
|
||||||
|
working-directory: tests/testthat/sampler
|
||||||
|
|
||||||
|
- run: pnpm build
|
||||||
|
working-directory: tests/testthat/sampler
|
||||||
|
|
||||||
|
- name: Start Rserve
|
||||||
|
run: pnpm rserve &
|
||||||
|
working-directory: tests/testthat/sampler
|
||||||
|
|
||||||
|
- run: pnpm start
|
||||||
|
working-directory: tests/testthat/sampler
|
||||||
@ -10,11 +10,9 @@ License: MIT + file LICENSE
|
|||||||
Encoding: UTF-8
|
Encoding: UTF-8
|
||||||
Roxygen: list(markdown = TRUE)
|
Roxygen: list(markdown = TRUE)
|
||||||
RoxygenNote: 7.3.1
|
RoxygenNote: 7.3.1
|
||||||
Suggests:
|
|
||||||
testthat (>= 3.0.0)
|
|
||||||
Config/testthat/edition: 3
|
Config/testthat/edition: 3
|
||||||
Imports:
|
Imports:
|
||||||
cli,
|
|
||||||
js,
|
|
||||||
rlang,
|
rlang,
|
||||||
Rserve
|
Rserve
|
||||||
|
Suggests:
|
||||||
|
testthat (>= 3.0.0)
|
||||||
|
|||||||
3
Makefile
3
Makefile
@ -8,6 +8,9 @@ document:
|
|||||||
install: document
|
install: document
|
||||||
R CMD INSTALL .
|
R CMD INSTALL .
|
||||||
|
|
||||||
|
check:
|
||||||
|
Rscript -e "devtools::check()"
|
||||||
|
|
||||||
README.md: README.Rmd install
|
README.md: README.Rmd install
|
||||||
Rscript -e "rmarkdown::render('README.Rmd')"
|
Rscript -e "rmarkdown::render('README.Rmd')"
|
||||||
@rm README.html
|
@rm README.html
|
||||||
|
|||||||
@ -50,10 +50,6 @@ ts_compile.character <- function(
|
|||||||
sprintf("export default {\n %s\n};", paste(ls(e), collapse = ",\n "))
|
sprintf("export default {\n %s\n};", paste(ls(e), collapse = ",\n "))
|
||||||
)
|
)
|
||||||
|
|
||||||
# if (file != "" && file.exists(file)) {
|
|
||||||
# stop(sprintf("File exists: %s", file))
|
|
||||||
# return()
|
|
||||||
# }
|
|
||||||
cat(src, file = file, sep = "\n")
|
cat(src, file = file, sep = "\n")
|
||||||
|
|
||||||
invisible()
|
invisible()
|
||||||
|
|||||||
@ -82,19 +82,18 @@ ts_function <- function(f, ..., result = ts_void()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#' @export
|
#' @export
|
||||||
print.ts_function <- function(x, ...) {
|
print.ts_function <- function(x, ...) {
|
||||||
cli::cli_h3("Ocap function")
|
h3("Ocap function")
|
||||||
|
|
||||||
cli::cli_text("Arguments:")
|
cat("Arguments:\n")
|
||||||
args <- lapply(x$args, \(z) z$input_type)
|
args <- lapply(x$args, \(z) z$input_type)
|
||||||
lapply(names(args), \(n) {
|
lapply(names(args), \(n) {
|
||||||
cat("- ", n, ": ", args[[n]], "\n", sep = "")
|
cat("- ", n, ": ", args[[n]], "\n", sep = "")
|
||||||
})
|
})
|
||||||
cli::cli_text("\n\n")
|
cat("\n\n")
|
||||||
|
|
||||||
cli::cli_text("Return type:")
|
cat("Return type:\n")
|
||||||
cat(x$result$return_type)
|
cat(x$result$return_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
R/helpers.R
Normal file
9
R/helpers.R
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
h3 <- function(x) {
|
||||||
|
cat("\n---", x, "\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: figure out how to format (modern) JS code from R?
|
||||||
|
format_js <- function(x) {
|
||||||
|
x
|
||||||
|
}
|
||||||
11
R/types.R
11
R/types.R
@ -27,21 +27,20 @@ ts_object <- function(input_type = "any",
|
|||||||
#' @export
|
#' @export
|
||||||
print.ts_object <- function(x, ...) {
|
print.ts_object <- function(x, ...) {
|
||||||
# name <- deparse(substitute(x))
|
# name <- deparse(substitute(x))
|
||||||
cli::cli_ul()
|
h3("Input type: ")
|
||||||
cli::cli_h3("Input type: ")
|
|
||||||
if (nchar(x$input_type) > 50) {
|
if (nchar(x$input_type) > 50) {
|
||||||
cat(js::uglify_reformat(x$input_type, beautify = TRUE), "\n")
|
cat(format_js(x$input_type), "\n")
|
||||||
} else {
|
} else {
|
||||||
cat(x$input_type, "\n")
|
cat(x$input_type, "\n")
|
||||||
}
|
}
|
||||||
cli::cli_h3("Return type: ")
|
h3("Return type: ")
|
||||||
if (nchar(x$return_type) > 50) {
|
if (nchar(x$return_type) > 50) {
|
||||||
print(x$return_type)
|
print(x$return_type)
|
||||||
cat(js::uglify_reformat(x$return_type, beautify = TRUE), "\n")
|
cat(format_js(x$return_type), "\n")
|
||||||
} else {
|
} else {
|
||||||
cat(x$return_type, "\n")
|
cat(x$return_type, "\n")
|
||||||
}
|
}
|
||||||
cli::cli_end()
|
cat("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
#' @describeIn ts_object Check if an object is a ts object
|
#' @describeIn ts_object Check if an object is a ts object
|
||||||
|
|||||||
@ -16,6 +16,8 @@ knitr::opts_chunk$set(
|
|||||||
# ts
|
# ts
|
||||||
|
|
||||||
<!-- badges: start -->
|
<!-- badges: start -->
|
||||||
|
[](https://github.com/tmelliott/ts/actions/workflows/R-CMD-check.yaml)
|
||||||
|
[](https://github.com/tmelliott/ts/actions/workflows/check-demo.yaml)
|
||||||
<!-- badges: end -->
|
<!-- badges: end -->
|
||||||
|
|
||||||
The **ts** package makes it easy for users to write functions that can be used in [**rserve-ts**](https://www.npmjs.com/package/rserve-ts) applications.
|
The **ts** package makes it easy for users to write functions that can be used in [**rserve-ts**](https://www.npmjs.com/package/rserve-ts) applications.
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
<!-- badges: start -->
|
<!-- badges: start -->
|
||||||
|
|
||||||
|
[](https://github.com/tmelliott/ts/actions/workflows/R-CMD-check.yaml)
|
||||||
|
[](https://github.com/tmelliott/ts/actions/workflows/check-demo.yaml)
|
||||||
<!-- badges: end -->
|
<!-- badges: end -->
|
||||||
|
|
||||||
The **ts** package makes it easy for users to write functions that can
|
The **ts** package makes it easy for users to write functions that can
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user