-
Notifications
You must be signed in to change notification settings - Fork 23
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
Replace react-script with vite #471
Conversation
This somewhat silently removes the option to start the admin ui with mock data. While I'm not necessarily against this, I think it could be "possibly controversial"? Furthermore, is this breaking the stuff Lars is working on, like #416? |
Was the code necessary to deploy it like that? |
I actually have no idea, I've just been reading the comments on Github and it seemed like it might clash with this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good riddance CRA, hello Vite!
Works and looks good to me, the comments below are just nitpicks, I am more than willing to approve this. Although we should still discuss if we want to get rid of the mock data. (Personally I never use it so I wouldn't mind if it was gone).
package.json
Outdated
"@types/dompurify": "^3.0.5", | ||
"@types/http-proxy": "^1.17.14", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be going unused.
package.json
Outdated
"eslint": "^8.56.0", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-react-hooks": "^4.6.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicitly importing these seems to be unnecessary?
package.json
Outdated
@@ -74,10 +72,21 @@ | |||
"@babel/plugin-syntax-optional-chaining": "^7.8.3", | |||
"@babel/preset-env": "^7.23.8", | |||
"@babel/preset-react": "^7.24.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gettring rid of CRA should also mean that we can get rid of babel!
As the test deployments are only static files, removing the proxy should not cause any trouble. |
It's not creaking the test deployment to GitHub pages, but in the current form, it would break the test containers (introduced in #470). At least with the current documentation.
Does that mean you also cannot proxy API data from Opencast? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misunderstood that:
- Mock data is gone (that just needs a slight text update in Automatically publish conatiner image #470)
- Proxy still exists
- Default target now is https://develop.opencast.org which I like since it should work for most people with the default config
README.md
Outdated
|
||
This assumes you have an Opencast instance running at `http://localhost:8080` | ||
to which the development server will then proxy all the backend request, | ||
This assumes you have an internet connection to which the development server will then proxy all the backend request, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we explicitly state that the default proxy target is https://develop.opencast.org? That “the internet” is proceed is rather vague 😁
Since #470 got merged, can you update the test comment:
This should now probably be something like:
|
This pull request has conflicts ☹ |
- Change path variables - Fix division warning
- Add static asset handling hint - Remove ts-expect-error
This replaces the vague formulation `the internet`with the default target for API calls.
Sorry for finding another issue 🙈 This causes the container to fail since they do not contain a browser:
The vite server also listens to localhost only which does not work with the containers. There may be a better way, but this will fix the issues: diff --git a/Dockerfile b/Dockerfile
index 2782425b1f..1890183c3c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,4 +7,5 @@ WORKDIR /admin-interface
RUN npm ci
ENV CI true
+ENV BROWSER none
CMD [ "npm", "start" ]
diff --git a/package.json b/package.json
index 4a14ced112..c0bd48faa9 100644
--- a/package.json
+++ b/package.json
@@ -45,7 +45,7 @@
"yup": "^1.4.0"
},
"scripts": {
- "start": "vite",
+ "start": "vite --host 0.0.0.0",
"build": "tsc && vite build",
"serve": "vite preview",
"test": "vitest" |
- Do not open browser - Listen on all addresses
I did not alter the package.json because I would not expect vite to listen on all addresses in a dev environment. Instead, I added the host option to the |
Great. Tried that but without the |
Vite was chosen because of opencast/opencast-editor#1265
I didn't reimplement the dev mode with the mocks.