fnproject / ui

User interface for fn project.
Apache License 2.0
89 stars 21 forks source link

Clean up nodejs packages #71

Closed vzDevelopment closed 5 years ago

vzDevelopment commented 5 years ago

About

I noticed that the docker file was installing the dev dependencies in the production docker image e.g. eslint isn't required in the production image. I fixed this by moving the NODE_ENV production line before the npm install commands (this causes npm to only install the production packages akin to specifying --production c.f. the npm docs).

However, this broke the interface where there were packages that were incorrectly listed in the dev dependencies section rather than the production dependencies section. I have fixed this.

I thought I'd also take the opportunity to clean up the dependencies and used npm-check-unused to find potential packages that could be removed. I've removed the ones it flagged which weren't required for the interface to work.

Testing

I cloned a fresh repo and used:

docker build -t fnui .
docker run --rm -it --link fnserver:api -p 4000:4000 -e "FN_API_URL=http://api:8080" fnui

to launch a UI using these changes (n.b. the dockerfile copies everything including the node_modules directory over to the image so it's important you delete this directory or use a fresh clone).

I then tested the core functionality of the UI checking for any signs of breakages or errors in the console. I tested:

I need to add Selenium tests sometime!