-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbower-lite
37 lines (31 loc) · 1.02 KB
/
bower-lite
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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
import sys
from os.path import join
HERE = os.path.abspath(os.path.dirname(__file__))
components = join(HERE, "share", "jupyterhub", "static", "dossier", "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)
less_src = join(sys.prefix, "share", "jupyterhub", "static", "less")
less_dst = join(HERE, "share", "jupyterhub", "static", "less")
print(f"{less_src} -> {less_dst}")
shutil.copytree(less_src, less_dst)
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)