Merge branch 'move-js' into 'master'

Move Vue app to a "webapp" directory

See merge request openflexure/openflexure-microscope-server!122
This commit is contained in:
Kaspar Emanuel 2021-09-16 14:37:00 +00:00
commit 0e628e0d53
75 changed files with 13 additions and 10 deletions

View file

@ -9,7 +9,7 @@ stages:
.python-install-template: &python-install
before_script:
- python3 -m venv .venv # NB this does not overwrite an existing cached venv
- source .venv/bin/activate
- source .venv/bin/activate
- pip install pipenv # Should be cached after first run
- pipenv install --dev --deploy # Should be cached after first run - will just check packages are present
cache:
@ -21,12 +21,12 @@ stages:
# Re-usable block to install (and cache) openflexure-microscope-server static app
.node-install-template: &node-install
before_script:
- cd openflexure_microscope/api/static/
- cd webapp
- npm install
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- openflexure_microscope/api/static/node_modules
- webapp/node_modules
# Python static analysis with PyLint
pylint:
@ -162,7 +162,7 @@ build:
name: "dist"
expire_in: 1 week
paths:
- "./openflexure_microscope/api/static/dist/"
- "openflexure_microscope/api/static/dist/"
only:
- master

View file

@ -83,10 +83,10 @@ To set up a development version of the software (most likely using emulated came
* `curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -`
* `sudo apt install nodejs`
* To build the web application (this produces a set of static files, that are served by the Flask webserver)
* `cd openflexure_microscope/api/static`
* `cd webapp`
* `npm install`
* `npm run build`
* To create a Node.js development server (this will help various development tools to display more information, and auto-rebuilds when you change the source files)
* To create a Node.js development server (this will help various development tools to display more information, and auto-rebuilds when you change the source files)
* `npm run serve`
* You access the development server on a different port (it's printed on the command line when you run the above command). This means that when it starts up you will need to tell it where the microscope server is, using the "override API origin" field in the page that pops up. If you are running a test server on your computer, this is most likely `http://localhost:5000/`.
@ -97,25 +97,25 @@ All of the commands below assume that you are running in the OFM virtual environ
* To auto-format the Python code run `poe format`
* To auto-format the Javascript code, run
* `cd openflexure_microscope/api/static`
* `cd webapp`
* `npm run lint`
**Before submitting a merge request/merging** please auto-format your code and also run the quality checks (linting, static analysis, and unit tests)
* To auto-format and type-check the Python code run `poe check`
* To auto-format the Javascript code, run
* `cd openflexure_microscope/api/static`
* `cd webapp`
* `npm run lint`
### Details
We use several code analysis and formatting libraries in this project. **Please run all of these before submitting a merge request.**
We use several code analysis and formatting libraries in this project. **Please run all of these before submitting a merge request.**
Our CI will check each of these automatically, so ensuring they pass locally will save you time.
* **Black** - Code formatting with minimal configuration.
* While sometimes it's not perfect, its fine 90% of the time and prevents arguments about formatting.
* While sometimes it's not perfect, its fine 90% of the time and prevents arguments about formatting.
* Automatically formats your code
* This will rewrite your files in-place, so if you want to be able to revert, make a backup first!
* `poe black`

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

3
webapp/vue.config.js Normal file
View file

@ -0,0 +1,3 @@
module.exports = {
outputDir: '../openflexure_microscope/api/static/dist',
};