From 0dbff79357d252b96428c1cd7c611c0421219905 Mon Sep 17 00:00:00 2001 From: Rosio Reyes Date: Wed, 11 May 2022 12:34:42 -0700 Subject: [PATCH] remove bower, install js dependencies with npm using bower-lite script to copy them into components folder. this is applying the changes made by @minrk in https://github.com/jupyter/notebook/pull/6213/files --- .bowerrc | 3 --- MANIFEST.in | 1 + bower-lite | 37 +++++++++++++++++++++++++++++++ bower.json | 30 ------------------------- nbclassic/templates/page.html | 14 ++++++------ nbclassic/templates/terminal.html | 2 +- package.json | 32 ++++++++++++++++++++++---- setupbase.py | 36 +++++++++++++++--------------- tools/build-main.js | 6 ++--- 9 files changed, 95 insertions(+), 66 deletions(-) delete mode 100644 .bowerrc create mode 100644 bower-lite delete mode 100644 bower.json diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 25442973e..000000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "nbclassic/static/components" -} \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index 5004858d5..753237768 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ include LICENSE +include bower-lite # added by check-manifest include *.md diff --git a/bower-lite b/bower-lite new file mode 100644 index 000000000..eec33864a --- /dev/null +++ b/bower-lite @@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +# 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, "nbclassic", "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) + +renames = { + "jquery-ui-dist": "jquery-ui", +} + +dependencies = package_json["dependencies"] +for dep in dependencies: + src = join(node_modules, dep) + dest_name = renames.get(dep, dep) + dest = join(components, dest_name) + print(f"{src} -> {dest}") + shutil.copytree(src, dest) \ No newline at end of file diff --git a/bower.json b/bower.json deleted file mode 100644 index 5f72f6ff0..000000000 --- a/bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "jupyter-notebook-deps", - "version": "0.0.1", - "dependencies": { - "backbone": "components/backbone#~1.2", - "bootstrap": "bootstrap#~3.4", - "bootstrap-tour": "0.9.0", - "codemirror": "components/codemirror#5.56.0+components1", - "create-react-class": "https://cdn.jsdelivr.net/npm/create-react-class@15.6.3/create-react-class.min.js", - "es6-promise": "~1.0", - "font-awesome": "components/font-awesome#~4.7.0", - "google-caja": "5669", - "jed": "~1.1.1", - "jquery": "components/jquery#~3.5.0", - "jquery-typeahead": "~2.10.6", - "jquery-ui": "components/jqueryui#~1.12", - "marked": "~0.7", - "MathJax": "^2.7.4", - "moment": "~2.19.3", - "react": "~16.0.0", - "requirejs": "~2.2", - "requirejs-text": "~2.0.15", - "requirejs-plugins": "~1.0.3", - "text-encoding": "~0.1", - "underscore": "components/underscore#~1.8.3", - "xterm.js": "https://unpkg.com/xterm@~3.1.0/dist/xterm.js", - "xterm.js-css": "https://unpkg.com/xterm@~3.1.0/dist/xterm.css", - "xterm.js-fit": "https://unpkg.com/xterm@~3.1.0/dist/addons/fit/fit.js" - } -} diff --git a/nbclassic/templates/page.html b/nbclassic/templates/page.html index 223731903..35ec629ba 100644 --- a/nbclassic/templates/page.html +++ b/nbclassic/templates/page.html @@ -7,7 +7,7 @@ {% block title %}Jupyter Notebook{% endblock %} {% block favicon %}{% endblock %} - + @@ -15,10 +15,10 @@ {% endblock %} - - - - + + + +