diff --git a/.gitignore b/.gitignore index 618c5688..e6a4d2e8 100644 --- a/.gitignore +++ b/.gitignore @@ -86,6 +86,9 @@ stylecop.* *.dbmdl Generated_Code #added for RIA/Silverlight projects dist/ +dist_local/ +/scripts/viewer/index.html +/scripts/guides/default/ userfiles # Backup & report files from converting an old project file to a newer diff --git a/README.md b/README.md index ede2cd97..c0b6187a 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,27 @@ run the command below in a terminal This will build a zip in the parent folder of the cloned repo with the naming patern a2j-viewer_{MAJVER}.{MINVER}.{PATCH}_{YYYY}-{MM}-{DD}.zip +## Local Development & Testing + +If you need to modify the A2J Viewer source or test it within a local environment, follow the steps below. + +### 1. Configuration of Interview Files +Before running the local development server, ensure your interview/guide files are placed in the following directory: +`scripts/guides/default/` + +> **Note:** If this directory is empty, the viewer will fallback to the default sample guides located in the `demo` folder. + +### 2. Launching the Development Server +To initiate the local build process and start the web server, execute the following command in your terminal: + +```bash +npm run dev +``` + +### 3. Workflow Limitations (No HMR) +Please be advised that Hot Module Replacement (HMR) is currently *not supported*. +To reflect any changes made to the local source files (JS, LESS, or HTML), you must stop the current process and re-run the `npm run dev` command to rebuild the assets. + ## Upgrading 1.) backup your old viewer and Guided Interviews diff --git a/demo/build.viewer.html.js b/demo/build.viewer.html.js index e5d62a71..8071bbf4 100644 --- a/demo/build.viewer.html.js +++ b/demo/build.viewer.html.js @@ -2,11 +2,12 @@ const fs = require('fs') const path = require('path') -const buildViewerHtml = function () { +const buildViewerHtml = function (isLocal = false) { const version = Date.now() - const html = template(version) + const templatePath = isLocal ? '.' : '..' + const html = template(version, templatePath) - function template (version) { + function template (version, templatePath) { return `