diff --git a/chinook/.gitignore b/chinook/.gitignore index 2e5ed3c6..fa48301d 100644 --- a/chinook/.gitignore +++ b/chinook/.gitignore @@ -7,9 +7,10 @@ gen/ node_modules/ target/ package-lock.json +app/build # html5Deployer -deployers/html5Deployer/resources/app/ +app/deployers/html5Deployer/resources/ # Web IDE, App Studio .che/ diff --git a/chinook/README.md b/chinook/README.md index e93c0d68..55e1cadd 100644 --- a/chinook/README.md +++ b/chinook/README.md @@ -5,9 +5,9 @@ Welcome to your new project. It contains these folders and files, following our recommended project layout: | File or Folder | Purpose | -|------------------|--------------------------------------| +| ---------------- | ------------------------------------ | | `app/` | will contain compiled front bundles | -| `app/react/` | contains frontend app on react | +| `app/front/` | contains frontend app on react | | `app/deployers/` | contains deployment staff | | `db/` | your domain models and data go here | | `srv/` | your service models and code go here | @@ -31,7 +31,7 @@ npm run deploy cds watch ``` -- Open `app/react` folder and run next commands. This will install dependencies and run frontend src files watcher. When you will change src files your bundles in app directory will re-compiled. Now you can enjoy development: +- Open `app/front` folder and run next commands. This will install dependencies and run frontend src files watcher. When you will change src files your bundles in app directory will re-compiled. Now you can enjoy development: ```json npm install @@ -44,6 +44,22 @@ npm run watch > npm run start > ``` +## Test + +- Change package.json db section + +```json + "db": { + "kind": "sql" + } +``` + +- Run tests + +```json +npm run test +``` + ## Deployment - Make sure you already have hanatrial instance in your cockpit dashboard (SAP Cloud Platform). @@ -56,17 +72,17 @@ npm run watch } ``` -- Authenticate in the Cloud Foundry: +- Authenticate to the Cloud Foundry: ```json cf login ``` -- Open `app/react` folder and run the following commands. This will create frontend production bundles in app subfolder: +- Open `app/front` folder and run the following commands. This will create frontend production bundles in app subfolder: ```json npm install -npm run build +npm run build:prod ``` - Clean up app/deployers/html5Deployer/resources folder from the previous frontend build diff --git a/chinook/app/react/.babelrc b/chinook/app/front/.babelrc similarity index 100% rename from chinook/app/react/.babelrc rename to chinook/app/front/.babelrc diff --git a/chinook/app/react/.eslintrc.json b/chinook/app/front/.eslintrc.json similarity index 100% rename from chinook/app/react/.eslintrc.json rename to chinook/app/front/.eslintrc.json diff --git a/chinook/app/react/.gitignore b/chinook/app/front/.gitignore similarity index 100% rename from chinook/app/react/.gitignore rename to chinook/app/front/.gitignore diff --git a/chinook/app/react/.prettierrc b/chinook/app/front/.prettierrc similarity index 100% rename from chinook/app/react/.prettierrc rename to chinook/app/front/.prettierrc diff --git a/chinook/app/react/.vscode/launch.json b/chinook/app/front/.vscode/launch.json similarity index 100% rename from chinook/app/react/.vscode/launch.json rename to chinook/app/front/.vscode/launch.json diff --git a/chinook/app/react/README.md b/chinook/app/front/README.md similarity index 100% rename from chinook/app/react/README.md rename to chinook/app/front/README.md diff --git a/chinook/app/react/package.json b/chinook/app/front/package.json similarity index 96% rename from chinook/app/react/package.json rename to chinook/app/front/package.json index 457556aa..0e392a4b 100644 --- a/chinook/app/react/package.json +++ b/chinook/app/front/package.json @@ -10,12 +10,13 @@ "lint": "./node_modules/.bin/eslint" }, "dependencies": { + "@ant-design/icons": "4.3.0", + "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", "@umijs/hooks": "^1.9.3", "antd": "^4.8.2", - "@ant-design/icons": "4.3.0", "axios": "^0.20.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^6.3.2", @@ -29,6 +30,7 @@ "react": "^16.14.0", "react-dev-utils": "^11.0.1", "react-dom": "^16.14.0", + "react-refresh": "^0.9.0", "react-router-dom": "^5.2.0", "terser-webpack-plugin": "^5.0.3", "webpack": "5.8.0", diff --git a/chinook/app/react/public/index.html b/chinook/app/front/public/index.html similarity index 100% rename from chinook/app/react/public/index.html rename to chinook/app/front/public/index.html diff --git a/chinook/app/react/public/logo192.png b/chinook/app/front/public/logo192.png similarity index 100% rename from chinook/app/react/public/logo192.png rename to chinook/app/front/public/logo192.png diff --git a/chinook/app/react/public/logo512.png b/chinook/app/front/public/logo512.png similarity index 100% rename from chinook/app/react/public/logo512.png rename to chinook/app/front/public/logo512.png diff --git a/chinook/app/react/public/manifest.json b/chinook/app/front/public/manifest.json similarity index 100% rename from chinook/app/react/public/manifest.json rename to chinook/app/front/public/manifest.json diff --git a/chinook/app/react/public/robots.txt b/chinook/app/front/public/robots.txt similarity index 100% rename from chinook/app/react/public/robots.txt rename to chinook/app/front/public/robots.txt diff --git a/chinook/app/react/public/xs-app.json b/chinook/app/front/public/xs-app.json similarity index 100% rename from chinook/app/react/public/xs-app.json rename to chinook/app/front/public/xs-app.json diff --git a/chinook/app/react/src/App.css b/chinook/app/front/src/App.css similarity index 100% rename from chinook/app/react/src/App.css rename to chinook/app/front/src/App.css diff --git a/chinook/app/react/src/App.jsx b/chinook/app/front/src/App.jsx similarity index 100% rename from chinook/app/react/src/App.jsx rename to chinook/app/front/src/App.jsx diff --git a/chinook/app/react/src/api/axiosInstance.js b/chinook/app/front/src/api/axiosInstance.js similarity index 100% rename from chinook/app/react/src/api/axiosInstance.js rename to chinook/app/front/src/api/axiosInstance.js diff --git a/chinook/app/react/src/api/calls.js b/chinook/app/front/src/api/calls.js similarity index 100% rename from chinook/app/react/src/api/calls.js rename to chinook/app/front/src/api/calls.js diff --git a/chinook/app/react/src/components/ErrorPage.jsx b/chinook/app/front/src/components/ErrorPage.jsx similarity index 100% rename from chinook/app/react/src/components/ErrorPage.jsx rename to chinook/app/front/src/components/ErrorPage.jsx diff --git a/chinook/app/react/src/components/Header.css b/chinook/app/front/src/components/Header.css similarity index 100% rename from chinook/app/react/src/components/Header.css rename to chinook/app/front/src/components/Header.css diff --git a/chinook/app/react/src/components/Header.jsx b/chinook/app/front/src/components/Header.jsx similarity index 100% rename from chinook/app/react/src/components/Header.jsx rename to chinook/app/front/src/components/Header.jsx diff --git a/chinook/app/react/src/components/InvoicePage.jsx b/chinook/app/front/src/components/InvoicePage.jsx similarity index 100% rename from chinook/app/react/src/components/InvoicePage.jsx rename to chinook/app/front/src/components/InvoicePage.jsx diff --git a/chinook/app/react/src/components/Login.jsx b/chinook/app/front/src/components/Login.jsx similarity index 100% rename from chinook/app/react/src/components/Login.jsx rename to chinook/app/front/src/components/Login.jsx diff --git a/chinook/app/react/src/components/ManageStore.jsx b/chinook/app/front/src/components/ManageStore.jsx similarity index 100% rename from chinook/app/react/src/components/ManageStore.jsx rename to chinook/app/front/src/components/ManageStore.jsx diff --git a/chinook/app/react/src/components/MyInvoicesPage.jsx b/chinook/app/front/src/components/MyInvoicesPage.jsx similarity index 100% rename from chinook/app/react/src/components/MyInvoicesPage.jsx rename to chinook/app/front/src/components/MyInvoicesPage.jsx diff --git a/chinook/app/react/src/components/PersonPage.jsx b/chinook/app/front/src/components/PersonPage.jsx similarity index 100% rename from chinook/app/react/src/components/PersonPage.jsx rename to chinook/app/front/src/components/PersonPage.jsx diff --git a/chinook/app/react/src/components/Router.jsx b/chinook/app/front/src/components/Router.jsx similarity index 100% rename from chinook/app/react/src/components/Router.jsx rename to chinook/app/front/src/components/Router.jsx diff --git a/chinook/app/react/src/components/TracksPage.css b/chinook/app/front/src/components/TracksPage.css similarity index 100% rename from chinook/app/react/src/components/TracksPage.css rename to chinook/app/front/src/components/TracksPage.css diff --git a/chinook/app/react/src/components/TracksPage.jsx b/chinook/app/front/src/components/TracksPage.jsx similarity index 96% rename from chinook/app/react/src/components/TracksPage.jsx rename to chinook/app/front/src/components/TracksPage.jsx index ed6c9835..a53ca465 100644 --- a/chinook/app/react/src/components/TracksPage.jsx +++ b/chinook/app/front/src/components/TracksPage.jsx @@ -19,6 +19,10 @@ const DEBOUNCE_OPTIONS = { trailing: false, }; +const isEven = (value) => { + return value % 2 === 0; +}; + const renderGenres = (genres) => genres.map(({ ID, name }) => (