Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "use_script" and "use_js" type functions #29

Open
collinschwantes opened this issue Sep 20, 2023 · 0 comments
Open

add "use_script" and "use_js" type functions #29

collinschwantes opened this issue Sep 20, 2023 · 0 comments

Comments

@collinschwantes
Copy link
Collaborator

the usethis::use_r() function is very handy but we don't always want to put things into the R folder when working on projects. Below an example of use_js created for the IRB_tracking project

#' Use js folder to create js scripts
#' 
#' Like use_r but for javascript
#'
#' @param name String. Name of file
#' @param open Logical. if True, file will open after creation
#'
#' @return
#' @export
#'
#' @examples
use_js <- function(name, open =  rlang::is_interactive() ){
  name <- sprintf("%s.js",name)
  usethis::use_directory("js")
  usethis::edit_file(usethis::proj_path("js",name), open = open)
  status <- file.exists(usethis::proj_path("js",name))
  invisible(TRUE)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant