Skip to content

Commit

Permalink
build: abstract out build_frontend.py
Browse files Browse the repository at this point in the history
  • Loading branch information
eri24816 committed Apr 18, 2024
1 parent 5860ea3 commit 878d0b8
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 19 deletions.
5 changes: 1 addition & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
"prebuild": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts",
"build": "npx webpack --mode development",
"build:standalone": "npx webpack --mode development --config webpack.config.standalone.js",
"build:service": "npx webpack --mode development --config webpack.config.service.js",
"postbuild": "python ./postbuild.py",
"postbuild:standalone": "python ./postbuild.py",
"postbuild:service": "python ./postbuild.py"
"build:service": "npx webpack --mode development --config webpack.config.service.js"
},
"dependencies": {
"@codemirror/lang-python": "^6.1.5",
Expand Down
14 changes: 0 additions & 14 deletions frontend/postbuild.py

This file was deleted.

3 changes: 3 additions & 0 deletions packaging/pack_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

shutil.copytree(template, dst_root)

# build frontend
os.system('python scripts/build_frontend.py')

def copy(src, dst=None):
if dst is None:
dst = src
Expand Down
3 changes: 3 additions & 0 deletions packaging/templates/source/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import os
import webbrowser

webbrowser.open('http://localhost:7943/frontend')

os.system('python entry/launcher.py --backend-path "backend/src" --frontend-path "frontend" --port 7943')
4 changes: 4 additions & 0 deletions scripts/build_frontend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import os

# todo: check is changed
exit(os.system('cd frontend && npm run build:standalone && cd ..'))
2 changes: 1 addition & 1 deletion scripts/dev.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd frontend && npm run build:standalone && cd .. &&\
python scripts/build_frontend.py &&\

python entry/run.py --backend-path "backend/src" --frontend-path "frontend/dist" --port 7943

0 comments on commit 878d0b8

Please sign in to comment.