From a2ec599f3c60739240a4920078281b1c0fca8c4c Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 15 Dec 2023 12:21:51 -0800 Subject: [PATCH 1/8] Enable dask microservice --- config.yaml.defaults | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config.yaml.defaults b/config.yaml.defaults index ed62b8a..27becf7 100644 --- a/config.yaml.defaults +++ b/config.yaml.defaults @@ -28,3 +28,7 @@ server: debug_login: True google_oauth2_key: google_oauth2_secret: + +services: + # Empty disabled list, to enable dask + disabled: From 55d0bc38055ba71e60f6e5d6d31d33174bd5139d Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 15 Dec 2023 12:22:31 -0800 Subject: [PATCH 2/8] Update js packages; allow webpack to handle symlinked baselayer --- package.json | 50 ++++++++++++++++++++++------------------------- webpack.config.js | 13 +++--------- 2 files changed, 26 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index bd6b132..efbefaa 100644 --- a/package.json +++ b/package.json @@ -6,41 +6,37 @@ "test": "eslint -c .eslintrc --ext .jsx,.js ../static/scripts/ && make test" }, "dependencies": { - "check-dependencies": "1.1.0", + "check-dependencies": "^1.1.1", "css-loader": "3.5.3", "exports-loader": "0.7.0", "imports-loader": "0.8.0", "prop-types": "15.7.2", - "react": "16.13.1", - "react-dom": "16.13.1", - "react-redux": "7.2.0", - "redux": "4.0.5", + "react": "18.2.0", + "react-dom": "18.2.0", + "react-redux": "8.1.2", + "redux": "4.2.1", "redux-logger": "3.0.6", - "redux-thunk": "2.3.0", - "style-loader": "1.2.1", - "whatwg-fetch": "3.0.0" + "redux-thunk": "2.4.2", + "style-loader": "2.0.0" }, "devDependencies": { - "@babel/core": "7.17.8", - "@babel/eslint-parser": "7.18.9", - "@babel/plugin-proposal-class-properties": "7.17.12", - "@babel/plugin-proposal-object-rest-spread": "7.18.9", - "@babel/plugin-transform-arrow-functions": "7.16.7", - "@babel/plugin-transform-async-to-generator": "7.18.6", - "@babel/preset-env": "7.18.6", - "@babel/preset-react": "7.18.6", - "@types/eslint": "8.4.3", + "@babel/core": "7.23.5", + "@babel/eslint-parser": "7.22.9", + "@babel/plugin-transform-async-to-generator": "7.23.3", + "@babel/preset-env": "7.23.6", + "@babel/preset-react": "7.22.5", + "@types/eslint": "8.40.2", "babel-loader": "8.2.2", - "eslint": "7.5.0", - "eslint-config-airbnb": "18.2.1", - "eslint-config-prettier": "8.5.0", - "eslint-import-resolver-webpack": "0.13.2", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-jsx-a11y": "6.6.1", - "eslint-plugin-react": "7.31.1", - "eslint-plugin-react-hooks": "4.6.0", - "webpack": "5.65.0", - "webpack-cli": "4.10.0" + "eslint": "^8.55.0", + "eslint-config-airbnb": "^19.0.4", + "eslint-config-prettier": "8.8.0", + "eslint-import-resolver-webpack": "0.13.8", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-jsx-a11y": "^6.8.0", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0", + "webpack": "5.89.0", + "webpack-cli": "5.1.4" }, "repository": { "type": "git", diff --git a/webpack.config.js b/webpack.config.js index 25b0188..930ea3e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,10 +4,7 @@ const path = require("path"); const config = { entry: { - main: [ - "@babel/polyfill", - path.resolve(__dirname, "static/js/components/Main.jsx"), - ], + main: [path.resolve(__dirname, "static/js/components/Main.jsx")], }, output: { path: path.resolve(__dirname, "static/build"), @@ -23,12 +20,7 @@ const config = { exclude: /node_modules/, options: { presets: ["@babel/preset-env", "@babel/preset-react"], - plugins: [ - "@babel/plugin-transform-async-to-generator", - "@babel/plugin-transform-arrow-functions", - "@babel/plugin-proposal-class-properties", - "@babel/plugin-proposal-object-rest-spread", - ], + plugins: ["@babel/plugin-transform-async-to-generator"], compact: false, }, }, @@ -58,6 +50,7 @@ const config = { baselayer: path.resolve(__dirname, "baselayer/static/js"), }, extensions: [".js", ".jsx"], + modules: [path.resolve("./node_modules")], }, watchOptions: { ignored: /node_modules/, From d69a3fbec6e0196ae644194f7b9bb989e4c4e4da Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 15 Dec 2023 12:22:48 -0800 Subject: [PATCH 3/8] Enable AirBNB react rules --- .eslintrc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 1693425..2a9aaa1 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -7,7 +7,7 @@ parserOptions: presets: ["@babel/preset-env", "@babel/preset-react"] env: browser: true -extends: ["airbnb", "plugin:react/recommended", "prettier"] +extends: ["airbnb", "airbnb/hooks", "plugin:react/recommended", "prettier"] plugins: [import, react, react-hooks] settings: import/resolver: From 7cd565b05d553904ec831d5f49646187d1a9bfc6 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 15 Dec 2023 12:57:14 -0800 Subject: [PATCH 4/8] pre-commit: run eslint from pre-commit mirror --- .eslintrc.yaml | 6 ++---- .pre-commit-config.yaml | 10 ++++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 2a9aaa1..2a8e2a8 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -10,10 +10,7 @@ env: extends: ["airbnb", "airbnb/hooks", "plugin:react/recommended", "prettier"] plugins: [import, react, react-hooks] settings: - import/resolver: - node: {} - webpack: - config: webpack.config.js + import/resolver: webpack react: version: detect rules: @@ -27,3 +24,4 @@ rules: react/jsx-one-expression-per-line: 0 no-param-reassign: 0 react/jsx-curly-newline: 0 + default-param-last: 0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 43d6dc4..4812b5a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,11 +20,9 @@ repos: hooks: - id: prettier exclude: ".*config.yaml" - - repo: local + - repo: https://github.com/pre-commit/mirrors-eslint + rev: v8.55.0 hooks: - - id: ESLint - name: ESLint - entry: npx eslint -c .eslintrc.yaml --fix - language: system - files: \.[j]sx?$ + - id: eslint + files: ^static/js/.*\.[jt]sx?$ types: [file] From 35ad70349eb83aed9d7c9ea4f0e2827ca3eb4d01 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 15 Dec 2023 12:58:27 -0800 Subject: [PATCH 5/8] Hard pin packages.json --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index efbefaa..a1de721 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "test": "eslint -c .eslintrc --ext .jsx,.js ../static/scripts/ && make test" }, "dependencies": { - "check-dependencies": "^1.1.1", + "check-dependencies": "1.1.1", "css-loader": "3.5.3", "exports-loader": "0.7.0", "imports-loader": "0.8.0", @@ -27,14 +27,14 @@ "@babel/preset-react": "7.22.5", "@types/eslint": "8.40.2", "babel-loader": "8.2.2", - "eslint": "^8.55.0", - "eslint-config-airbnb": "^19.0.4", + "eslint": "8.55.0", + "eslint-config-airbnb": "19.0.4", "eslint-config-prettier": "8.8.0", "eslint-import-resolver-webpack": "0.13.8", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-jsx-a11y": "^6.8.0", - "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-import": "2.29.1", + "eslint-plugin-jsx-a11y": "6.8.0", + "eslint-plugin-react": "7.33.2", + "eslint-plugin-react-hooks": "4.6.0", "webpack": "5.89.0", "webpack-cli": "5.1.4" }, From fc685861f981b988091e9e191cefe55e9da76833 Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 15 Dec 2023 13:02:18 -0800 Subject: [PATCH 6/8] Use React18 syntax for rendering app --- .eslintrc.yaml | 1 + static/js/components/Main.jsx | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 2a8e2a8..f37e64b 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -25,3 +25,4 @@ rules: no-param-reassign: 0 react/jsx-curly-newline: 0 default-param-last: 0 + react/function-component-definition: 0 diff --git a/static/js/components/Main.jsx b/static/js/components/Main.jsx index 7ed724b..7d09c12 100644 --- a/static/js/components/Main.jsx +++ b/static/js/components/Main.jsx @@ -1,7 +1,7 @@ import React, { useEffect } from "react"; import PropTypes from "prop-types"; import { Provider } from "react-redux"; -import ReactDOM from "react-dom"; +import { createRoot } from "react-dom/client"; import messageHandler from "baselayer/MessageHandler"; import WebSocket from "baselayer/components/WebSocket"; @@ -57,9 +57,10 @@ MainContent.propTypes = { root: PropTypes.string.isRequired, }; -ReactDOM.render( +const container = document.getElementById("content"); +const root = createRoot(container); +root.render( - , - document.getElementById("content") + ); From e3371888f28cbd10d1659b92030fa6335751644d Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Fri, 15 Dec 2023 13:05:51 -0800 Subject: [PATCH 7/8] README: initialize the DB before running the app --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4cfc4da..226b51a 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ Clone this repository: `git clone --recursive git://github.com/cesium-ml/baselayer_template_app` +Initialize the database (see database permissions below): + +`make db_init` + Start the application with: `make run` @@ -29,4 +33,4 @@ Run `make help` for descriptions of other Make targets. ## Documentation -Please refer to http://cesium-ml.org/baselayer/ +Please refer to http://cesium-ml.org/baselayer/ for more detailed instructions. From fe0428228189c250a108a7f152f7891404c6972a Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Thu, 18 Jan 2024 16:03:27 -0800 Subject: [PATCH 8/8] Pin latest baselayer --- baselayer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/baselayer b/baselayer index 1b6b64d..57b7faa 160000 --- a/baselayer +++ b/baselayer @@ -1 +1 @@ -Subproject commit 1b6b64d9c3b958b3b5cda5a888b33b5af2018c4e +Subproject commit 57b7faa3abec0022d4c25575953569a4a7a88c88