mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-07 01:54:09 +00:00
35 lines
821 B
Python
Executable File
35 lines
821 B
Python
Executable File
#!/usr/bin/env python
|
|
# Copyright (c) Jupyter Development Team.
|
|
# Distributed under the terms of the Modified BSD License.
|
|
"""
|
|
bower-lite
|
|
|
|
Since Bower's on its way out,
|
|
stage frontend dependencies from node_modules into components
|
|
"""
|
|
|
|
import json
|
|
import os
|
|
import shutil
|
|
from os.path import join
|
|
|
|
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
components = join(HERE, "share", "jupyterhub", "static", "components")
|
|
node_modules = join(HERE, "node_modules")
|
|
|
|
if os.path.exists(components):
|
|
shutil.rmtree(components)
|
|
os.mkdir(components)
|
|
|
|
with open(join(HERE, 'package.json')) as f:
|
|
package_json = json.load(f)
|
|
|
|
dependencies = package_json['dependencies']
|
|
for dep in dependencies:
|
|
src = join(node_modules, dep)
|
|
dest = join(components, dep)
|
|
print(f"{src} -> {dest}")
|
|
shutil.copytree(src, dest)
|