OpenWaterFoundation / owf-app-infomapper-ng

Open Water Foundation InfoMapper web application for menu-driven maps and visualizations, using Angular
GNU General Public License v3.0
1 stars 2 forks source link

Add run script that helps troubleshoot development environment #364

Open smalers opened 3 years ago

smalers commented 3 years ago

The InfoMapper development environment has gotten more complicated over time and there are also basic technical issues to check. This is particularly an issue for people like me that are using a repo clone to build distributions of the software. It might be different if a software installer were created for InfoMapper that guarantees a working environment, but this is not a high priority at the moment. The following are technical issues that can be checked:

  1. Is the Angular version correct?
  2. Are third party packages installed as necessary, via npm and copy from other repos.
  3. Any other troubleshooting, for example to respond to ng serve errors. See example below.
sam (master) infomapper $ ng serve

chunk {main} main.js, main.js.map (main) 1.88 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 699 bytes [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 7.67 MB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 1.44 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 339 kB [initial] [rendered]
Date: 2021-01-14T00:00:22.922Z - Hash: adf24fde49b3a0c76b95 - Time: 72312ms

ERROR in src/app/app.module.ts:31:43 - error TS2307: Cannot find module 'ng-test-lib' or its corresponding type declarations.

31 import { NgTestLibModule }           from 'ng-test-lib';
                                             ~~~~~~~~~~~~~
smalers commented 3 years ago

I added the build-util/ng-serve.sh script. This can be enhanced by Josh to help ensure that the environment is properly configured. I suggest that, in particular, any issues detected running 'ng serve' result in enhancements to the script so that it is easier to ensure that the development environment is working. In particular:

  1. Is the Angular version OK.
  2. Are component dependencies such as GapMinder installed (if necessary).
  3. Handle common 'ng serve' errors.

I also fixed a bug in clean-dist-for-deployment.sh to check for files and folders before deleting in order to avoid errors.