Skip to content

Commit

Permalink
Update webapp dependencies (#569)
Browse files Browse the repository at this point in the history
* Update webapp dependencies

- corejs 3
   - tweaked so that only the needed polyfills are added
- webpack 5
- remove react-font-awesome
   - it was not used in practice
- babel minor bump
- replace .babelrc with babel.config.json
- replace `babel-eslint` with `@babel/eslint-parser`
- css-loader 6
- eslint 7
- sass bump

* [webapp] Fix warnings

- remove unused dependency
- use calc in division in scss file
- [webcore] mark unused function parameters

* [webcore] remove "jsnext:main" field in package.json

it's a bit outdated

* [webapp] Add postinstall script that runs webcore's npm install

fixes building the webapp on npm v7+,
otherwise webcore dependencies cannot be resolved

* [webapp] remove run_server executable

- old, no longer recommended
- update README.md accordingly

* [webapp] update README.md again

- remove mentions of run_server,
suggest http-static instead
  • Loading branch information
Enet4 authored Mar 17, 2022
1 parent 7a83704 commit 96d58c1
Show file tree
Hide file tree
Showing 16 changed files with 5,355 additions and 6,484 deletions.
3 changes: 0 additions & 3 deletions dicoogle/src/main/resources/webapp/.babelrc

This file was deleted.

10 changes: 8 additions & 2 deletions dicoogle/src/main/resources/webapp/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": [
"eslint:recommended"
],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
Expand Down Expand Up @@ -50,7 +50,13 @@
"semi-spacing": 0,
"eqeqeq": 1,
"no-alert": 1,
"no-unused-vars": [1, {"vars": "all", "args": "none"}],
"no-unused-vars": [1, {
"vars": "all",
"args": "none",
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}],
"no-extra-semi": 1,
"eol-last": 1,
"no-empty": 1,
Expand Down
25 changes: 13 additions & 12 deletions dicoogle/src/main/resources/webapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ To build and watch for changes, you can run the webpack development server via t

npm start

## Running as a standalone server

We have included a script for running a static server containing the standalone webapp.
If you already have Python installed, execute:

```sh
./run_server
```

But other static HTTP servers may be used as well.

## Debugging the webapp

The web application can be tested separately without having it embedded in a jar file. The steps are simple:
Expand All @@ -51,7 +40,19 @@ You can also run one of the other scripts available and deploy a static server o

```
DICOOGLE_BASE_URL=http://localhost:8080 npm run build-debug
./run_server
npx static-http .
```

See the **Building** section above for more scripts.

## Running as a standalone server

Running `npm start` is the recommended way to serve the webapp for development purposes.
But if you wish to serve the webapp separately from Dicoogle,
you can build it against a different Dicoogle endpoint (see above)
and use any other static HTTP server to serve this folder.

```sh
DICOOGLE_BASE_URL=http://«dicoogle-hostname»:8080 npm run build
npx static-http .
```
12 changes: 12 additions & 0 deletions dicoogle/src/main/resources/webapp/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "entry",
"corejs": "3.21"
}
],
"@babel/preset-react"
]
}
5 changes: 4 additions & 1 deletion dicoogle/src/main/resources/webapp/js/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// import styles
import "../sass/dicoogle.scss";

// main application
import React from "react";
import * as PropTypes from "prop-types";
import ReactDOM from "react-dom";
Expand All @@ -23,7 +26,7 @@ import * as UserActions from "./actions/userActions";
import UserStore from "./stores/userStore";

import "@ungap/custom-elements-builtin";
import "core-js/shim";
import "core-js/stable";
import "bootstrap";

class App extends React.Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import createReactClass from "create-react-class";
import * as PropTypes from "prop-types";
import * as UserActions from "../../actions/userActions";
import UserStore from "../../stores/userStore";
import { Panel } from "react-bootstrap";

const LoginView = createReactClass({
contextTypes: {
Expand Down
Loading

0 comments on commit 96d58c1

Please sign in to comment.