mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-13 01:02:25 -06:00
refac
This commit is contained in:
+8
-10
@@ -10,14 +10,12 @@ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
||||
class CustomBuildHook(BuildHookInterface):
|
||||
def initialize(self, version, build_data):
|
||||
super().initialize(version, build_data)
|
||||
stderr.write(">>> Building Open Webui frontend\n")
|
||||
npm = shutil.which("npm")
|
||||
stderr.write('>>> Building Open Webui frontend\n')
|
||||
npm = shutil.which('npm')
|
||||
if npm is None:
|
||||
raise RuntimeError(
|
||||
"NodeJS `npm` is required for building Open Webui but it was not found"
|
||||
)
|
||||
stderr.write("### npm install\n")
|
||||
subprocess.run([npm, "install", "--force"], check=True) # noqa: S603
|
||||
stderr.write("\n### npm run build\n")
|
||||
os.environ["APP_BUILD_HASH"] = version
|
||||
subprocess.run([npm, "run", "build"], check=True) # noqa: S603
|
||||
raise RuntimeError('NodeJS `npm` is required for building Open Webui but it was not found')
|
||||
stderr.write('### npm install\n')
|
||||
subprocess.run([npm, 'install', '--force'], check=True) # noqa: S603
|
||||
stderr.write('\n### npm run build\n')
|
||||
os.environ['APP_BUILD_HASH'] = version
|
||||
subprocess.run([npm, 'run', 'build'], check=True) # noqa: S603
|
||||
|
||||
Reference in New Issue
Block a user