We’re going to primarily use RStudio in this workshop. Please make sure you have a recent version of RStudio installed. Version 1.2 or later will work.
There is a companion R package for this workshop called
js4shiny. To install it, you need to the devtools package installed on your
system.
Then, you can install the js4shiny package with the
following code. If you run into any issues, don’t worry: we can diagnose
them together at the workshop.
devtools::install_git(
url = "https://git.garrickadenbuie.com/js4shiny/js4shiny.git",
dependencies = TRUE
)The recommended way to install node
and npm is to use a Node Version Manager. nvm is a bash
script for macOS or Linux systems and nvm-windows
is a similar program for Windows users. The node version manager is used
to manage the installation and activation of multiple versions of
node on the same system. Follow the
instructions on the npm webpage to install
node and npm (they come together) and confirm
that your installation is working.
Alternatively, you can also use a Node.js installer to install the latest LTS version of Node.js from https://nodejs.org/en/download/.
Check that the installation worked by running
node -v
## v13.2.0
npm -v
## 6.13.1
These are the versions currently installed on my system and the version on your system may not perfectly match the version you see above. If you already have a previous, older version of Node installed, it’s probably a good idea to take this opportunity to upgrade.
[standardjs] is a style guide, code linter and beautifier in one. standard is a commandline tool for the [JavaScript Standard Style][standardjs] that automatically formats JavaScript code in a consistent manner and points out common style and programmer errors.
There are a number of JavaScript tools for this task — and standard is built on ESLint and Prettier — but standard is easier to install and configure and uses a code style that will be familiar to R developers.
Once you’ve installed node and npm, you can install standard by running
Once installed, you can use the Lint File or Selection RStudio addin provided by the js4shiny package to automatically format your JavaScript.