├── .github └── .gitignore ├── FUNDING.yml ├── R ├── zzz.R ├── bare-utils.R ├── workflows.R ├── ambiorix-utils.R ├── leprechaun-files.R ├── golem-utils.R ├── lit.R ├── extension-utils.R ├── npx.R ├── mock.R ├── rmd-utils.R ├── library.R ├── roclets.R ├── windy.R ├── bare.R ├── tailwind.R ├── bundle.R ├── rmd.R ├── ambiorix.R ├── leprechaun.R ├── extension.R ├── input.R ├── output.R ├── widget.R ├── framework7.R ├── widget-utils.R ├── typescript.R └── golem.R ├── inst ├── rmd │ ├── javascript │ │ ├── assets │ │ │ ├── header.html │ │ │ └── app.html │ │ └── srcjs │ │ │ ├── modules │ │ │ └── message.js │ │ │ └── index.js │ ├── vue │ │ ├── assets │ │ │ ├── app.html │ │ │ └── header.html │ │ └── srcjs │ │ │ ├── index.js │ │ │ └── Home.vue │ ├── react │ │ ├── assets │ │ │ ├── app.html │ │ │ └── header.html │ │ └── srcjs │ │ │ └── index.js │ └── index.Rmd ├── leprechaun │ ├── modules │ │ └── message.js │ └── index.js ├── tailwind │ ├── style.css │ ├── postcss.config.js │ └── tailwind.config.js ├── templates │ ├── vue │ │ ├── _babelrc │ │ ├── vue.js │ │ ├── vue.vue │ │ └── vue_cdn.R │ ├── react │ │ ├── _babelrc │ │ ├── react.js │ │ └── react_cdn.R │ ├── framework7 │ │ ├── _babelrc │ │ ├── framework7.js │ │ ├── app_ui.R │ │ ├── components │ │ │ └── app.f7.jsx │ │ └── golem_add_external_resources.R │ ├── peeky-test.js │ ├── mocha-test.js │ ├── index.pug │ └── index.html ├── ambiorix │ └── javascript │ │ ├── modules │ │ └── message.js │ │ └── index.js ├── golem │ └── javascript │ │ ├── modules │ │ └── message.js │ │ └── index.js ├── widget │ └── javascript │ │ ├── module.js │ │ └── widget.js ├── extension │ ├── R │ │ ├── zzz.R │ │ └── extension.R │ └── javascript │ │ └── extension.js ├── hooks │ ├── rprof.R │ ├── minified.sh │ └── check.yml ├── common │ ├── webpack.prod.js │ ├── webpack.dev.js │ └── webpack.common.js ├── bare │ └── index.js ├── jsdoc │ └── conf.json ├── output │ ├── javascript │ │ └── output.js │ └── R │ │ └── output.R ├── lit │ └── config.json └── input │ ├── javascript │ └── input.js │ └── R │ └── input.R ├── LICENSE ├── .gitignore ├── docs ├── favicon.ico ├── _media │ ├── favicon.ico │ ├── packer.png │ ├── peeky.png │ ├── typed.gif │ ├── vue-bs4.gif │ ├── golem-pug.png │ ├── input-toy.png │ ├── shiny-vue.png │ ├── get-started.gif │ ├── golem-react.png │ ├── input-basic.gif │ ├── toy-widget.png │ ├── vue-bs4-html.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── packer_banner.png │ ├── apple-touch-icon.png │ ├── android-chrome-192x192.png │ └── android-chrome-512x512.png ├── references │ ├── checks.md │ ├── npm_update.md │ ├── npm_outdated.md │ ├── dev_roclet.md │ ├── prod_roclet.md │ ├── npm_console.md │ ├── yarn_console.md │ ├── engine_console.md │ ├── engine_check.md │ ├── add_plugin_workbox.md │ ├── yarn_upgrade.md │ ├── yarn_outdated.md │ ├── add_plugin_eslint.md │ ├── include_action_check.md │ ├── put_test.md │ ├── npx.md │ ├── yarn_clean.md │ ├── add_plugin_prettier.md │ ├── put_recommended.md │ ├── npm_fix.md │ ├── get_edit.md │ ├── ease_lit.md │ ├── npm_run.md │ ├── yarn_run.md │ ├── put_rprofile_adapt.md │ ├── mockup.md │ ├── yarn_version.md │ ├── put_precommit_hook.md │ ├── use_loader_svelte.md │ ├── use_loader_pug.md │ ├── use_loader_ts.md │ ├── yarn_global.md │ ├── bundle.md │ ├── use_tailwind.md │ ├── set_npm.md │ ├── set_yarn.md │ ├── apply_framework7.md │ ├── use_loader_file.md │ ├── jsdoc.md │ ├── use_loader_mocha.md │ ├── use_loader_coffee.md │ ├── yarn_install.md │ ├── npm_install.md │ ├── use_loader_framework7.md │ ├── types.md │ ├── add_plugin_clean.md │ ├── use_loader_babel.md │ ├── add_plugin_html.md │ ├── engine.md │ ├── use_loader_vue.md │ ├── apply_vue.md │ ├── use_loader_rule.md │ ├── make_library.md │ ├── scaffold_bare.md │ ├── scaffold_windy.md │ ├── scaffold_input.md │ ├── scaffold_output.md │ ├── scaffold_extension.md │ ├── use_loader_style.md │ ├── apply_react.md │ ├── scaffold_widget.md │ ├── scaffold_leprechaun.md │ ├── scaffold_rmd.md │ ├── tests.md │ ├── scaffold_ambiorix.md │ └── scaffold_golem.md ├── sw.js ├── docify.R ├── guide │ ├── bundle.md │ ├── engines.md │ ├── installation.md │ ├── docs.md │ ├── typescript.md │ ├── prereq.md │ ├── library.md │ └── pwa.md └── examples │ └── typed.md ├── tests ├── testthat.R ├── testthat │ ├── test-bare │ ├── test-bare.R │ ├── test-windy.R │ ├── test-widget.R │ ├── test-ouput.R │ ├── test-npm.R │ ├── test-ts.R │ ├── test-ambiorix.R │ ├── test-extension.R │ ├── test-check.R │ ├── test-rmd.R │ ├── test-leprechaun.R │ ├── test-input.R │ ├── test-yarn.R │ └── test-golem.R └── fns.R ├── CRAN-SUBMISSION ├── .Rbuildignore ├── cran-comments.md ├── man ├── npm_update.Rd ├── npm_outdated.Rd ├── dev_roclet.Rd ├── npx.Rd ├── prod_roclet.Rd ├── npm_console.Rd ├── yarn_console.Rd ├── engine_console.Rd ├── engine_check.Rd ├── yarn_upgrade.Rd ├── add_plugin_workbox.Rd ├── yarn_outdated.Rd ├── ease_lit.Rd ├── npm_run.Rd ├── put_test.Rd ├── yarn_run.Rd ├── get_edit.Rd ├── yarn_clean.Rd ├── put_recommended.Rd ├── add_plugin_eslint.Rd ├── include_action_check.Rd ├── npm_fix.Rd ├── add_plugin_prettier.Rd ├── use_loader_pug.Rd ├── use_loader_svelte.Rd ├── use_loader_ts.Rd ├── checks.Rd ├── put_rprofile_adapt.Rd ├── yarn_version.Rd ├── use_tailwind.Rd ├── put_precommit_hook.Rd ├── set_npm.Rd ├── set_yarn.Rd ├── mockup.Rd ├── use_loader_file.Rd ├── use_loader_mocha.Rd ├── use_loader_coffee.Rd ├── apply_framework7.Rd ├── jsdoc.Rd ├── use_loader_framework7.Rd ├── yarn_global.Rd ├── add_plugin_clean.Rd ├── use_loader_babel.Rd ├── add_plugin_html.Rd ├── use_loader_vue.Rd ├── yarn_install.Rd ├── apply_vue.Rd ├── use_loader_rule.Rd ├── types.Rd ├── make_library.Rd ├── npm_install.Rd ├── scaffold_bare.Rd ├── scaffold_windy.Rd ├── scaffold_input.Rd ├── scaffold_output.Rd ├── scaffold_extension.Rd ├── apply_react.Rd ├── bundle.Rd ├── scaffold_widget.Rd ├── engine.Rd ├── scaffold_leprechaun.Rd ├── scaffold_rmd.Rd ├── scaffold_ambiorix.Rd ├── tests.Rd ├── use_loader_style.Rd └── scaffold_golem.Rd ├── makefile ├── codecov.yml ├── LICENSE.md ├── DESCRIPTION ├── README.md └── NAMESPACE /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: JohnCoene 2 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | storage <- new.env() 2 | -------------------------------------------------------------------------------- /inst/rmd/javascript/assets/header.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2020 2 | COPYRIGHT HOLDER: John Coene 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ./docs/node_modules/ 2 | .DS_Store 3 | test.R 4 | .vscode 5 | -------------------------------------------------------------------------------- /inst/rmd/javascript/assets/app.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/favicon.ico -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(packer) 3 | 4 | test_check("packer") 5 | -------------------------------------------------------------------------------- /inst/rmd/vue/assets/app.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /docs/_media/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/favicon.ico -------------------------------------------------------------------------------- /docs/_media/packer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/packer.png -------------------------------------------------------------------------------- /docs/_media/peeky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/peeky.png -------------------------------------------------------------------------------- /docs/_media/typed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/typed.gif -------------------------------------------------------------------------------- /docs/_media/vue-bs4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/vue-bs4.gif -------------------------------------------------------------------------------- /inst/leprechaun/modules/message.js: -------------------------------------------------------------------------------- 1 | export const message = (msg) => { 2 | alert(msg); 3 | } 4 | -------------------------------------------------------------------------------- /inst/rmd/react/assets/app.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /inst/tailwind/style.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /inst/templates/vue/_babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-env" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /docs/_media/golem-pug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/golem-pug.png -------------------------------------------------------------------------------- /docs/_media/input-toy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/input-toy.png -------------------------------------------------------------------------------- /docs/_media/shiny-vue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/shiny-vue.png -------------------------------------------------------------------------------- /docs/_media/get-started.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/get-started.gif -------------------------------------------------------------------------------- /docs/_media/golem-react.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/golem-react.png -------------------------------------------------------------------------------- /docs/_media/input-basic.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/input-basic.gif -------------------------------------------------------------------------------- /docs/_media/toy-widget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/toy-widget.png -------------------------------------------------------------------------------- /docs/_media/vue-bs4-html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/vue-bs4-html.png -------------------------------------------------------------------------------- /inst/rmd/vue/assets/header.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_media/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/favicon-16x16.png -------------------------------------------------------------------------------- /docs/_media/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/favicon-32x32.png -------------------------------------------------------------------------------- /docs/_media/packer_banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/packer_banner.png -------------------------------------------------------------------------------- /CRAN-SUBMISSION: -------------------------------------------------------------------------------- 1 | Version: 0.1.3 2 | Date: 2022-05-28 09:13:28 UTC 3 | SHA: 91d8558cbb1842c9a2b248a29dacc7fde11371a2 4 | -------------------------------------------------------------------------------- /docs/_media/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/_media/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/android-chrome-192x192.png -------------------------------------------------------------------------------- /docs/_media/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnCoene/packer/HEAD/docs/_media/android-chrome-512x512.png -------------------------------------------------------------------------------- /inst/ambiorix/javascript/modules/message.js: -------------------------------------------------------------------------------- 1 | const message = (msg) => { 2 | alert(msg); 3 | } 4 | 5 | export { message }; 6 | -------------------------------------------------------------------------------- /inst/golem/javascript/modules/message.js: -------------------------------------------------------------------------------- 1 | const message = (msg) => { 2 | alert(msg); 3 | } 4 | 5 | export { message }; 6 | -------------------------------------------------------------------------------- /inst/rmd/javascript/srcjs/modules/message.js: -------------------------------------------------------------------------------- 1 | const message = (msg) => { 2 | alert(msg); 3 | } 4 | 5 | export { message }; 6 | -------------------------------------------------------------------------------- /inst/rmd/react/srcjs/index.js: -------------------------------------------------------------------------------- 1 | createRoot( 2 | document.getElementById('app') 3 | ).render( 4 |{{ greeting }} powered by Vue!
3 | 4 | 5 | 14 | 15 | 21 | -------------------------------------------------------------------------------- /man/ease_lit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lit.R 3 | \name{ease_lit} 4 | \alias{ease_lit} 5 | \title{Lit} 6 | \usage{ 7 | ease_lit(ts = FALSE) 8 | } 9 | \arguments{ 10 | \item{ts}{Whether to use TypeScript (recommended).} 11 | } 12 | \description{ 13 | Use \href{https://lit.dev}{Lit} in your project. 14 | } 15 | -------------------------------------------------------------------------------- /inst/templates/framework7/framework7.js: -------------------------------------------------------------------------------- 1 | // Import Framework7 2 | import Framework7 from 'framework7'; 3 | // Import Framework7 Styles 4 | import 'framework7/framework7-bundle.min.css'; 5 | 6 | import App from './components/app.f7.jsx'; 7 | let app = new Framework7({ 8 | el: '#app', 9 | theme: 'ios', 10 | // specify main app component 11 | component: App 12 | }); -------------------------------------------------------------------------------- /man/npm_run.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/npm.R 3 | \name{npm_run} 4 | \alias{npm_run} 5 | \title{Npm Command} 6 | \usage{ 7 | npm_run(...) 8 | } 9 | \arguments{ 10 | \item{...}{Passed to \code{\link[=system2]{system2()}}.} 11 | } 12 | \description{ 13 | Convenience function to run \code{npm} commands. 14 | } 15 | -------------------------------------------------------------------------------- /man/put_test.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/checks.R 3 | \name{put_test} 4 | \alias{put_test} 5 | \title{Put a Test} 6 | \usage{ 7 | put_test() 8 | } 9 | \description{ 10 | Puts a testthat test to ensure the files are 11 | optimised for prod. 12 | } 13 | \note{ 14 | This function adds packer to \code{Suggests}. 15 | } 16 | -------------------------------------------------------------------------------- /man/yarn_run.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/yarn.R 3 | \name{yarn_run} 4 | \alias{yarn_run} 5 | \title{Yarn Command} 6 | \usage{ 7 | yarn_run(...) 8 | } 9 | \arguments{ 10 | \item{...}{Passed to \code{\link[=system2]{system2()}}.} 11 | } 12 | \description{ 13 | Convenience function to run \code{yarn} commands. 14 | } 15 | -------------------------------------------------------------------------------- /docs/references/get_edit.md: -------------------------------------------------------------------------------- 1 | # `get_edit` 2 | 3 | Get Edit Mode 4 | 5 | 6 | ## Description 7 | 8 | Get edit value to handle `NULL` value. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | get_edit(edit = NULL) 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `edit` | Current edit value. 23 | 24 | 25 | -------------------------------------------------------------------------------- /man/get_edit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{get_edit} 4 | \alias{get_edit} 5 | \title{Get Edit Mode} 6 | \usage{ 7 | get_edit(edit = NULL) 8 | } 9 | \arguments{ 10 | \item{edit}{Current edit value.} 11 | } 12 | \description{ 13 | Get edit value to handle \code{NULL} value. 14 | } 15 | \keyword{internal} 16 | -------------------------------------------------------------------------------- /man/yarn_clean.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/yarn.R 3 | \name{yarn_clean} 4 | \alias{yarn_clean} 5 | \title{Yarn cache clean} 6 | \usage{ 7 | yarn_clean() 8 | } 9 | \value{ 10 | The semver as a string. 11 | } 12 | \description{ 13 | Clean the cache 14 | } 15 | \examples{ 16 | \dontrun{ 17 | yarn_clean() 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /man/put_recommended.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/checks.R 3 | \name{put_recommended} 4 | \alias{put_recommended} 5 | \title{Recommended Checks} 6 | \usage{ 7 | put_recommended() 8 | } 9 | \description{ 10 | Recommended checks for packer projects, 11 | runs \link{put_rprofile_adapt} and 12 | \link{put_precommit_hook}. 13 | } 14 | -------------------------------------------------------------------------------- /docs/references/ease_lit.md: -------------------------------------------------------------------------------- 1 | # `ease_lit` 2 | 3 | Lit 4 | 5 | 6 | ## Description 7 | 8 | Use [Lit](https://lit.dev) in your project. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | ease_lit(ts = FALSE) 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `ts` | Whether to use TypeScript (recommended). 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/references/npm_run.md: -------------------------------------------------------------------------------- 1 | # `npm_run` 2 | 3 | Npm Command 4 | 5 | 6 | ## Description 7 | 8 | Convenience function to run `npm` commands. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | npm_run(...) 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `...` | Passed to [`system2()`](#system2()) . 23 | 24 | 25 | -------------------------------------------------------------------------------- /man/add_plugin_eslint.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plugins.R 3 | \name{add_plugin_eslint} 4 | \alias{add_plugin_eslint} 5 | \title{ESLint Plugin} 6 | \usage{ 7 | add_plugin_eslint() 8 | } 9 | \description{ 10 | Add the \href{https://www.npmjs.com/package/eslint-webpack-plugin}{eslint-webpack-plugin} 11 | run ESLint on files. 12 | } 13 | -------------------------------------------------------------------------------- /docs/references/yarn_run.md: -------------------------------------------------------------------------------- 1 | # `yarn_run` 2 | 3 | Yarn Command 4 | 5 | 6 | ## Description 7 | 8 | Convenience function to run `yarn` commands. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | yarn_run(...) 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `...` | Passed to [`system2()`](#system2()) . 23 | 24 | 25 | -------------------------------------------------------------------------------- /man/include_action_check.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/workflows.R 3 | \name{include_action_check} 4 | \alias{include_action_check} 5 | \title{Github Actions} 6 | \usage{ 7 | include_action_check() 8 | } 9 | \description{ 10 | Adds a Github Action to the package that will ensure 11 | JavaScript files have been bundled for production. 12 | } 13 | -------------------------------------------------------------------------------- /man/npm_fix.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/npm.R 3 | \name{npm_fix} 4 | \alias{npm_fix} 5 | \title{Audit Fix} 6 | \usage{ 7 | npm_fix() 8 | } 9 | \description{ 10 | Scan your project for vulnerabilities and automatically install 11 | any compatible updates to vulnerable dependencies. 12 | } 13 | \details{ 14 | Runs \verb{npm audit fix} 15 | } 16 | -------------------------------------------------------------------------------- /R/bare-utils.R: -------------------------------------------------------------------------------- 1 | #' Bare JavaScript Files 2 | #' 3 | #' Creates the necessary `srcjs` directory and children JavaScript files. 4 | #' This is a simple copy of template files: no changes required. 5 | #' 6 | #' @noRd 7 | #' @keywords internal 8 | bare_files <- function() { 9 | base <- pkg_file("bare") 10 | fs::dir_copy(base, "srcjs") 11 | cli::cli_alert_success("Created {.file srcjs} directory") 12 | } 13 | -------------------------------------------------------------------------------- /docs/references/put_rprofile_adapt.md: -------------------------------------------------------------------------------- 1 | # `put_rprofile_adapt` 2 | 3 | Rprofile 4 | 5 | 6 | ## Description 7 | 8 | Add [`engine_adapt()`](#engineadapt()) to `.Rprofile` . 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | put_rprofile_adapt() 15 | ``` 16 | 17 | 18 | ## Details 19 | 20 | This is recommended so anyone contributing to 21 | the project is guaranteed to be on the correct 22 | engine. 23 | 24 | 25 | -------------------------------------------------------------------------------- /man/add_plugin_prettier.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plugins.R 3 | \name{add_plugin_prettier} 4 | \alias{add_plugin_prettier} 5 | \title{Prettier Plugin} 6 | \usage{ 7 | add_plugin_prettier() 8 | } 9 | \description{ 10 | Add the \href{https://www.npmjs.com/package/prettier-webpack-plugin}{prettier-webpack-plugin} to 11 | prettify the pre-bundled files. 12 | } 13 | -------------------------------------------------------------------------------- /tests/testthat/test-bare: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("Bare", { 6 | 7 | # keep working directory 8 | wd <- getwd() 9 | 10 | # test bare 11 | pkg <- create_tmp_package() 12 | setwd(pkg) 13 | on.exit({ 14 | setwd(wd) 15 | delete_tmp_package(pkg) 16 | }) 17 | expect_output(scaffold_bare(edit = FALSE)) 18 | expect_error(scaffold_bare(edit = FALSE)) 19 | }) 20 | -------------------------------------------------------------------------------- /R/workflows.R: -------------------------------------------------------------------------------- 1 | #' Github Actions 2 | #' 3 | #' Adds a Github Action to the package that will ensure 4 | #' JavaScript files have been bundled for production. 5 | #' 6 | #' @export 7 | include_action_check <- function() { 8 | file <- pkg_file("hooks/check.yml") 9 | fs::dir_create(".github/workflows", recurse = TRUE) 10 | fs::file_copy(file, ".github/workflows/packer-check.yml") 11 | usethis::use_build_ignore(".github/") 12 | } 13 | -------------------------------------------------------------------------------- /docs/references/mockup.md: -------------------------------------------------------------------------------- 1 | # `mockup` 2 | 3 | Mock up 4 | 5 | 6 | ## Description 7 | 8 | Functions to mock up packages for tests 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | tmp_package() 15 | tmp_golem() 16 | tmp_project() 17 | tmp_ambiorix() 18 | tmp_delete(tmp) 19 | ``` 20 | 21 | 22 | ## Arguments 23 | 24 | Argument |Description 25 | ------------- |---------------- 26 | `tmp` | A temp mock up project. 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/references/yarn_version.md: -------------------------------------------------------------------------------- 1 | # `yarn_version` 2 | 3 | Npm version 4 | 5 | 6 | ## Description 7 | 8 | Get the version of npm. 9 | 10 | Get the version of yarn. 11 | 12 | 13 | ## Usage 14 | 15 | ```r 16 | yarn_version() 17 | yarn_version() 18 | ``` 19 | 20 | 21 | ## Value 22 | 23 | The semver as a string. 24 | 25 | The semver as a string. 26 | 27 | 28 | ## Examples 29 | 30 | ```r 31 | yarn_version() 32 | ``` 33 | 34 | 35 | -------------------------------------------------------------------------------- /inst/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |Hello packer
13 | 14 | -------------------------------------------------------------------------------- /man/use_loader_pug.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loaders.R 3 | \name{use_loader_pug} 4 | \alias{use_loader_pug} 5 | \title{Use Pug Loader} 6 | \usage{ 7 | use_loader_pug(test = "\\\\.pug$") 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | } 12 | \description{ 13 | Adds the loader for the pug templating engine. 14 | } 15 | -------------------------------------------------------------------------------- /man/use_loader_svelte.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loaders.R 3 | \name{use_loader_svelte} 4 | \alias{use_loader_svelte} 5 | \title{Use Svelte Loader} 6 | \usage{ 7 | use_loader_svelte(test = "\\\\.(html|svelte)$") 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | } 12 | \description{ 13 | Add the loader svelte 14 | } 15 | -------------------------------------------------------------------------------- /tests/testthat/test-bare.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("bare", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | # test bare 10 | pkg <- create_tmp_package() 11 | setwd(pkg) 12 | on.exit({ 13 | setwd(wd) 14 | delete_tmp_package(pkg) 15 | }) 16 | expect_output(scaffold_bare(edit = FALSE)) 17 | expect_error(scaffold_bare(edit = FALSE)) 18 | expect_message(bundle_dev()) 19 | }) 20 | -------------------------------------------------------------------------------- /tests/testthat/test-windy.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("windy", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | # test bare 10 | pkg <- create_tmp_package() 11 | setwd(pkg) 12 | on.exit({ 13 | setwd(wd) 14 | delete_tmp_package(pkg) 15 | }) 16 | expect_output(scaffold_bare(edit = FALSE)) 17 | expect_error(scaffold_bare(edit = FALSE)) 18 | expect_message(bundle_dev()) 19 | }) 20 | -------------------------------------------------------------------------------- /man/use_loader_ts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loaders.R 3 | \name{use_loader_ts} 4 | \alias{use_loader_ts} 5 | \title{Use Typescript Loader} 6 | \usage{ 7 | use_loader_ts(test = "\\\\.tsx?$") 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | } 12 | \description{ 13 | Adds the loader for the pug templating engine. 14 | } 15 | -------------------------------------------------------------------------------- /man/checks.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/checks.R 3 | \name{checks} 4 | \alias{checks} 5 | \title{Checks} 6 | \usage{ 7 | checks() 8 | } 9 | \description{ 10 | Run checks on a package using packer. 11 | } 12 | \section{Checks}{ 13 | 14 | \itemize{ 15 | \item Output files are minified 16 | \item \link{put_precommit_hook} is in place 17 | \item \link{put_rprofile_adapt} is in place 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /docs/references/put_precommit_hook.md: -------------------------------------------------------------------------------- 1 | # `put_precommit_hook` 2 | 3 | Put Pre-Commit Hook 4 | 5 | 6 | ## Description 7 | 8 | Add a pre-commit hook that runs at every commit 9 | to ensure that JavaScript files are minified. 10 | 11 | 12 | ## Usage 13 | 14 | ```r 15 | put_precommit_hook() 16 | ``` 17 | 18 | 19 | ## Note 20 | 21 | Will only work if using git. 22 | 23 | 24 | ## Examples 25 | 26 | ```r 27 | put_precommit_hook() 28 | ``` 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/references/use_loader_svelte.md: -------------------------------------------------------------------------------- 1 | # `use_loader_svelte` 2 | 3 | Use Svelte Loader 4 | 5 | 6 | ## Description 7 | 8 | Add the loader svelte 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | use_loader_svelte(test = "\\.(html|svelte)$") 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `test` | Test regular expression test which files should be transformed by the loader. 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/references/use_loader_pug.md: -------------------------------------------------------------------------------- 1 | # `use_loader_pug` 2 | 3 | Use Pug Loader 4 | 5 | 6 | ## Description 7 | 8 | Adds the loader for the pug templating engine. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | use_loader_pug(test = "\\.pug$") 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `test` | Test regular expression test which files should be transformed by the loader. 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/references/use_loader_ts.md: -------------------------------------------------------------------------------- 1 | # `use_loader_ts` 2 | 3 | Use Typescript Loader 4 | 5 | 6 | ## Description 7 | 8 | Adds the loader for the pug templating engine. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | use_loader_ts(test = "\\.tsx?$") 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `test` | Test regular expression test which files should be transformed by the loader. 23 | 24 | 25 | -------------------------------------------------------------------------------- /man/put_rprofile_adapt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/checks.R 3 | \name{put_rprofile_adapt} 4 | \alias{put_rprofile_adapt} 5 | \title{Rprofile} 6 | \usage{ 7 | put_rprofile_adapt() 8 | } 9 | \description{ 10 | Add \code{\link[=engine_adapt]{engine_adapt()}} to \code{.Rprofile}. 11 | } 12 | \details{ 13 | This is recommended so anyone contributing to 14 | the project is guaranteed to be on the correct 15 | engine. 16 | } 17 | -------------------------------------------------------------------------------- /man/yarn_version.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/npm.R, R/yarn.R 3 | \name{yarn_version} 4 | \alias{yarn_version} 5 | \title{Npm version} 6 | \usage{ 7 | yarn_version() 8 | 9 | yarn_version() 10 | } 11 | \value{ 12 | The semver as a string. 13 | 14 | The semver as a string. 15 | } 16 | \description{ 17 | Get the version of npm. 18 | 19 | Get the version of yarn. 20 | } 21 | \examples{ 22 | \dontrun{ 23 | yarn_version() 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /docs/references/yarn_global.md: -------------------------------------------------------------------------------- 1 | # `yarn_global` 2 | 3 | Yarn Global 4 | 5 | 6 | ## Description 7 | 8 | Installs or manage yarn globally . 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | engine_yarn_install() 15 | engine_yarn_set(version = "latest") 16 | ``` 17 | 18 | 19 | ## Arguments 20 | 21 | Argument |Description 22 | ------------- |---------------- 23 | `version` | Version to set yarn 24 | 25 | 26 | ## Examples 27 | 28 | ```r 29 | engine_yarn_install() 30 | ``` 31 | 32 | 33 | -------------------------------------------------------------------------------- /man/use_tailwind.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tailwind.R 3 | \name{use_tailwind} 4 | \alias{use_tailwind} 5 | \title{Use Tailwind} 6 | \usage{ 7 | use_tailwind(test = "\\\\.css$") 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | } 12 | \description{ 13 | Creates PostCSS, and tailwindcss config files as well 14 | as adds the appropriate loaders and installs dependencies. 15 | } 16 | -------------------------------------------------------------------------------- /docs/references/bundle.md: -------------------------------------------------------------------------------- 1 | # `bundle` 2 | 3 | bundle & Watch 4 | 5 | 6 | ## Description 7 | 8 | Bundle and watch the JavaScript. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | bundle(mode = c("production", "development", "none")) 15 | bundle_prod() 16 | bundle_dev() 17 | watch() 18 | ``` 19 | 20 | 21 | ## Arguments 22 | 23 | Argument |Description 24 | ------------- |---------------- 25 | `mode` | The configuration mode tells webpack to use its built-in optimisations accordingly. 26 | 27 | 28 | -------------------------------------------------------------------------------- /docs/sw.js: -------------------------------------------------------------------------------- 1 | importScripts( 2 | 'https://storage.googleapis.com/workbox-cdn/releases/3.6.1/workbox-sw.js' 3 | ) 4 | 5 | const ALLOWED_HOSTS = [ 6 | // The domain to load markdown files 7 | location.host, 8 | // The domain to load docute 9 | 'unpkg.com' 10 | ] 11 | 12 | const matchCb = ({ url, event }) => { 13 | return event.request.method === 'GET' && ALLOWED_HOSTS.includes(url.host) 14 | } 15 | 16 | workbox.routing.registerRoute( 17 | matchCb, 18 | workbox.strategies.networkFirst() 19 | ) 20 | -------------------------------------------------------------------------------- /inst/output/javascript/output.js: -------------------------------------------------------------------------------- 1 | import $ from 'jquery'; 2 | import 'shiny'; 3 | 4 | var #name#Binding = new Shiny.OutputBinding(); 5 | 6 | $.extend(#name#Binding, { 7 | find: (scope) => { 8 | return $(scope).find(".#name#"); 9 | }, 10 | getId: (el) => { 11 | return el.id; 12 | }, 13 | renderValue: (el, data) => { 14 | $(el).html(data.html); 15 | $(el).css('color', data.color); 16 | } 17 | }); 18 | 19 | Shiny.outputBindings.register(#name#Binding, "#pkgname#.#name#Binding"); 20 | -------------------------------------------------------------------------------- /man/put_precommit_hook.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/checks.R 3 | \name{put_precommit_hook} 4 | \alias{put_precommit_hook} 5 | \title{Put Pre-Commit Hook} 6 | \usage{ 7 | put_precommit_hook() 8 | } 9 | \description{ 10 | Add a pre-commit hook that runs at every commit 11 | to ensure that JavaScript files are minified. 12 | } 13 | \note{ 14 | Will only work if using git. 15 | } 16 | \examples{ 17 | \dontrun{ 18 | put_precommit_hook() 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /man/set_npm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/npm.R 3 | \name{set_npm} 4 | \alias{set_npm} 5 | \title{Set npm path} 6 | \usage{ 7 | set_npm(path = NULL) 8 | } 9 | \arguments{ 10 | \item{path}{Path to npm installation to use.} 11 | } 12 | \description{ 13 | By default packer looks for the npm installation using 14 | the \code{which} (or \code{where}) command. 15 | This function lets you override that behaviour and 16 | force a specific npm installation. 17 | } 18 | -------------------------------------------------------------------------------- /man/set_yarn.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/yarn.R 3 | \name{set_yarn} 4 | \alias{set_yarn} 5 | \title{Set yarn path} 6 | \usage{ 7 | set_yarn(path = NULL) 8 | } 9 | \arguments{ 10 | \item{path}{Path to yarn installation to use.} 11 | } 12 | \description{ 13 | By default packer looks for the yarn installation using 14 | the \code{which} (or \code{where}) command. 15 | This function lets you override that behaviour and 16 | force a specific yarn installation. 17 | } 18 | -------------------------------------------------------------------------------- /tests/testthat/test-widget.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("Widget", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | # create package and 10 | pkg <- create_tmp_package() 11 | setwd(pkg) 12 | on.exit({ 13 | setwd(wd) 14 | delete_tmp_package(pkg) 15 | }) 16 | 17 | expect_error(scaffold_widget()) 18 | expect_output(scaffold_widget("writeH1", edit = FALSE)) 19 | expect_output(scaffold_widget("writeH2", edit = FALSE)) 20 | expect_message(bundle()) 21 | }) 22 | -------------------------------------------------------------------------------- /docs/references/use_tailwind.md: -------------------------------------------------------------------------------- 1 | # `use_tailwind` 2 | 3 | Use Tailwind 4 | 5 | 6 | ## Description 7 | 8 | Creates PostCSS, and tailwindcss config files as well 9 | as adds the appropriate loaders and installs dependencies. 10 | 11 | 12 | ## Usage 13 | 14 | ```r 15 | use_tailwind(test = "\\.css$") 16 | ``` 17 | 18 | 19 | ## Arguments 20 | 21 | Argument |Description 22 | ------------- |---------------- 23 | `test` | Test regular expression test which files should be transformed by the loader. 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/references/set_npm.md: -------------------------------------------------------------------------------- 1 | # `set_npm` 2 | 3 | Set npm path 4 | 5 | 6 | ## Description 7 | 8 | By default packer looks for the npm installation using 9 | the `which` (or `where` ) command. 10 | This function lets you override that behaviour and 11 | force a specific npm installation. 12 | 13 | 14 | ## Usage 15 | 16 | ```r 17 | set_npm(path = NULL) 18 | ``` 19 | 20 | 21 | ## Arguments 22 | 23 | Argument |Description 24 | ------------- |---------------- 25 | `path` | Path to npm installation to use. 26 | 27 | 28 | -------------------------------------------------------------------------------- /docs/references/set_yarn.md: -------------------------------------------------------------------------------- 1 | # `set_yarn` 2 | 3 | Set yarn path 4 | 5 | 6 | ## Description 7 | 8 | By default packer looks for the yarn installation using 9 | the `which` (or `where` ) command. 10 | This function lets you override that behaviour and 11 | force a specific yarn installation. 12 | 13 | 14 | ## Usage 15 | 16 | ```r 17 | set_yarn(path = NULL) 18 | ``` 19 | 20 | 21 | ## Arguments 22 | 23 | Argument |Description 24 | ------------- |---------------- 25 | `path` | Path to yarn installation to use. 26 | 27 | 28 | -------------------------------------------------------------------------------- /inst/templates/framework7/app_ui.R: -------------------------------------------------------------------------------- 1 | #' The application User-Interface 2 | #' 3 | #' @param request Internal parameter for `{shiny}`. 4 | #' DO NOT REMOVE. 5 | #' @param title Page title. 6 | #' @import shiny 7 | #' @noRd 8 | app_ui <- function(request, title = NULL) { 9 | tagList( 10 | # Leave this function for adding external resources 11 | golem_add_external_resources(title), 12 | # Your application UI logic 13 | tags$body( 14 | div(id = "app"), 15 | tags$script(src = "www/index.js") 16 | ) 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /man/mockup.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/mock.R 3 | \name{mockup} 4 | \alias{mockup} 5 | \alias{tmp_package} 6 | \alias{tmp_golem} 7 | \alias{tmp_project} 8 | \alias{tmp_ambiorix} 9 | \alias{tmp_delete} 10 | \title{Mock up} 11 | \usage{ 12 | tmp_package() 13 | 14 | tmp_golem() 15 | 16 | tmp_project() 17 | 18 | tmp_ambiorix() 19 | 20 | tmp_delete(tmp) 21 | } 22 | \arguments{ 23 | \item{tmp}{A temp mock up project.} 24 | } 25 | \description{ 26 | Functions to mock up packages for tests 27 | } 28 | -------------------------------------------------------------------------------- /docs/references/apply_framework7.md: -------------------------------------------------------------------------------- 1 | # `apply_framework7` 2 | 3 | Apply Framework7 4 | 5 | 6 | ## Description 7 | 8 | Apply Framework7 to a project, adds the relevant (babel) loader, installs dependencies, 9 | and creates, or updates, or replaces the `srcjs/index.js` file. 10 | 11 | 12 | ## Usage 13 | 14 | ```r 15 | apply_framework7() 16 | ``` 17 | 18 | 19 | ## Details 20 | 21 | After running this function and bundling the JavaScript remember to place 22 | div(id = "app"), tags$script(src = "www/index.js") at the bottom of your shiny UI. 23 | 24 | 25 | -------------------------------------------------------------------------------- /R/ambiorix-utils.R: -------------------------------------------------------------------------------- 1 | #' Golem JavaScript Files 2 | #' 3 | #' Creates the necessary `srcjs` directory and children JavaScript files. 4 | #' This is a simple copy of template files: no changes required. 5 | #' 6 | #' @inheritParams scaffol_golem 7 | #' 8 | #' @noRd 9 | #' @keywords internal 10 | ambiorix_files <- function(vue = FALSE) { 11 | base <- pkg_file("ambiorix/javascript") 12 | 13 | if (vue) { 14 | fs::dir_create("srcjs") 15 | } else { 16 | fs::dir_copy(base, "srcjs") 17 | } 18 | 19 | cli::cli_alert_success("Created {.file srcjs} directory") 20 | } 21 | -------------------------------------------------------------------------------- /docs/references/use_loader_file.md: -------------------------------------------------------------------------------- 1 | # `use_loader_file` 2 | 3 | Use File Loader 4 | 5 | 6 | ## Description 7 | 8 | Adds the [list("file-loader")](https://webpack.js.org/loaders/file-loader/) 9 | to resolve files: `png` , `jpg` , `jpeg` , and `gif` . 10 | 11 | 12 | ## Usage 13 | 14 | ```r 15 | use_loader_file(test = "\\.(png|jpe?g|gif)$/i") 16 | ``` 17 | 18 | 19 | ## Arguments 20 | 21 | Argument |Description 22 | ------------- |---------------- 23 | `test` | Test regular expression test which files should be transformed by the loader. 24 | 25 | 26 | -------------------------------------------------------------------------------- /man/use_loader_file.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loaders.R 3 | \name{use_loader_file} 4 | \alias{use_loader_file} 5 | \title{Use File Loader} 6 | \usage{ 7 | use_loader_file(test = "\\\\.(png|jpe?g|gif)$/i") 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | } 12 | \description{ 13 | Adds the \href{https://webpack.js.org/loaders/file-loader/}{\code{file-loader}} 14 | to resolve files: \code{png}, \code{jpg}, \code{jpeg}, and \code{gif}. 15 | } 16 | -------------------------------------------------------------------------------- /man/use_loader_mocha.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loaders.R 3 | \name{use_loader_mocha} 4 | \alias{use_loader_mocha} 5 | \title{Use Mocha Loader} 6 | \usage{ 7 | use_loader_mocha(test = "\\\\.test\\\\.js$") 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | } 12 | \description{ 13 | Adds the \href{https://webpack.js.org/loaders/mocha-loader/}{\code{mocha-loader}} for tests. 14 | } 15 | \details{ 16 | Excludes \code{node_modules} by default. 17 | } 18 | -------------------------------------------------------------------------------- /docs/references/jsdoc.md: -------------------------------------------------------------------------------- 1 | # `jsdoc` 2 | 3 | Add Plugin jsdoc 4 | 5 | 6 | ## Description 7 | 8 | Add the [jsdoc](https://github.com/jsdoc/jsdoc) 9 | plugin to generate documentation from JavaScript code 10 | with tags similar to roxygen2. 11 | 12 | 13 | ## Usage 14 | 15 | ```r 16 | add_plugin_jsdoc(edit = interactive()) 17 | add_jsdoc_tutorial(name, edit = interactive()) 18 | ``` 19 | 20 | 21 | ## Arguments 22 | 23 | Argument |Description 24 | ------------- |---------------- 25 | `edit` | Whether to open relevent file. 26 | `name` | Name of tutorial 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/references/use_loader_mocha.md: -------------------------------------------------------------------------------- 1 | # `use_loader_mocha` 2 | 3 | Use Mocha Loader 4 | 5 | 6 | ## Description 7 | 8 | Adds the [list("mocha-loader")](https://webpack.js.org/loaders/mocha-loader/) for tests. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | use_loader_mocha(test = "\\.test\\.js$") 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `test` | Test regular expression test which files should be transformed by the loader. 23 | 24 | 25 | ## Details 26 | 27 | Excludes `node_modules` by default. 28 | 29 | 30 | -------------------------------------------------------------------------------- /man/use_loader_coffee.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loaders.R 3 | \name{use_loader_coffee} 4 | \alias{use_loader_coffee} 5 | \title{Use Coffee Loader} 6 | \usage{ 7 | use_loader_coffee(test = "\\\\.coffee$") 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | } 12 | \description{ 13 | Adds the \href{https://webpack.js.org/loaders/coffee-loader/}{\code{coffee-loader}} to use 14 | cofeescript. 15 | } 16 | \details{ 17 | Excludes \code{node_modules} by default. 18 | } 19 | -------------------------------------------------------------------------------- /tests/testthat/test-ouput.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("Output", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | # test bare 10 | pkg <- create_tmp_package() 11 | setwd(pkg) 12 | on.exit({ 13 | setwd(wd) 14 | delete_tmp_package(pkg) 15 | }) 16 | expect_error(scaffold_output()) 17 | expect_output(scaffold_output("out", edit = FALSE)) 18 | expect_error(scaffold_output("out", edit = FALSE)) 19 | expect_message(bundle()) 20 | expect_output(scaffold_output("out_again", edit = FALSE)) 21 | expect_message(bundle()) 22 | }) 23 | -------------------------------------------------------------------------------- /inst/templates/vue/vue_cdn.R: -------------------------------------------------------------------------------- 1 | #' Dependencies for Vue 2 | #' 3 | #' Includes Vue dependencies in a shiny application. 4 | #' 5 | #' @param version Version of Vue to use, if `NULL` uses the latest 6 | #' 7 | #' @keywords internal 8 | vueCDN <- function(version = NULL){ 9 | 10 | version_string <- ".js" 11 | if(!is.null(version)) 12 | version_string <- sprintf("@%d", version) 13 | 14 | vue <- sprintf("https://cdn.jsdelivr.net/npm/vue%s", version_string) 15 | shiny::singleton( 16 | shiny::tags$head( 17 | shiny::tags$script(src = vue, crossorigin = NA) 18 | ) 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /R/leprechaun-files.R: -------------------------------------------------------------------------------- 1 | #' Leprechaun JavaScript Files 2 | #' 3 | #' Creates the necessary `srcjs` directory and children JavaScript files. 4 | #' This is a simple copy of template files: no changes required. 5 | #' 6 | #' @inheritParams scaffold_leprechaun 7 | #' 8 | #' @noRd 9 | #' @keywords internal 10 | leprechaun_files <- function(react = FALSE, vue = FALSE) { 11 | base <- pkg_file("leprechaun") 12 | 13 | if (any(react, vue)) { 14 | fs::dir_create("srcjs") 15 | } else { 16 | fs::dir_copy(base, "srcjs") 17 | } 18 | 19 | cli::cli_alert_success("Created {.file srcjs} directory") 20 | } 21 | -------------------------------------------------------------------------------- /docs/references/use_loader_coffee.md: -------------------------------------------------------------------------------- 1 | # `use_loader_coffee` 2 | 3 | Use Coffee Loader 4 | 5 | 6 | ## Description 7 | 8 | Adds the [list("coffee-loader")](https://webpack.js.org/loaders/coffee-loader/) to use 9 | cofeescript. 10 | 11 | 12 | ## Usage 13 | 14 | ```r 15 | use_loader_coffee(test = "\\.coffee$") 16 | ``` 17 | 18 | 19 | ## Arguments 20 | 21 | Argument |Description 22 | ------------- |---------------- 23 | `test` | Test regular expression test which files should be transformed by the loader. 24 | 25 | 26 | ## Details 27 | 28 | Excludes `node_modules` by default. 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/testthat/test-npm.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("NPM", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | # test bare 10 | pkg <- create_tmp_golem() 11 | setwd(pkg) 12 | expect_output(scaffold_golem(edit = FALSE)) 13 | engine_adapt() 14 | # no error 15 | expect_message(npm_install("browserify")) 16 | expect_message(npm_install()) 17 | npm_outdated() 18 | npm_fix() 19 | expect_error(npm_uninstall()) 20 | expect_message(npm_update()) 21 | expect_message(npm_uninstall("browserify")) 22 | setwd(wd) 23 | delete_tmp_package(pkg) 24 | }) 25 | -------------------------------------------------------------------------------- /R/golem-utils.R: -------------------------------------------------------------------------------- 1 | #' Golem JavaScript Files 2 | #' 3 | #' Creates the necessary `srcjs` directory and children JavaScript files. 4 | #' This is a simple copy of template files: no changes required. 5 | #' 6 | #' @inheritParams scaffol_golem 7 | #' 8 | #' @noRd 9 | #' @keywords internal 10 | golem_files <- function(react = FALSE, vue = FALSE, framework7 = FALSE) { 11 | base <- pkg_file("golem/javascript") 12 | 13 | if (any(react, vue, framework7)) { 14 | fs::dir_create("srcjs") 15 | } else { 16 | fs::dir_copy(base, "srcjs") 17 | } 18 | 19 | cli::cli_alert_success("Created {.file srcjs} directory") 20 | } 21 | -------------------------------------------------------------------------------- /man/apply_framework7.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/framework7.R 3 | \name{apply_framework7} 4 | \alias{apply_framework7} 5 | \title{Apply Framework7} 6 | \usage{ 7 | apply_framework7() 8 | } 9 | \description{ 10 | Apply Framework7 to a project, adds the relevant (babel) loader, installs dependencies, 11 | and creates, or updates, or replaces the \code{srcjs/index.js} file. 12 | } 13 | \details{ 14 | After running this function and bundling the JavaScript remember to place 15 | \verb{div(id = "app"), tags$script(src = "www/index.js")} at the bottom of your shiny UI. 16 | } 17 | -------------------------------------------------------------------------------- /tests/testthat/test-ts.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("TypeScript", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | # test bare 10 | pkg <- create_tmp_golem() 11 | setwd(pkg) 12 | expect_output(scaffold_golem(edit = FALSE)) 13 | expect_message(use_loader_ts()) 14 | expect_message(ts_shiny_types()) 15 | expect_error(ts_get_types("error", versions = c(1, 2))) 16 | expect_message(ts_get_type("jquery")) 17 | expect_message(ts_get_types("@types/jquery"), versions = "3.5.5") 18 | expect_message(ease_lit(TRUE)) 19 | setwd(wd) 20 | delete_tmp_package(pkg) 21 | }) 22 | -------------------------------------------------------------------------------- /man/jsdoc.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plugins.R 3 | \name{jsdoc} 4 | \alias{jsdoc} 5 | \alias{add_plugin_jsdoc} 6 | \alias{add_jsdoc_tutorial} 7 | \title{Add Plugin jsdoc} 8 | \usage{ 9 | add_plugin_jsdoc(edit = interactive()) 10 | 11 | add_jsdoc_tutorial(name, edit = interactive()) 12 | } 13 | \arguments{ 14 | \item{edit}{Whether to open relevent file.} 15 | 16 | \item{name}{Name of tutorial} 17 | } 18 | \description{ 19 | Add the \href{https://github.com/jsdoc/jsdoc}{jsdoc} 20 | plugin to generate documentation from JavaScript code 21 | with tags similar to roxygen2. 22 | } 23 | -------------------------------------------------------------------------------- /docs/references/yarn_install.md: -------------------------------------------------------------------------------- 1 | # `yarn_install` 2 | 3 | Install and Uninstall yarn Packages 4 | 5 | 6 | ## Description 7 | 8 | Install and uninstall yarn packages. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | yarn_add(..., scope = c("dev", "prod")) 15 | yarn_install() 16 | yarn_remove(..., scope = c("dev", "prod")) 17 | ``` 18 | 19 | 20 | ## Arguments 21 | 22 | Argument |Description 23 | ------------- |---------------- 24 | `...` | Packages to install or uninstall. 25 | `scope` | Scope of installation or uninstallation, see scopes. 26 | 27 | 28 | ## Examples 29 | 30 | ```r 31 | yarn_add("browserify") 32 | ``` 33 | 34 | 35 | -------------------------------------------------------------------------------- /inst/widget/javascript/widget.js: -------------------------------------------------------------------------------- 1 | import 'widgets'; 2 | import { asHeader } from '../modules/header.js'; 3 | 4 | HTMLWidgets.widget({ 5 | 6 | name: '#name#', 7 | 8 | type: 'output', 9 | 10 | factory: function(el, width, height) { 11 | 12 | // TODO: define shared variables for this instance 13 | 14 | return { 15 | 16 | renderValue: function(x) { 17 | 18 | // TODO: code to render the widget, e.g. 19 | el.innerHTML = asHeader(x); 20 | 21 | }, 22 | 23 | resize: function(width, height) { 24 | 25 | // TODO: code to re-render the widget with a new size 26 | 27 | } 28 | 29 | }; 30 | } 31 | }); 32 | -------------------------------------------------------------------------------- /docs/references/npm_install.md: -------------------------------------------------------------------------------- 1 | # `npm_install` 2 | 3 | Install and Uninstall Npm Packages 4 | 5 | 6 | ## Description 7 | 8 | Install and uninstall npm packages. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | npm_install(..., scope = c("dev", "prod", "global")) 15 | npm_uninstall(..., scope = c("dev", "prod", "global")) 16 | ``` 17 | 18 | 19 | ## Arguments 20 | 21 | Argument |Description 22 | ------------- |---------------- 23 | `...` | Packages to install or uninstall. If no packages are specified then this function install packages in `package.json` (useful e.g.: after clone). 24 | `scope` | Scope of installation or uninstallation, see scopes. 25 | 26 | 27 | -------------------------------------------------------------------------------- /man/use_loader_framework7.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loaders.R 3 | \name{use_loader_framework7} 4 | \alias{use_loader_framework7} 5 | \title{Use Framework7 Loader} 6 | \usage{ 7 | use_loader_framework7(test = "\\\\.(f7).(html|js|jsx)$") 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | } 12 | \description{ 13 | Adds the \href{https://www.npmjs.com/package/framework7-loader}{Framework7 loader}. 14 | } 15 | \details{ 16 | Excludes \code{node_modules} by default. If used outside \code{scaffold_golem} 17 | context, installs the babel-loader in the dev scope. 18 | } 19 | -------------------------------------------------------------------------------- /docs/references/use_loader_framework7.md: -------------------------------------------------------------------------------- 1 | # `use_loader_framework7` 2 | 3 | Use Framework7 Loader 4 | 5 | 6 | ## Description 7 | 8 | Adds the [Framework7 loader](https://www.npmjs.com/package/framework7-loader) . 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | use_loader_framework7(test = "\\.(f7).(html|js|jsx)$") 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `test` | Test regular expression test which files should be transformed by the loader. 23 | 24 | 25 | ## Details 26 | 27 | Excludes `node_modules` by default. If used outside `scaffold_golem` 28 | context, installs the babel-loader in the dev scope. 29 | 30 | 31 | -------------------------------------------------------------------------------- /R/lit.R: -------------------------------------------------------------------------------- 1 | #' Lit 2 | #' 3 | #' Use [Lit](https://lit.dev) in your project. 4 | #' 5 | #' @param ts Whether to use TypeScript (recommended). 6 | #' 7 | #' @export 8 | ease_lit <- function(ts = FALSE) { 9 | engine_install("lit", scope = "prod") 10 | 11 | if (!ts) { 12 | return(invisible()) 13 | } 14 | 15 | # if the ts config file is not found 16 | # it likely means the loader is not in place 17 | if (!fs::file_exists("tsconfig.json")) { 18 | use_loader_ts() 19 | } 20 | 21 | engine_install("typescript", scope = "dev") 22 | 23 | # we use a different config file 24 | fs::file_copy( 25 | pkg_file("lit/config.json"), 26 | "tsconfig.json", 27 | overwrite = TRUE 28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /docs/references/types.md: -------------------------------------------------------------------------------- 1 | # `types` 2 | 3 | Install Types 4 | 5 | 6 | ## Description 7 | 8 | Install TypeScript types from npm. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | ts_get_types(..., versions = NULL) 15 | ts_get_type(type, version = NULL) 16 | ``` 17 | 18 | 19 | ## Arguments 20 | 21 | Argument |Description 22 | ------------- |---------------- 23 | `...` | Types to install. 24 | `versions, version` | Corresponding versions of types passed to `...` , if `NULL` the latest version is installed. 25 | `type` | Name of types @types/* to install. 26 | 27 | 28 | ## Examples 29 | 30 | ```r 31 | ts_get_type("jquery") 32 | ts_get_types("@types/jquery") 33 | ``` 34 | 35 | 36 | -------------------------------------------------------------------------------- /man/yarn_global.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/yarn.R 3 | \name{yarn_global} 4 | \alias{yarn_global} 5 | \alias{engine_yarn_install} 6 | \alias{engine_yarn_set} 7 | \title{Yarn Global} 8 | \usage{ 9 | engine_yarn_install() 10 | 11 | engine_yarn_set(version = "latest") 12 | } 13 | \arguments{ 14 | \item{version}{Version to set yarn} 15 | } 16 | \description{ 17 | Installs or manage yarn \emph{globally}. 18 | } 19 | \section{Functions}{ 20 | 21 | \itemize{ 22 | \item \code{engine_yarn_install}: Installs yarn globally. 23 | \item \code{engine_yarn_set}: Set yarn function. 24 | } 25 | } 26 | 27 | \examples{ 28 | \dontrun{ 29 | engine_yarn_install() 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /R/extension-utils.R: -------------------------------------------------------------------------------- 1 | #' Extension R Files 2 | #' 3 | #' @param name Name of widget as passed from [scaffold_extension()]. 4 | #' 5 | #' @details Creates `R/zzz.R` file if it does not already exist. 6 | #' 7 | #' @noRd 8 | #' @keywords internal 9 | ext_zzz_file <- function(name) { 10 | pkgname <- get_pkg_name() 11 | 12 | if (fs::file_exists("R/zzz.R")) { 13 | cli::cli_alert_info("{.file R/zzz.R} already exists: assumes path to shiny resource already exists") 14 | return() 15 | } 16 | 17 | # create file 18 | zzz_in <- pkg_file("extension/R/zzz.R") 19 | zzz <- readLines(zzz_in) 20 | zzz <- gsub("#pkgname#", pkgname, zzz) 21 | writeLines(zzz, "R/zzz.R") 22 | cli::cli_alert_success("Added path to shiny resource") 23 | } 24 | -------------------------------------------------------------------------------- /R/npx.R: -------------------------------------------------------------------------------- 1 | #' NPX 2 | #' 3 | #' Run an `npx` command. 4 | #' 5 | #' @param ... Arguments to pass to npx 6 | #' 7 | #' @export 8 | npx <- function(...) { 9 | npx <- npx_find() 10 | system2(npx, args = paste0(..., collapse = " "), stdout = TRUE) 11 | } 12 | 13 | #' NPX Find 14 | #' 15 | #' Find the NPX executable. 16 | #' 17 | #' @noRd 18 | #' @keywords internal 19 | npx_find <- function() { 20 | # which on UNIX and where on Windows 21 | cmd <- which_or_where() 22 | path <- tryCatch( 23 | system2(cmd, "npx", stdout = TRUE), 24 | error = function(e) e 25 | ) 26 | 27 | if (inherits(path, "error")) { 28 | stop("Could not find path to `npx`", call. = FALSE) 29 | } 30 | 31 | # where may return multiple paths 32 | path[1] 33 | } 34 | -------------------------------------------------------------------------------- /man/add_plugin_clean.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plugins.R 3 | \name{add_plugin_clean} 4 | \alias{add_plugin_clean} 5 | \title{Clean Plugin} 6 | \usage{ 7 | add_plugin_clean(dry = FALSE, verbose = FALSE, clean = TRUE, protect = TRUE) 8 | } 9 | \arguments{ 10 | \item{dry}{Whether to simulate the removal of files.} 11 | 12 | \item{verbose}{Write Logs to the console.} 13 | 14 | \item{clean}{Whether to automatically remove all unused webpack assets on rebuild.} 15 | 16 | \item{protect}{Whether to not allow removal of current webpack assets.} 17 | } 18 | \description{ 19 | Add the \href{https://www.npmjs.com/package/clean-webpack-plugin}{clean-webpack-plugin} to 20 | clean the bundled files. 21 | } 22 | -------------------------------------------------------------------------------- /tests/testthat/test-ambiorix.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("Ambiorix Bare", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | # test bare 10 | pkg <- create_tmp_ambiorix() 11 | setwd(pkg) 12 | on.exit({ 13 | setwd(wd) 14 | delete_tmp_package(pkg) 15 | }) 16 | expect_output(scaffold_ambiorix(edit = FALSE)) 17 | expect_message(bundle()) 18 | }) 19 | 20 | test_that("Ambiorix Vue", { 21 | # keep working directory 22 | wd <- getwd() 23 | 24 | # test bare 25 | pkg <- create_tmp_ambiorix() 26 | setwd(pkg) 27 | on.exit({ 28 | setwd(wd) 29 | delete_tmp_package(pkg) 30 | }) 31 | expect_output(scaffold_ambiorix(vue = TRUE, edit = FALSE)) 32 | expect_message(bundle()) 33 | }) 34 | -------------------------------------------------------------------------------- /docs/references/add_plugin_clean.md: -------------------------------------------------------------------------------- 1 | # `add_plugin_clean` 2 | 3 | Clean Plugin 4 | 5 | 6 | ## Description 7 | 8 | Add the [clean-webpack-plugin](https://www.npmjs.com/package/clean-webpack-plugin) to 9 | clean the bundled files. 10 | 11 | 12 | ## Usage 13 | 14 | ```r 15 | add_plugin_clean(dry = FALSE, verbose = FALSE, clean = TRUE, protect = TRUE) 16 | ``` 17 | 18 | 19 | ## Arguments 20 | 21 | Argument |Description 22 | ------------- |---------------- 23 | `dry` | Whether to simulate the removal of files. 24 | `verbose` | Write Logs to the console. 25 | `clean` | Whether to automatically remove all unused webpack assets on rebuild. 26 | `protect` | Whether to not allow removal of current webpack assets. 27 | 28 | 29 | -------------------------------------------------------------------------------- /inst/templates/react/react_cdn.R: -------------------------------------------------------------------------------- 1 | #' Dependencies for React 2 | #' 3 | #' Includes React dependencies in a shiny application. 4 | #' 5 | #' @param version Version of React to use, if `NULL` uses the latest 6 | #' 7 | #' @keywords internal 8 | reactCDN <- function(version = 17){ 9 | unpkg <- "https://unpkg.com" 10 | 11 | version_string <- sprintf("@%d", version) 12 | 13 | react <- sprintf("%s/react%s/umd/react.production.min.js", unpkg, version_string) 14 | react_dom <- sprintf("%s/react-dom%s/umd/react-dom.production.min.js", unpkg, version_string) 15 | shiny::singleton( 16 | shiny::tags$head( 17 | shiny::tags$script(src = react, crossorigin = NA), 18 | shiny::tags$script(src = react_dom, crossorigin = NA) 19 | ) 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /tests/testthat/test-extension.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("Extension", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | # create package and 10 | pkg <- create_tmp_package() 11 | setwd(pkg) 12 | on.exit({ 13 | setwd(wd) 14 | delete_tmp_package(pkg) 15 | }) 16 | 17 | expect_error(scaffold_extension()) 18 | expect_output(scaffold_extension("ext", edit = FALSE)) 19 | expect_error(scaffold_extension("ext", edit = FALSE)) 20 | file.create("R/ext2.R") 21 | expect_output(scaffold_extension("ext2", edit = FALSE)) 22 | expect_message(bundle()) 23 | expect_message(use_loader_babel(use_eslint = TRUE)) 24 | expect_message(bundle()) 25 | 26 | # make library 27 | expect_message(make_library("lib")) 28 | }) 29 | -------------------------------------------------------------------------------- /man/use_loader_babel.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loaders.R 3 | \name{use_loader_babel} 4 | \alias{use_loader_babel} 5 | \title{Use babel Loader} 6 | \usage{ 7 | use_loader_babel(test = "\\\\.(js|jsx)$", use_eslint = FALSE) 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | 12 | \item{use_eslint}{Whether to also add the ESlint loader.} 13 | } 14 | \description{ 15 | Adds the loader for babel compiler to the loader configuration file. 16 | } 17 | \details{ 18 | The \code{use_elsint} argument is useful here as loaders have 19 | to be defined in the correct order or files might be checked after 20 | being processed by babel. 21 | 22 | Excludes \code{node_modules} by default. 23 | } 24 | -------------------------------------------------------------------------------- /docs/references/use_loader_babel.md: -------------------------------------------------------------------------------- 1 | # `use_loader_babel` 2 | 3 | Use babel Loader 4 | 5 | 6 | ## Description 7 | 8 | Adds the loader for babel compiler to the loader configuration file. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | use_loader_babel(test = "\\.(js|jsx)$", use_eslint = FALSE) 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `test` | Test regular expression test which files should be transformed by the loader. 23 | `use_eslint` | Whether to also add the ESlint loader. 24 | 25 | 26 | ## Details 27 | 28 | The `use_elsint` argument is useful here as loaders have 29 | to be defined in the correct order or files might be checked after 30 | being processed by babel. 31 | 32 | Excludes `node_modules` by default. 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/references/add_plugin_html.md: -------------------------------------------------------------------------------- 1 | # `add_plugin_html` 2 | 3 | HTML Plugin 4 | 5 | 6 | ## Description 7 | 8 | Add the [html-webpack-plugin](https://webpack.js.org/plugins/html-webpack-plugin/) to 9 | the configuration to generate HTML with webpack, used in packer to generate the UI of 10 | a golem app with webpack. 11 | 12 | 13 | ## Usage 14 | 15 | ```r 16 | add_plugin_html(use_pug = FALSE, output_path = "../index.html") 17 | ``` 18 | 19 | 20 | ## Arguments 21 | 22 | Argument |Description 23 | ------------- |---------------- 24 | `use_pug` | Set to `TRUE` to use the [pug engine](https://pugjs.org/) . 25 | `output_path` | Path to the generated html file, defaults to `../index.html` as is ideal for golem. Note that this path is relative to your output directory specified in your `webpack.common.js` file. 26 | 27 | 28 | -------------------------------------------------------------------------------- /tests/testthat/test-check.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("Checks", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | expect_error(scaffold_leprechaun(edit = FALSE)) 10 | 11 | # test bare 12 | pkg <- create_tmp_package() 13 | setwd(pkg) 14 | expect_output(scaffold_input("test", edit = FALSE)) 15 | bundle_dev() 16 | on.exit({ 17 | setwd(wd) 18 | delete_tmp_package(pkg) 19 | }) 20 | 21 | expect_message(checks()) 22 | expect_error(are_minified()) 23 | expect_message(bundle_dev()) 24 | are_minified("inst/packer") 25 | expect_message(put_precommit_hook()) 26 | 27 | # git 28 | usethis::use_git() 29 | expect_message(put_precommit_hook()) 30 | expect_message(put_precommit_hook()) 31 | 32 | # rprofile 33 | file.create(".Rprofile") 34 | put_rprofile_adapt() 35 | }) 36 | -------------------------------------------------------------------------------- /man/add_plugin_html.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plugins.R 3 | \name{add_plugin_html} 4 | \alias{add_plugin_html} 5 | \title{HTML Plugin} 6 | \usage{ 7 | add_plugin_html(use_pug = FALSE, output_path = "../index.html") 8 | } 9 | \arguments{ 10 | \item{use_pug}{Set to \code{TRUE} to use the \href{https://pugjs.org/}{pug engine}.} 11 | 12 | \item{output_path}{Path to the generated html file, defaults to \code{../index.html} as 13 | is ideal for golem. Note that this path is relative to your output directory specified 14 | in your \code{webpack.common.js} file.} 15 | } 16 | \description{ 17 | Add the \href{https://webpack.js.org/plugins/html-webpack-plugin/}{html-webpack-plugin} to 18 | the configuration to generate HTML with webpack, used in packer to generate the UI of 19 | a golem app with webpack. 20 | } 21 | -------------------------------------------------------------------------------- /man/use_loader_vue.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/loaders.R 3 | \name{use_loader_vue} 4 | \alias{use_loader_vue} 5 | \title{Use Vue Loader} 6 | \usage{ 7 | use_loader_vue(test = "\\\\.vue$") 8 | } 9 | \arguments{ 10 | \item{test}{Test regular expression test which files should be transformed by the loader.} 11 | } 12 | \description{ 13 | Adds the Vue loader to the loader configuration file. 14 | } 15 | \details{ 16 | Every time a new version of Vue is released, a corresponding version of \code{vue-template-compiler} 17 | is released together. The compiler's version must be in sync with the base Vue package so that \code{vue-loader} 18 | produces code that is compatible with the runtime. This means every time you upgrade Vue in your project, 19 | you should upgrade \code{vue-template-compiler} to match it as well. 20 | } 21 | -------------------------------------------------------------------------------- /docs/references/engine.md: -------------------------------------------------------------------------------- 1 | # `engine` 2 | 3 | Set Engine 4 | 5 | 6 | ## Description 7 | 8 | Defines the engine to use with packer. 9 | One can pick between npm and yarn. 10 | 11 | 12 | ## Usage 13 | 14 | ```r 15 | engine_set(engine = c("npm", "yarn")) 16 | engine_get() 17 | engine_adapt() 18 | engine_which() 19 | ``` 20 | 21 | 22 | ## Arguments 23 | 24 | Argument |Description 25 | ------------- |---------------- 26 | `engine` | The engine to use, npm or yarn. 27 | 28 | 29 | ## Details 30 | 31 | Generally one would want to define 32 | the engine prior to scaffolding. 33 | For convenience you can instead set the environment 34 | variable `PACKER_ENGINE` to your engine of choice. 35 | Packer reads this variable, all subsequent use 36 | of packer will use the defined engine. 37 | You can use the function `usethis::edit_r_environ` 38 | to do so. 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/references/use_loader_vue.md: -------------------------------------------------------------------------------- 1 | # `use_loader_vue` 2 | 3 | Use Vue Loader 4 | 5 | 6 | ## Description 7 | 8 | Adds the Vue loader to the loader configuration file. 9 | 10 | 11 | ## Usage 12 | 13 | ```r 14 | use_loader_vue(test = "\\.vue$") 15 | ``` 16 | 17 | 18 | ## Arguments 19 | 20 | Argument |Description 21 | ------------- |---------------- 22 | `test` | Test regular expression test which files should be transformed by the loader. 23 | 24 | 25 | ## Details 26 | 27 | Every time a new version of Vue is released, a corresponding version of `vue-template-compiler` 28 | is released together. The compiler's version must be in sync with the base Vue package so that `vue-loader` 29 | produces code that is compatible with the runtime. This means every time you upgrade Vue in your project, 30 | you should upgrade `vue-template-compiler` to match it as well. 31 | 32 | 33 | -------------------------------------------------------------------------------- /man/yarn_install.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/yarn.R 3 | \name{yarn_install} 4 | \alias{yarn_install} 5 | \alias{yarn_add} 6 | \alias{yarn_remove} 7 | \title{Install and Uninstall yarn Packages} 8 | \usage{ 9 | yarn_add(..., scope = c("dev", "prod")) 10 | 11 | yarn_install() 12 | 13 | yarn_remove(..., scope = c("dev", "prod")) 14 | } 15 | \arguments{ 16 | \item{...}{Packages to install or uninstall.} 17 | 18 | \item{scope}{Scope of installation or uninstallation, see scopes.} 19 | } 20 | \description{ 21 | Install and uninstall yarn packages. 22 | } 23 | \section{Scopes}{ 24 | 25 | \itemize{ 26 | \item \code{prod} - Add/remove packages for project with no flag 27 | \item \code{dev} - Installs/Uninstalls dev packages for project with \code{--dev} 28 | } 29 | } 30 | 31 | \examples{ 32 | \dontrun{ 33 | yarn_add("browserify") 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /man/apply_vue.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vue.R 3 | \name{apply_vue} 4 | \alias{apply_vue} 5 | \title{Apply Vue} 6 | \usage{ 7 | apply_vue(use_cdn = TRUE) 8 | } 9 | \arguments{ 10 | \item{use_cdn}{Whether to use the CDN for \code{vue} (recommended). 11 | This means later importing the dependencies in the shiny UI using \code{vueCDN()}, 12 | this function will be created in a \code{R/vue_cdn.R}. 13 | The correct instructions are printed to the console by the application.} 14 | } 15 | \description{ 16 | Apply Vue to a project, adds the relevant (babel) loader, installs dependencies, 17 | and creates, or updates, or replaces the \code{srcjs/index.js} file. 18 | } 19 | \details{ 20 | After running this function and bundling the JavaScript remember to place 21 | \verb{div(id = "app"), tags$script(src = "www/index.js")} at the bottom of your shiny UI. 22 | } 23 | -------------------------------------------------------------------------------- /docs/references/apply_vue.md: -------------------------------------------------------------------------------- 1 | # `apply_vue` 2 | 3 | Apply Vue 4 | 5 | 6 | ## Description 7 | 8 | Apply Vue to a project, adds the relevant (babel) loader, installs dependencies, 9 | and creates, or updates, or replaces the `srcjs/index.js` file. 10 | 11 | 12 | ## Usage 13 | 14 | ```r 15 | apply_vue(use_cdn = TRUE) 16 | ``` 17 | 18 | 19 | ## Arguments 20 | 21 | Argument |Description 22 | ------------- |---------------- 23 | `use_cdn` | Whether to use the CDN for `vue` (recommended). This means later importing the dependencies in the shiny UI using `vueCDN()` , this function will be created in a `R/vue_cdn.R` . The correct instructions are printed to the console by the application. 24 | 25 | 26 | ## Details 27 | 28 | After running this function and bundling the JavaScript remember to place 29 | div(id = "app"), tags$script(src = "www/index.js") at the bottom of your shiny UI. 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/testthat/test-rmd.R: -------------------------------------------------------------------------------- 1 | source("../fns.R") 2 | 3 | skip_on_cran() 4 | 5 | test_that("Rmd", { 6 | # keep working directory 7 | wd <- getwd() 8 | 9 | # test bare 10 | pkg <- create_tmp_project() 11 | setwd(pkg) 12 | expect_output(scaffold_rmd(edit = FALSE)) 13 | expect_message(use_loader_file()) 14 | expect_message(bundle()) 15 | setwd(wd) 16 | delete_tmp_package(pkg) 17 | 18 | # test react 19 | pkg <- create_tmp_project() 20 | setwd(pkg) 21 | expect_output(scaffold_rmd(react = TRUE, edit = FALSE)) 22 | expect_message(use_loader_coffee()) 23 | expect_message(bundle()) 24 | setwd(wd) 25 | delete_tmp_package(pkg) 26 | 27 | # test vue 28 | pkg <- create_tmp_project() 29 | setwd(pkg) 30 | expect_output(scaffold_rmd(vue = TRUE, edit = FALSE)) 31 | expect_message(use_loader_sass()) 32 | expect_message(bundle()) 33 | setwd(wd) 34 | delete_tmp_package(pkg) 35 | }) 36 | -------------------------------------------------------------------------------- /inst/lit/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2019", 4 | "module": "es2020", 5 | "lib": ["es2020", "DOM", "DOM.Iterable"], 6 | "declaration": true, 7 | "declarationMap": true, 8 | "sourceMap": true, 9 | "inlineSources": true, 10 | "outDir": "./", 11 | "rootDir": "./src", 12 | "strict": true, 13 | "noUnusedLocals": true, 14 | "noUnusedParameters": true, 15 | "noImplicitReturns": true, 16 | "noFallthroughCasesInSwitch": true, 17 | "noImplicitAny": true, 18 | "noImplicitThis": true, 19 | "moduleResolution": "node", 20 | "allowSyntheticDefaultImports": true, 21 | "experimentalDecorators": true, 22 | "forceConsistentCasingInFileNames": true, 23 | "plugins": [ 24 | { 25 | "name": "ts-lit-plugin", 26 | "strict": true 27 | } 28 | ] 29 | }, 30 | "include": ["srcjs/**/*.ts"], 31 | "exclude": [] 32 | } 33 | -------------------------------------------------------------------------------- /inst/templates/framework7/components/app.f7.jsx: -------------------------------------------------------------------------------- 1 | export default (props, { $f7 }) => { 2 | const title = 'Hello World'; 3 | 4 | return () => ( 5 |PACKER_ENGINE to
35 | yarn
36 | scaffold_rmd is not rooted in a package and instead from a project.
16 |
4 |
5 |
6 | 
7 | 
8 | [](https://github.com/JohnCoene/packer/actions)
9 | [](https://app.codecov.io/gh/JohnCoene/packer?branch=master)
10 |
11 |
12 | [Website](https://packer.john-coene.com/) | [Installation](https://packer.john-coene.com/#/guide/installation) | [Get Started](https://packer.john-coene.com/#/guide/getting-started) | [Book](https://book.javascript-for-r.com/webpack-intro.html)
13 |
14 | ## An opinionated framework for using JavaScript with R
15 |
16 |