Skip to content

Commit 40c1191

Browse files
committed
Add section with IDE instructions to run app
1 parent 40a5245 commit 40c1191

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

README.Rmd

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Server and UI modules can be found in `R/`, configuration in `inst/golem-config.
4747

4848
Run the app locally on your machine to test that your changes work as expected.
4949

50+
#### Setup
51+
5052
First, install the required packages listed in the DESCRIPTION with `pak::local_install_deps(dependencies = TRUE)`.
5153

5254
Then add an `.Renviron` file to the project root that contains the required environment variables.
@@ -65,19 +67,32 @@ git worktree add inputs_selection_app inputs_selection_app
6567
The first argument is the name of the folder in which to put the branch content.
6668
If you want a development version of the inputs selection app, you can specify the branch name as the second of the arguments to `git worktree add`.
6769

68-
To run the app from RStudio, start up the selection app by opening the `dev/watch.R` script, go to the 'Background Jobs' tab of the console pane and click the 'Start Background Job' button.
69-
In the 'Run Script as Background Job' dialog box select the project root as the 'Working Directory', then hit 'Start'.
70-
When ready, the app will tell you to visit `http://127.0.0.1:9081/` in your browser.
71-
72-
Note that your selections in the app remain local to you and the resulting json file of parameters for your scenario will live in your local `params/development/` directory.
73-
These scenarios will be selectable and editable in future from your locally-run inputs selection app.
74-
7570
If you need to remove the selection-app folder at any point, you can terminate the background job (if running) and in the terminal run:
7671

7772
```
7873
git worktree remove inputs_selection_app
7974
```
8075

76+
#### Run the app
77+
78+
Once setup, we can run the app.
79+
This is done by launching a background Shiny app and then watching the files for changes, which causes an auto-reload.
80+
The method for doing this depends on your IDE.
81+
82+
In RStudio:
83+
84+
1. Open the `dev/watch.R` script and go to the 'Background Jobs' tab of the console pane and click the 'Start Background Job' button.
85+
2. Click 'Start' after checking that the 'R Script' path is pre-populated with the path to `watch.R` (otherwise select it yourself).
86+
3. When ready, a message will tell you to visit `http://127.0.0.1:9081/` in your browser.
87+
88+
In Positron: run `source('dev/watch.R')` and click the link to the URL when complete.
89+
90+
In VS Code: open the command palette (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>), search for 'Tasks: Run Task', then select 'R: Run App (watch)' and finally click the link to the URL when complete.
91+
92+
Making selections in the app will cause values to be written to a local json file, which will live in your local `params/development/` directory.
93+
These scenarios will be selectable and editable in future from your locally-run inputs selection app.
94+
They will not be available from the deployed app.
95+
8196
### Test in dev
8297

8398
During pre-release QA we test both apps on the server.

0 commit comments

Comments
 (0)