From 6e6e04cd27c5f0ce7dc3fc82c9924bc4f7682667 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 14 Oct 2024 15:54:58 +0200 Subject: [PATCH 1/2] Make vite tool shed client proxy configurable --- lib/tool_shed/webapp/frontend/README.md | 21 ++++++++++++++++++++ lib/tool_shed/webapp/frontend/vite.config.ts | 8 +++----- 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 lib/tool_shed/webapp/frontend/README.md diff --git a/lib/tool_shed/webapp/frontend/README.md b/lib/tool_shed/webapp/frontend/README.md new file mode 100644 index 000000000000..afe33c01193f --- /dev/null +++ b/lib/tool_shed/webapp/frontend/README.md @@ -0,0 +1,21 @@ +# Tool Shed 2.0 client + +The following assumes `npx` is installed, but equivalent npm commands should work too. + +To start a HMR dev server run + +```shell +npx vite dev +``` + +Note that you will need to start the Tool Shed backend from the galaxy root directory: + +```shell +TOOL_SHED_API_VERSION=v2 ./run_tool_shed.sh +``` + +If you want to target an external V2 tool shed API run + +```shell +TOOL_SHED_URL=https://testtoolshed.g2.bx.psu.edu CHANGE_ORIGIN=true npx vite dev +``` diff --git a/lib/tool_shed/webapp/frontend/vite.config.ts b/lib/tool_shed/webapp/frontend/vite.config.ts index 48026e84d4ec..e45d75d4e61a 100644 --- a/lib/tool_shed/webapp/frontend/vite.config.ts +++ b/lib/tool_shed/webapp/frontend/vite.config.ts @@ -23,11 +23,9 @@ export default defineConfig({ server: { proxy: { "/api": { - // This is the URL of the backend server - // The address is the default when running `make run_test_backend` - target: "http://127.0.0.1:9009/", - changeOrigin: true, - secure: false, + target: process.env.TOOL_SHED_URL || "http://127.0.0.1:9009", + changeOrigin: process.env.CHANGE_ORIGIN ? !process.env.CHANGE_ORIGIN : true, + secure: !process.env.CHANGE_ORIGIN, }, }, }, From 3f2b2ba2941a52526e7261c13e086801304153fd Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 14 Oct 2024 17:16:24 +0200 Subject: [PATCH 2/2] Use dev-all and yarn in instructions --- lib/tool_shed/webapp/frontend/README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/tool_shed/webapp/frontend/README.md b/lib/tool_shed/webapp/frontend/README.md index afe33c01193f..b164ce1dcb18 100644 --- a/lib/tool_shed/webapp/frontend/README.md +++ b/lib/tool_shed/webapp/frontend/README.md @@ -1,21 +1,23 @@ # Tool Shed 2.0 client -The following assumes `npx` is installed, but equivalent npm commands should work too. - -To start a HMR dev server run +You will need to start the Tool Shed backend from the galaxy root directory. +This is required if you want to develop against a local tool shed, and if you +plan to make changes to the graphql queries if you want to target a remote tool shed. ```shell -npx vite dev +TOOL_SHED_API_VERSION=v2 ./run_tool_shed.sh ``` -Note that you will need to start the Tool Shed backend from the galaxy root directory: +Start the HMR dev server **and** the graphql dev server ```shell -TOOL_SHED_API_VERSION=v2 ./run_tool_shed.sh +yarn run dev-all ``` If you want to target an external V2 tool shed API run ```shell -TOOL_SHED_URL=https://testtoolshed.g2.bx.psu.edu CHANGE_ORIGIN=true npx vite dev +TOOL_SHED_URL=https://testtoolshed.g2.bx.psu.edu CHANGE_ORIGIN=true yarn vite dev ``` + +Note that you still need a local backend to generate the graphql schema.