Debian Codegraph @

bower-lite

raw symbols SCIP
1 #!/usr/bin/env python
2 # Copyright (c) Jupyter Development Team.
3 # Distributed under the terms of the Modified BSD License.
4 """
5 bower-lite
6
7 Since Bower's on its way out,
8 stage frontend dependencies from node_modules into components
9 """
10
11 import json
12 import os
13 import shutil
14 from os.path import join
15
16 HERE = os.path.abspath(os.path.dirname(__file__))
17
18
19 components = join(HERE, "share", "jupyterhub", "static", "components")
20 node_modules = join(HERE, "node_modules")
21
22 if os.path.exists(components):
23 shutil.rmtree(components)
24 os.mkdir(components)
25
26 with open(join(HERE, 'package.json')) as f:
27 package_json = json.load(f)
28
29 dependencies = package_json['dependencies']
30 for dep in dependencies:
31 src = join(node_modules, dep)
32 dest = join(components, dep)
33 print(f"{src} -> {dest}")
34 shutil.copytree(src, dest)