Skip to content
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

Project setup #1

Merged
merged 4 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .github/release.yml

changelog:
categories:
- title: Breaking Changes
labels:
- Semver-Major
- breaking
- title: New Features
labels:
- Semver-Minor
- enhancement
- title: Bug Fixes
labels:
- Semver-Patch
- bug
- title: Devops / Setup Changes
labels:
- docker
- setup
- demo
- CI
- security
- title: Other Changes
labels:
- "*"
21 changes: 21 additions & 0 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Run CI checks for frontend code
name: Frontend CI

on: ["push", "pull_request"]

jobs:
frontend:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
- name: Build Frontend
run: |
cd frontend
npm install
npm run build --emptyOutDir
28 changes: 28 additions & 0 deletions .github/workflows/pep.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Style Checks

on: ["push", "pull_request"]

jobs:
style:
runs-on: ubuntu-latest

strategy:
max-parallel: 4
matrix:
python-version: [3.9]

steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Deps
run: |
pip install invoke
pip install flake8
pip install pep8-naming
- name: Style Checks
run: |
flake8 .
44 changes: 44 additions & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Publish to PyPi package index

name: PIP Publish

on:
release:
types: [published]

jobs:

publish:
name: Publish to PyPi
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "18"
- name: Install Python Dependencies
run: |
pip install --upgrade wheel setuptools twine build
- name: Build Frontend
run: |
cd frontend
npm install
npm run build --emptyOutDir
- name: Build Binary
run: |
python -m build
- name: Publish
run: |
python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_REPOSITORY: pypi

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include scheduling/static *.js *.css
24 changes: 24 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 8 additions & 0 deletions frontend/.vite/deps/_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"hash": "d10362e3",
"configHash": "408b34e5",
"lockfileHash": "e3b0c442",
"browserHash": "e1cca9d1",
"optimized": {},
"chunks": {}
}
3 changes: 3 additions & 0 deletions frontend/.vite/deps/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
44 changes: 44 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# InvenTree Stock Scheduling - Frontend Code

This directory contains the frontend code for the InvenTree Stock Scheduling plugin.

## Architecture

The frontend code is designed to integrate natively with the InvenTree user interface.

### Frameworks

We use Mantine, running on React, to match the InvenTree stack.

- [React](https://react.dev/)
- [Mantine](https://mantine.dev/)

### Project Setup

This project uses [Vite](https://vitejs.dev/) as the build tool. We followed [this guide](https://vitejs.dev/guide/#scaffolding-your-first-vite-project) to scaffold the project.

### Building

*Note: Assumed you are already in the `frontend` directory.*

To compile the frontend code, run:

```bash
npm run build --emptyOutDir
```

This will compile the frontend into the `../order_history/static` directory (ready for distribution).

Note: The target directory is intentionally outside of the frontend directory, so that the compiled files are correctly bundled into the python package install.

### Testing

To test the frontend code, run:

```bash
npm run dev
```

This will start a development server (usually on `localhost:5173`) which will automatically reload when changes are made to the source code.

The development server provides some "dummy" harness data to test the frontend code.
28 changes: 28 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
12 changes: 12 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>InvenTree Scheduling</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading
Loading