Document local deployment of the search page

The existing README.md file was just a template created in the very beginning of the GitHub RSpec project. It is severely outdated. I've recovered the proper deployment sequence.
This commit is contained in:
Arseniy Zaostrovnykh 2024-04-10 09:21:47 +02:00 committed by GitHub
parent 10b4c2cec6
commit e1e31dcb07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 50 additions and 52 deletions

50
frontend/README.adoc Normal file
View File

@ -0,0 +1,50 @@
= Search page for the rule repository
This is a single-page React application that indexes the rule repository and
allows you to run flexible search through all of the rules and rule drafts,
and render the rule specifications in HTML.
The render is not guaranteed to match the rule rendering in the products,
but it is a good proxy.
== Local deployment
Make sure you have NodeJs and `npm` available. Tested with NPM v10.2.3 and NodeJS v18.19.0.
Install dependencies
[source,shell]
----
npm install
----
If you have some non-js dependencies missing, this might fail.
Possibly missing non-js dependencies include OpenSSL, libuv, libssh2, KRB5.
Once you succeed in installing the dependencies you are ready to predeploy.
[source,shell]
----
npm run predeploy
----
This command builds the database of the rule specifications.
NOTE: If the script fails to clone or fetch due to an SSL certificate failure
and your network uses a custom CA certificate you might need to make sure it is installed
in the accessible place.
As a workaround you can https://github.com/nodegit/nodegit/issues/1742[disable the certificate check].
NOTE: In the predeploy step (specifically the `prepare-rules` part of it) the script fetches all the open PRs locally.
You might want to set `GITHUB_TOKEN` to your personal GitHub token
to avoid GitHub throttling your requests during the predeploy stage.
Now you can run it locally:
[source,shell]
----
npm start
----
This should open https://localhost:3000/rspec in your default browser with the rule search page.

View File

@ -1,52 +0,0 @@
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.\
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run predeploy`
Custom command to build the search index.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you cant go back!**
If you arent satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point youre on your own.
You dont have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldnt feel obligated to use this feature. However we understand that this tool wouldnt be useful if you couldnt customize it when you are ready for it.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
**Note:** To easily use the `npm` commands on Windows, you can use VSCode with a `npm` support extension.