## Getting Setup ### RStudio We're going to primarily use [RStudio](https://rstudio.com/products/rstudio/#rstudio-desktop) in this workshop. Please make sure you have a recent version of RStudio installed. Version 1.2 or later will work. ### R Setup There is a companion R package for this workshop called `js4shiny`. To install it, you need to the [devtools](https://devtools.r-lib.org) package installed on your system. ```r install.packages("devtools") ``` 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. ```r devtools::install_git("https://git.garrickadenbuie.com/js4shiny/js4shiny.git") ``` ### Node and npm The recommended way to install [node][nodejs] and [npm] is to use a [Node Version Manager][nvm]. [`nvm`][nvm] is a bash script for macOS or Linux systems and [`nvm-windows`][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][npm-install] 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 . 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. [nodejs-download]: https://nodejs.org/en/download/ [nodejs]: https://nodejs.org/ [nvm]: https://github.com/nvm-sh/nvm [nvm-windows]: https://github.com/coreybutler/nvm-windows [npm]: https://www.npmjs.com/ [npm-install]: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm#using-a-node-version-manager-to-install-nodejs-and-npm ### JavaScript Standard Style [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](#node-and-npm), you can install standard by running ```bash npm install standard --global ``` Once installed, you can use the _Lint File or Selection_ RStudio addin provided by the [js4shiny](#r-setup) package to automatically format your JavaScript. ![The _Lint File or Selection_ RStudio adding provided by the _js4shiny_ package.](img/js4shiny-pkg-lint-standard.png)