From 94425fca1ef3899b61748c82665a10ef11206290 Mon Sep 17 00:00:00 2001 From: Allison King Date: Tue, 24 May 2022 10:39:49 -0400 Subject: [PATCH] Add command for running frontend via nox (#689) * Add command for running frontend via nox * Fix linting and formatting * Update readme * Update clients/admin-ui/README.md Co-authored-by: Thomas Co-authored-by: Thomas --- CHANGELOG.md | 1 + clients/admin-ui/README.md | 7 +++++-- noxfiles/dev_nox.py | 10 ++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e45b8ea3b..662a1ca06e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ The types of changes are: * Replaced `make` with `nox` * Removed usage of `fideslang` module in favor of new [external package](https://github.com/ethyca/fideslang) shared across projects +* Added starting up the frontend server to `nox` ### Docs diff --git a/clients/admin-ui/README.md b/clients/admin-ui/README.md index 78c0ab9c68..728f8b5ad0 100644 --- a/clients/admin-ui/README.md +++ b/clients/admin-ui/README.md @@ -6,6 +6,9 @@ Admin UI for managing Fidesctl. 1. Run `nox -s api` in top-level `fides` directory 2. In a new shell, `cd` into `clients/admin-ui`, install via `npm install`, then run `npm run dev`. + + - Alternatively, can run `nox -s admin_ui` to do both the install and run steps. + 3. Navigate to `http://localhost:3000/`. ## Preparing for production @@ -13,7 +16,7 @@ Admin UI for managing Fidesctl. To view a production version of this site, including the backend: 1. Run `npm prod-export`. This will - 1. Export the static site to `out/` - 1. Copy the build from `out/` to the folder in the backend which will serve static assets at `/` + 1. Export the static site to `out/` + 1. Copy the build from `out/` to the folder in the backend which will serve static assets at `/` 1. Run `nox -s api` in the top-level `fides` directory. 1. Navigate to `http://localhost:8000` diff --git a/noxfiles/dev_nox.py b/noxfiles/dev_nox.py index 229deaf7a3..52de73e1e8 100644 --- a/noxfiles/dev_nox.py +++ b/noxfiles/dev_nox.py @@ -29,6 +29,16 @@ def api(session: nox.Session) -> None: session.run(*run_in_background, external=True) +@nox.session() +def admin_ui(session: nox.Session) -> None: + """Spin up the frontend server in development mode""" + npm_install = ("npm", "install") + npm_run = ("npm", "run", "dev") + with session.chdir("clients/admin-ui"): + session.run(*npm_install, external=True) + session.run(*npm_run, external=True) + + @nox.session() def cli(session: nox.Session) -> None: """Spin up a local development shell."""