Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ashbaldry/designer
Browse files Browse the repository at this point in the history
  • Loading branch information
ashbaldry committed Aug 20, 2023
2 parents 05c1230 + 0f889ee commit 04067d5
Show file tree
Hide file tree
Showing 122 changed files with 46,977 additions and 1,876 deletions.
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^renv$
^renv\.lock$
^.*\.Rproj$
^\.Rproj\.user$
^dev$
Expand All @@ -19,3 +21,5 @@ _\.new\.png$
^\.lintr$
^shiny_bookmarks$
^CRAN-SUBMISSION$
^\.dockerignore$
^manifest\.json$
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.RData
.Rhistory
.git
.gitignore
manifest.json
rsconnect/
.Rproj.user
40 changes: 23 additions & 17 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
Expand All @@ -10,34 +10,40 @@ name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ubuntu-latest
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: rcmdcheck

- uses: r-lib/actions/check-r-package@v1

- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
42 changes: 42 additions & 0 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish Docker image

on:
push:
branches: dev
release:
types: published

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
if: ${{ github.event_name == 'push' }}
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/designer:latest

- name: Build and push
if: ${{ github.event_name == 'release' }}
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/designer:${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
18 changes: 18 additions & 0 deletions .github/workflows/jest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Run JS Tests (Jest)
on:
push:
branches: [dev, main, master]
pull_request:
branches: [dev, main, master]
defaults:
run:
working-directory: srcjs
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: npm install
- name: Run tests
run: npm run test
32 changes: 32 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [dev, main, master]
pull_request:
branches: [dev, main, master]

name: lint

jobs:
lint:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
31 changes: 20 additions & 11 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
Expand All @@ -12,24 +12,33 @@ name: pkgdown
jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: pkgdown
extra-packages: any::pkgdown, local::.
needs: website

- name: Deploy package
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
clean: false
branch: gh-pages
folder: docs
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: covr

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ docs
srcjs/node_modules
shiny_bookmarks
cran-comments.md
CRAN-SUBMISSION
srcjs/coverage
1 change: 1 addition & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
linters: linters_with_defaults(
cyclocomp_linter = NULL,
line_length_linter(120),
implicit_integer_linter(),
object_name_linter(c("snake_case", "camelCase", "CamelCase", "SNAKE_CASE", "symbols")),
Expand Down
47 changes: 25 additions & 22 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
Package: designer
Title: 'Shiny' UI Prototype Builder
Version: 0.2.0
Version: 0.3.0
Authors@R: c(
person('Ashley', 'Baldry', email = 'arbaldry91@gmail.com', role = c('cre', 'aut')),
person('Sam', 'Parmar', email = 'parmartsam@gmail.com', role = 'ctb'))
Description: A 'shiny' application that enables the user to create a prototype UI,
being able to drag and drop UI components before being able to save or download the equivalent R code.
URL: https://github.com/ashbaldry/designer,
https://ashbaldry.github.io/designer/
BugReports: https://github.com/ashbaldry/designer/issues
person("Ashley", "Baldry", , "arbaldry91@gmail.com", role = c("cre", "aut")),
person("Sam", "Parmar", , "parmartsam@gmail.com", role = "ctb")
)
Description: A 'shiny' application that enables the user to create a
prototype UI, being able to drag and drop UI components before being
able to save or download the equivalent R code.
License: MIT + file LICENSE
Language: en-GB
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
Config/testthat/edition: 3
VignetteBuilder: knitr
URL: https://ashbaldry.github.io/designer/,
https://ashbaldry.shinyapps.io/designer/
BugReports: https://github.com/ashbaldry/designer/issues
Imports:
bslib,
bs4Dash,
bslib,
cicerone,
config (>= 0.3.1),
fontawesome,
golem (>= 0.3.1),
htmltools,
shiny (>= 1.7.1),
jsonlite,
rappdirs,
shinipsum,
shiny (>= 1.7.1),
shinyscreenshot
Suggests:
covr,
testthat (>= 3.0.0),
shinytest2,
globals,
Suggests:
chromote,
knitr,
lintr,
rmarkdown
rmarkdown,
shinytest2,
testthat (>= 3.0.0)
VignetteBuilder:
knitr
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-GB
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
32 changes: 14 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
FROM rocker/r-ver:4.1.3
RUN apt-get update && apt-get install -y git-core libcurl4-openssl-dev libgit2-dev libicu-dev libssl-dev libxml2-dev make pandoc pandoc-citeproc zlib1g-dev && rm -rf /var/lib/apt/lists/*
RUN echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl", Ncpus = 4)' >> /usr/local/lib/R/etc/Rprofile.site
FROM rocker/verse:4.2.2
RUN apt-get update && apt-get install -y git-core libcurl4-openssl-dev libicu-dev libssl-dev libxml2-dev make pandoc zlib1g-dev && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/local/lib/R/etc/ /usr/lib/R/etc/
RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" | tee /usr/local/lib/R/etc/Rprofile.site | tee /usr/lib/R/etc/Rprofile.site
RUN R -e 'install.packages("remotes")'
RUN Rscript -e 'remotes::install_version("knitr", upgrade = "never", version = "1.39")'
RUN Rscript -e 'remotes::install_version("jsonlite", upgrade = "never", version = "1.8.0")'
RUN Rscript -e 'remotes::install_version("htmltools", upgrade = "never", version = "0.5.2")'
RUN Rscript -e 'remotes::install_version("bslib", upgrade = "never", version = "0.3.1")'
RUN Rscript -e 'remotes::install_version("fontawesome", upgrade = "never", version = "0.2.2")'
RUN Rscript -e 'remotes::install_version("shiny", upgrade = "never", version = "1.7.1")'
RUN Rscript -e 'remotes::install_version("rmarkdown", upgrade = "never", version = "2.14")'
RUN Rscript -e 'remotes::install_version("testthat", upgrade = "never", version = "3.1.4")'
RUN Rscript -e 'remotes::install_version("rappdirs", upgrade = "never", version = "0.3.3")'
RUN Rscript -e 'remotes::install_version("jsonlite", upgrade = "never", version = "1.8.4")'
RUN Rscript -e 'remotes::install_version("htmltools", upgrade = "never", version = "0.5.5")'
RUN Rscript -e 'remotes::install_version("fontawesome", upgrade = "never", version = "0.5.1")'
RUN Rscript -e 'remotes::install_version("bslib", upgrade = "never", version = "0.4.2")'
RUN Rscript -e 'remotes::install_version("shiny", upgrade = "never", version = "1.7.4")'
RUN Rscript -e 'remotes::install_version("config", upgrade = "never", version = "0.3.1")'
RUN Rscript -e 'remotes::install_version("globals", upgrade = "never", version = "0.14.0")'
RUN Rscript -e 'remotes::install_version("shinytest2", upgrade = "never", version = "0.1.0")'
RUN Rscript -e 'remotes::install_version("covr", upgrade = "never", version = "3.5.1")'
RUN Rscript -e 'remotes::install_version("cicerone", upgrade = "never", version = "1.0.4")'
RUN Rscript -e 'remotes::install_version("shinyscreenshot", upgrade = "never", version = "0.2.0")'
RUN Rscript -e 'remotes::install_version("shinipsum", upgrade = "never", version = "0.1.0")'
RUN Rscript -e 'remotes::install_version("bs4Dash", upgrade = "never", version = "2.1.0")'
RUN Rscript -e 'remotes::install_version("golem", upgrade = "never", version = "0.3.2")'
RUN Rscript -e 'remotes::install_version("golem", upgrade = "never", version = "0.4.0")'
RUN Rscript -e 'remotes::install_version("cicerone", upgrade = "never", version = "1.0.4")'
RUN Rscript -e 'remotes::install_version("bs4Dash", upgrade = "never", version = "2.2.1")'
RUN mkdir /build_zone
ADD . /build_zone
WORKDIR /build_zone
RUN R -e 'remotes::install_local(upgrade = "never")'
RUN rm -rf /build_zone
EXPOSE 80
CMD R -e 'options(shiny.port = 80, shiny.host = "0.0.0.0"); designer::designApp()'
CMD R -e "options('shiny.port' = 80, shiny.host = '0.0.0.0'); designer::designApp()"
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ export(designApp)
import(shiny)
importFrom(stats,setNames)
importFrom(utils,packageVersion)
importFrom(utils,read.csv)
importFrom(utils,write.csv)
importFrom(utils,write.table)
12 changes: 9 additions & 3 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
#'
#' @noRd
appServer <- function(input, output, session) {
setBookmarkExclude(c("remove_border", "remove_label", "remove_colour", "help", "css_style"))
setBookmarkExclude(c(
"app_name", "remove_border", "remove_label", "remove_colour", "help", "css_style", "screenshot"
))

observeEvent(input$help, guide$init()$start())

page_html <- CanvasModuleServer("canvas")
template_html <- reactiveVal()

SettingsModuleServer("settings", ui_code = page_html)
page_html <- CanvasModuleServer("canvas", selected_template = template_html)

selected_template <- SettingsModuleServer("settings", ui_code = page_html)

observeEvent(selected_template(), template_html(selected_template()))

SidebarModuleServer("sidebar")
}
Loading

0 comments on commit 04067d5

Please sign in to comment.