demo building

This commit is contained in:
Tom Elliott 2025-01-21 21:04:11 +13:00
parent 38c13b10f6
commit 01424ca5c1
5 changed files with 9 additions and 4 deletions

View File

@ -26,6 +26,8 @@ ts_deploy <- function(f,
paste(sapply(init, \(z) sprintf("%s = %s", z, z)), collapse = ",\n ") paste(sapply(init, \(z) sprintf("%s = %s", z, z)), collapse = ",\n ")
) )
x <- x[!grepl("library\\(ts\\)", x)] # Remove library(ts) from the app
src <- c( src <- c(
"library(Rserve)", "library(Rserve)",
"library(ts)", "library(ts)",

View File

@ -1,3 +1,2 @@
node_modules node_modules
*.rserve.R app.rserve.*
*.schema.ts

View File

@ -1,3 +1,5 @@
library(ts)
fn_mean <- ts_function(mean, x = ts_numeric(), result = ts_numeric(1)) fn_mean <- ts_function(mean, x = ts_numeric(), result = ts_numeric(1))
fn_first <- ts_function(function(x = ts_character()) x[1], fn_first <- ts_function(function(x = ts_character()) x[1],
result = ts_character(1) result = ts_character(1)

View File

@ -10,7 +10,7 @@ interface global {
global.WebSocket = WebSocket as any; global.WebSocket = WebSocket as any;
import appFuns from "./app.schema"; import appFuns from "./app.rserve";
async function main() { async function main() {
const con = await RserveClient.create({ const con = await RserveClient.create({

View File

@ -5,7 +5,9 @@
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js" "build": "Rscript -e 'ts::ts_compile(\"app.R\"); ts::ts_deploy(\"app.R\")'",
"rserve": "Rscript app.rserve.R",
"start": "ts-node app.ts"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",