Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add npm dev-server script to develop against a remote CM back-end. #12

Merged
merged 2 commits into from
Oct 15, 2021

Conversation

ray-lee
Copy link
Contributor

@ray-lee ray-lee commented Oct 12, 2021

Description

This adds a new npm script, dev-server, which runs a local development server that proxies requests to a specified CM back-end.

It also:

  • Upgrades the version of webpack-cli used by the project.
  • Changes the source map generation method in dev to the recommended (by webpack) eval-source-map.

Motivation and Context

This allows development on circulation-admin to happen without the need to build a local circulation manager from source. It makes it easier for front-end developers to get started on the project, as they don't need to install a python ecosystem, elasticsearch, etc. It also allows data from "real" CMs to be used during development, without needing to dump and restore databases.

How Has This Been Tested?

  1. Run npm run dev-server -- --env=backend=https://gorgon.tpp-qa.lyrasistechnology.org
  2. Open http://localhost:8080/admin in a browser
  3. Log in with gorgon credentials. Verify that content from gorgon appears.
  4. Edit some source code. The browser should automatically reload, and the expected changes should appear.

Checklist:

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@tdilauro
Copy link
Contributor

I did some more testing of this today and it seems to work well. I connected it to several servers and navigated around the interface.

5. run the Elasticsearch server using `./bin/elasticsearch` in the elasticsearch-[version] directory,
6. visit `localhost:6500/admin/`.

Webpack will take care of compiling and updating any new changes made locally for development. Just hard refresh the page (command + shift + R) to see updates without having to restart either the `circulation` or `circulation-web` servers.
Webpack will take care of compiling and updating any new changes made locally for development. Just hard refresh the page (command + shift + R) to see updates without having to restart either the `circulation` or `circulation-admin` servers.

Copy link
Contributor Author

@ray-lee ray-lee Oct 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I took the opportunity to change the directory names in the above existing documentation, but I don't think the instructions actually work as written. There is no package.json in circulation/api/admin, so the npm commands don't work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there isn't. I think JG started down the path of cleaning up the README in #4, but got waylaid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best to only leave in the parts about the new web server and revert the rest.

Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

See the discussed README issues, which I don't feel strongly about, since there's still a bunch more to do there.

5. run the Elasticsearch server using `./bin/elasticsearch` in the elasticsearch-[version] directory,
6. visit `localhost:6500/admin/`.

Webpack will take care of compiling and updating any new changes made locally for development. Just hard refresh the page (command + shift + R) to see updates without having to restart either the `circulation` or `circulation-web` servers.
Webpack will take care of compiling and updating any new changes made locally for development. Just hard refresh the page (command + shift + R) to see updates without having to restart either the `circulation` or `circulation-admin` servers.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best to only leave in the parts about the new web server and revert the rest.

@ray-lee ray-lee marked this pull request as ready for review October 14, 2021 23:09
@ray-lee
Copy link
Contributor Author

ray-lee commented Oct 15, 2021

I think some of the readme changes need to be there to make the new stuff make sense, and it's an improvement, even if it's still not correct. I'd rather leave it, and come back to fix all the problems.

@ray-lee ray-lee merged commit df7bd53 into main Oct 15, 2021
@ray-lee ray-lee deleted the dev-server branch October 15, 2021 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants