Package 'leprechaun'

Title: Create Simple 'Shiny' Applications as Packages
Description: Code generator for robust dependency-free 'Shiny' applications in the form of packages. It includes numerous convenience functions to create modules, include utility functions to create common 'Bootstrap' elements, setup a project from the ground-up, and much more.
Authors: John Coene [aut, cre], Opifex [cph]
Maintainer: John Coene <[email protected]>
License: GPL (>= 2)
Version: 1.0.0
Built: 2024-12-08 06:55:56 UTC
Source: CRAN

Help Index


Add App

Description

Add the app.R required to run on RStudio Connect, RStudio server, and shinyapps.io.

Usage

add_app_file()

Value

Invisibly returns a boolean indicating whether the operation was successful.

Examples

## Not run: add_app_file()

Add module

Description

Add boilerplate for a module.

Usage

add_module(name)

Arguments

name

Name of the module. This is used to dynamically create the names of the functions and file.

Value

Called for side-effects, invisibly returns NULL.

Examples

## Not run: add_module("module_name")

Default Bootstrap Version

Description

Gets the default Bootstrap version based on the Shiny version installed. Shiny > 1.6 uses version 5 while earlier version use Bootstrap 4.

Usage

bootstrap_version()

Value

An integer denoting the Bootstrap version.

Examples

bootstrap_version()

Build

Description

Runs the various scripts that were created with setup functions.

Usage

build()

Value

Invisibly returns a boolean indicating whether the operation was successful.

Examples

## Not run: build()

Build Roclet

Description

Roclet to run build() when documenting. Meant to be used in DESCRIPTION, e.g.: Roxygen: list(markdown = TRUE, roclets = c("namespace", "collate", "rd", "leprechaun::build_roclet"))

Usage

build_roclet()

Value

An object of class roclet as expected by roxygen2.


Create Assets

Description

Create assets function and file assets.R.

Usage

create_assets(quiet = FALSE)

Arguments

quiet

Whether to print messages to the console.

Value

Invisibly returns NULL, called for side-effects.

Examples

## Not run: create_assets()

Create Input Handlers

Description

Create input handlers functions and file inputs-handlers.R.

Usage

create_input_handlers(quiet = FALSE)

Arguments

quiet

Whether to print messages to the console.

Examples

## Not run: create_input_handlers()

Create onLoad

Description

Create zzz.R file containing .onLoad function.

Usage

create_onload(quiet = FALSE)

Arguments

quiet

Whether to print messages to the console.

Examples

## Not run: create_onload()

Create Utils

Description

Create utils.R file containing helper functions.

Usage

create_utils(quiet = FALSE)

Arguments

quiet

Whether to print messages to the console.

Examples

## Not run: create_utils()

Scaffold Leprechaun

Description

Scaffolds a leprechaun project. This must be run from within a package and should only be run once per project.

Usage

scaffold(
  ui = c("navbarPage", "fluidPage"),
  bs_version = bootstrap_version(),
  overwrite = FALSE
)

Arguments

ui

Type of UI to use.

bs_version

Bootstrap version to use. If shiny > 1.6 is installed defaults to version 5, otherwise version 4.

overwrite

Whether to force overwrite all files. This is not recommended, make sure you have save and/or committed and checked that the files that will be overwritten can be before proceeding with this option.

Value

Invisibly return NULL, called for side-effects.

Examples

## Not run: scaffold()

Sitrep

Description

Run a check on the project, prints useful messages.

Usage

sitrep()

Value

Invisibly returns a boolean indicating whether the operation was successful.

Examples

## Not run: sitrep()

Update

Description

Update the scaffolded code to a new version of leprechaun.

Usage

update_scaffold(force = !interactive())

Arguments

force

Force update, ignore safety checks.

Details

This reads the content of the .leprechaun lock file and updates it too.

Value

Invisibly returns a boolean indicating whether the scaffold was updated.

Examples

## Not run: update_scaffold()

Config

Description

Setup a configuration file and helper functions.

Usage

use_config(quiet = FALSE)

Arguments

quiet

Whether to print messages.

Value

Invisibly returns a boolean indicating whether the operation was successful.


Endpoints

Description

Add utility functions to create and serve session-specific endpoints.

Usage

use_endpoints_utils(overwrite = FALSE, quiet = FALSE)

Arguments

overwrite

Whether to overwrite existing files.

quiet

Whether to print messages.

Value

Invisibly returns a boolean indicating whether the operation was successful.


Htmltools Utils

Description

Add htmltools utility functions, e.g.: shorthands to create columns.

Usage

use_html_utils(overwrite = FALSE, quiet = FALSE)

Arguments

overwrite

Whether to overwrite existing files.

quiet

Whether to print messages.

Value

Invisibly returns a boolean indicating whether the operation was successful.


JavaScript Utils

Description

Add utility JavaScript function, e.g.: to hide or show element in the DOM.

Usage

use_js_utils(overwrite = FALSE, quiet = FALSE)

Arguments

overwrite

Whether to overwrite existing files.

quiet

Whether to print messages.

Value

Invisibly returns a boolean indicating whether the operation was successful.

Note

This requires use_packer. Also, it will require using build.

Examples

## Not run: use_js_utils()

Packer

Description

Setup a packer script to easily bundle the JavaScipt.

Usage

use_packer(quiet = FALSE)

Arguments

quiet

Whether to print messages.

Value

Invisibly returns a boolean indicating whether the operation was successful.

Note

This requires a scaffold of packer already in place. Also, this will require using build.


Sass

Description

Setup basic structure for sass and helper script for bundling.

Usage

use_sass(quiet = FALSE)

Arguments

quiet

Whether to print messages.

Value

Invisibly returns a boolean indicating whether the operation was successful.

Note

This will require using build.