Skip to content

Commit 200a58c

Browse files
authored
Merge pull request #2319 from gnestor/preact
Move preact, preact-compat, and proptypes to bower
2 parents 003f553 + b69509f commit 200a58c

File tree

5 files changed

+9
-26
lines changed

5 files changed

+9
-26
lines changed

bower.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"marked": "~0.3",
1616
"MathJax": "components/MathJax#~2.6",
1717
"moment": "~2.8.4",
18+
"preact": "https://unpkg.com/preact@^7.2.0/dist/preact.min.js",
19+
"preact-compat": "https://unpkg.com/preact-compat@^3.14.3/dist/preact-compat.min.js",
20+
"proptypes": "https://unpkg.com/proptypes@^0.14.4/index.js",
1821
"requirejs": "~2.1",
1922
"text-encoding": "~0.1",
2023
"underscore": "components/underscore#~1.8.3",

notebook/static/notebook/js/shortcuteditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ define([
55
"jquery",
66
"notebook/js/quickhelp",
77
"base/js/dialog",
8-
'components/marked/lib/marked',
8+
"components/marked/lib/marked"
99
], function (
1010
$,
1111
QH,

notebook/templates/page.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
{% endblock %}
1717
<link rel="stylesheet" href="{{ base_url }}custom/custom.css" type="text/css" />
1818
<script src="{{static_url("components/es6-promise/promise.min.js")}}" type="text/javascript" charset="utf-8"></script>
19-
<script src="{{static_url('components/preact/dist/preact.min.js')}}" type="text/javascript"></script>
19+
<script src="{{static_url('components/preact/index.js')}}" type="text/javascript"></script>
2020
<script src="{{static_url('components/proptypes/index.js')}}" type="text/javascript"></script>
21-
<script src="{{static_url('components/preact-compat/dist/preact-compat.min.js')}}" type="text/javascript"></script>
21+
<script src="{{static_url('components/preact-compat/index.js')}}" type="text/javascript"></script>
2222
<script src="{{static_url('components/requirejs/require.js') }}" type="text/javascript" charset="utf-8"></script>
2323
<script>
2424
require.config({

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,5 @@
1919
"requirejs": "^2.1.17"
2020
},
2121
"dependencies": {
22-
"preact": "^7.1.0",
23-
"preact-compat": "^3.9.4"
2422
}
2523
}

setupbase.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def find_package_data():
147147
pjoin(components, "jquery-ui", "themes", "smoothness", "jquery-ui.min.css"),
148148
pjoin(components, "jquery-ui", "themes", "smoothness", "images", "*"),
149149
pjoin(components, "marked", "lib", "marked.js"),
150-
pjoin(components, "preact", "dist", "preact.min.js"),
151-
pjoin(components, "preact-compat", "dist", "preact-compat.min.js"),
150+
pjoin(components, "preact", "index.js"),
151+
pjoin(components, "preact-compat", "index.js"),
152152
pjoin(components, "proptypes", "index.js"),
153153
pjoin(components, "requirejs", "require.js"),
154154
pjoin(components, "underscore", "underscore-min.js"),
@@ -354,14 +354,6 @@ def should_run(self):
354354
if not os.path.exists(self.bower_dir):
355355
return True
356356

357-
# check npm packages
358-
for pkg in ['preact', 'preact-compat', 'proptypes']:
359-
npm_pkg = os.path.join(self.node_modules, pkg)
360-
bower_pkg = os.path.join(self.bower_dir, pkg)
361-
if not os.path.exists(npm_pkg) or not os.path.exists(bower_pkg):
362-
return True
363-
if mtime(bower_pkg) < mtime(npm_pkg):
364-
return True
365357
return mtime(self.bower_dir) < mtime(pjoin(repo_root, 'bower.json'))
366358

367359
def should_run_npm(self):
@@ -372,16 +364,6 @@ def should_run_npm(self):
372364
return True
373365
return mtime(self.node_modules) < mtime(pjoin(repo_root, 'package.json'))
374366

375-
def npm_components(self):
376-
"""Stage npm frontend dependencies into components"""
377-
for pkg in ['preact', 'preact-compat', 'proptypes']:
378-
npm_pkg = os.path.join(self.node_modules, pkg)
379-
bower_pkg = os.path.join(self.bower_dir, pkg)
380-
log.info("Staging %s -> %s" % (npm_pkg, bower_pkg))
381-
if os.path.exists(bower_pkg):
382-
shutil.rmtree(bower_pkg)
383-
shutil.copytree(npm_pkg, bower_pkg)
384-
385367
def patch_codemirror(self):
386368
"""Patch CodeMirror until https://github.com/codemirror/CodeMirror/issues/4454 is resolved"""
387369

@@ -415,7 +397,7 @@ def run(self):
415397
print("You can install js dependencies with `npm install`", file=sys.stderr)
416398
raise
417399
self.patch_codemirror()
418-
self.npm_components()
400+
# self.npm_components()
419401
os.utime(self.bower_dir, None)
420402
# update package data in case this created new files
421403
update_package_data(self.distribution)

0 commit comments

Comments
 (0)