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

fix(web): resolved web build issues with yarn and missing dependencies #1658

Merged
merged 3 commits into from
Jun 27, 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
50 changes: 50 additions & 0 deletions .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build Web Application

# Triggered when the web directory or this file is changed
on:
pull_request:
branches:
- main
paths:
- web/**
- .github/workflows/build-web.yml
push:
branches:
- main
paths:
- web/**
- .github/workflows/build-web.yml

concurrency:
group: ${{ github.event.number || github.run_id }}
cancel-in-progress: true

defaults:
run:
# Runs all jobs in the web directory
working-directory: ./web

jobs:
build-web:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# FIXME: Add windows-latest support
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Install dependencies
run: |
yarn install

- name: Build web application
run: |
yarn build
23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import functools
import json
import os
import platform
import re
Expand Down Expand Up @@ -753,6 +754,25 @@ def init_install_requires():
],
)


class PrintExtrasCommand(setuptools.Command):
description = "print extras_require"
user_options = [
('output=', 'o', 'Path to output the extras_require JSON'),
]

def initialize_options(self):
self.output = None

def finalize_options(self):
if self.output is None:
raise ValueError("output is not set")

def run(self):
with open(self.output, 'w') as f:
json.dump(setup_spec.unique_extras, f, indent=2)


setuptools.setup(
name="dbgpt",
packages=packages,
Expand All @@ -770,6 +790,9 @@ def init_install_requires():
license="https://opensource.org/license/mit/",
python_requires=">=3.10",
extras_require=setup_spec.unique_extras,
cmdclass={
'print_extras': PrintExtrasCommand,
},
entry_points={
"console_scripts": [
"dbgpt=dbgpt.cli.cli_scripts:main",
Expand Down
8 changes: 4 additions & 4 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ Also, it is a **LLM to Vision** solution.
### Prerequisites

- [Node.js](https://nodejs.org/) >= 16
- [npm](https://npmjs.com/) >= 8
- [yarn](https://yarnpkg.com/) >= 1.22
- Supported OSes: Linux, macOS and Windows

### Installation

```sh
# Install dependencies
npm install
yarn install
```

### Usage
Expand All @@ -54,13 +54,13 @@ edit the `API_BASE_URL` to the real address

```sh
# development model
npm run dev
yarn dev
```

## 🚀 Use In DB-GPT

```sh
npm run compile
yarn compile

# copy compile file to DB-GPT static file dictory
cp -rf out/* ../dbgpt/app/static
Expand Down
Loading