mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-30 12:11:32 +08:00
Merge pull request #2319 from gnestor/preact
Move preact, preact-compat, and proptypes to bower
This commit is contained in:
commit
200a58c399
@ -15,6 +15,9 @@
|
||||
"marked": "~0.3",
|
||||
"MathJax": "components/MathJax#~2.6",
|
||||
"moment": "~2.8.4",
|
||||
"preact": "https://unpkg.com/preact@^7.2.0/dist/preact.min.js",
|
||||
"preact-compat": "https://unpkg.com/preact-compat@^3.14.3/dist/preact-compat.min.js",
|
||||
"proptypes": "https://unpkg.com/proptypes@^0.14.4/index.js",
|
||||
"requirejs": "~2.1",
|
||||
"text-encoding": "~0.1",
|
||||
"underscore": "components/underscore#~1.8.3",
|
||||
|
@ -5,7 +5,7 @@ define([
|
||||
"jquery",
|
||||
"notebook/js/quickhelp",
|
||||
"base/js/dialog",
|
||||
'components/marked/lib/marked',
|
||||
"components/marked/lib/marked"
|
||||
], function (
|
||||
$,
|
||||
QH,
|
||||
|
@ -16,9 +16,9 @@
|
||||
{% endblock %}
|
||||
<link rel="stylesheet" href="{{ base_url }}custom/custom.css" type="text/css" />
|
||||
<script src="{{static_url("components/es6-promise/promise.min.js")}}" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="{{static_url('components/preact/dist/preact.min.js')}}" type="text/javascript"></script>
|
||||
<script src="{{static_url('components/preact/index.js')}}" type="text/javascript"></script>
|
||||
<script src="{{static_url('components/proptypes/index.js')}}" type="text/javascript"></script>
|
||||
<script src="{{static_url('components/preact-compat/dist/preact-compat.min.js')}}" type="text/javascript"></script>
|
||||
<script src="{{static_url('components/preact-compat/index.js')}}" type="text/javascript"></script>
|
||||
<script src="{{static_url('components/requirejs/require.js') }}" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
require.config({
|
||||
|
@ -19,7 +19,5 @@
|
||||
"requirejs": "^2.1.17"
|
||||
},
|
||||
"dependencies": {
|
||||
"preact": "^7.1.0",
|
||||
"preact-compat": "^3.9.4"
|
||||
}
|
||||
}
|
||||
|
24
setupbase.py
24
setupbase.py
@ -147,8 +147,8 @@ def find_package_data():
|
||||
pjoin(components, "jquery-ui", "themes", "smoothness", "jquery-ui.min.css"),
|
||||
pjoin(components, "jquery-ui", "themes", "smoothness", "images", "*"),
|
||||
pjoin(components, "marked", "lib", "marked.js"),
|
||||
pjoin(components, "preact", "dist", "preact.min.js"),
|
||||
pjoin(components, "preact-compat", "dist", "preact-compat.min.js"),
|
||||
pjoin(components, "preact", "index.js"),
|
||||
pjoin(components, "preact-compat", "index.js"),
|
||||
pjoin(components, "proptypes", "index.js"),
|
||||
pjoin(components, "requirejs", "require.js"),
|
||||
pjoin(components, "underscore", "underscore-min.js"),
|
||||
@ -354,14 +354,6 @@ class Bower(Command):
|
||||
if not os.path.exists(self.bower_dir):
|
||||
return True
|
||||
|
||||
# check npm packages
|
||||
for pkg in ['preact', 'preact-compat', 'proptypes']:
|
||||
npm_pkg = os.path.join(self.node_modules, pkg)
|
||||
bower_pkg = os.path.join(self.bower_dir, pkg)
|
||||
if not os.path.exists(npm_pkg) or not os.path.exists(bower_pkg):
|
||||
return True
|
||||
if mtime(bower_pkg) < mtime(npm_pkg):
|
||||
return True
|
||||
return mtime(self.bower_dir) < mtime(pjoin(repo_root, 'bower.json'))
|
||||
|
||||
def should_run_npm(self):
|
||||
@ -372,16 +364,6 @@ class Bower(Command):
|
||||
return True
|
||||
return mtime(self.node_modules) < mtime(pjoin(repo_root, 'package.json'))
|
||||
|
||||
def npm_components(self):
|
||||
"""Stage npm frontend dependencies into components"""
|
||||
for pkg in ['preact', 'preact-compat', 'proptypes']:
|
||||
npm_pkg = os.path.join(self.node_modules, pkg)
|
||||
bower_pkg = os.path.join(self.bower_dir, pkg)
|
||||
log.info("Staging %s -> %s" % (npm_pkg, bower_pkg))
|
||||
if os.path.exists(bower_pkg):
|
||||
shutil.rmtree(bower_pkg)
|
||||
shutil.copytree(npm_pkg, bower_pkg)
|
||||
|
||||
def patch_codemirror(self):
|
||||
"""Patch CodeMirror until https://github.com/codemirror/CodeMirror/issues/4454 is resolved"""
|
||||
|
||||
@ -415,7 +397,7 @@ class Bower(Command):
|
||||
print("You can install js dependencies with `npm install`", file=sys.stderr)
|
||||
raise
|
||||
self.patch_codemirror()
|
||||
self.npm_components()
|
||||
# self.npm_components()
|
||||
os.utime(self.bower_dir, None)
|
||||
# update package data in case this created new files
|
||||
update_package_data(self.distribution)
|
||||
|
Loading…
Reference in New Issue
Block a user