-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wip] Use yarn to manage frontend dependencies #314
base: develop
Are you sure you want to change the base?
Changes from all commits
420e3f9
8881d16
948edff
07ca35a
33c5412
37ca918
92a1673
e740f91
38153e2
974edcb
80abfea
b9d9871
6231b2c
45c61f7
f84eecb
2baaee9
4f8a90d
49b0d74
78f0564
5cdd63e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,3 +72,9 @@ player/static/mfr/* | |
!.gitkeep | ||
|
||
.cache | ||
|
||
# JS | ||
####################### | ||
|
||
node_modules | ||
node_modules/* | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,10 @@ ENV GIT_COMMIT ${GIT_COMMIT} | |
|
||
RUN python setup.py develop | ||
|
||
RUN apt-get install nodejs \ | ||
apt-get install npm \ | ||
&& npm run build | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to check, should install all deps and build everything into dist |
||
EXPOSE 7778 | ||
|
||
CMD ["gosu", "www-data", "invoke", "server"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,14 @@ invoke install | |
invoke server | ||
``` | ||
|
||
Also set up node for frontend packages. The recommended package manager is `yarn`. | ||
Webpack is used to build the packages. A script is included in `package.json` for convenience. | ||
|
||
```bash | ||
yarn | ||
yarn build | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some instructions |
||
|
||
### Configuring | ||
|
||
MFR configuration is done through a JSON file (`mfr-test.json`) that lives in the `.cos` directory of your home directory. If this is your first time setting up MFR or its sister project, [WaterButler](https://github.com/CenterForOpenScience/waterbutler/), you probably do not have this directory and will need to create it: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,4 @@ | |
Your browser does not support the audio tag. | ||
</audio> | ||
|
||
<script src="/static/js/mfr.js"></script> | ||
<script src="/static/js/mfr.child.js"></script> | ||
<script src="/assets/mfr.child.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only reason mfr.js was included prior was to get pym.js library in the iframe. Webpack builds it in now. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,7 @@ pre { | |
overflow: auto; | ||
display: block; | ||
padding: 9.5px; | ||
margin: 0px 0px 10px; | ||
margin: 0px 0px 0px 0px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix some broken css |
||
font-size: 13px; | ||
line-height: 1.42857; | ||
background-color: #F5F5F5; | ||
|
@@ -80,4 +80,4 @@ code, kbd, pre, samp { | |
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
<link rel="stylesheet" href="${base}/css/default.css"> | ||
<script src="/assets/codepygments.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. webpacked script to get the css on the page. This is probably not worth it for this extension, but it would make sense to keep consistency |
||
|
||
<div style="word-wrap: break-word;" class="mfrViewer"> | ||
${body} | ||
</div> | ||
|
||
<script src="/static/js/mfr.js"></script> | ||
<script src="/static/js/mfr.child.js"></script> | ||
<script src="/assets/mfr.child.js"></script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<img style="max-width: 100%;" src="${url}"> | ||
|
||
<script src="/static/js/mfr.js"></script> | ||
<script src="/static/js/mfr.child.js"></script> | ||
<script src="/assets/mfr.child.js"></script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,47 @@ | ||
<link rel="stylesheet" href="/static/css/bootstrap.min.css"> | ||
<style type="text/css"> | ||
.popover { | ||
max-width: 100%; | ||
} | ||
</style> | ||
<script src="/static/js/jquery-1.11.3.min.js" type="text/javascript"></script> | ||
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script> | ||
|
||
<script> | ||
window.fileUrl = '${url}'; | ||
window.ext = '${ext}'; | ||
</script> | ||
|
||
<canvas id="mfrViewer" tabindex="-1"></canvas> | ||
<a style="position: absolute; top: 10px; right: 10px; cursor: pointer;" | ||
data-toggle="popover" data-trigger="hover" data-placement="left" data-html="true" | ||
data-content="<p><b> Rotate:</b> Click and drag</p> | ||
<p><b> Pan:</b> Ctrl + click and drag</p> | ||
<p><b> Zoom:</b> Shift + click and drag up/down</p>"> | ||
<img src="${base}/images/question-circle.png"> | ||
<img src="/assets/question-circle.png"> | ||
</a> | ||
|
||
<script src="/static/js/mfr.js"></script> | ||
<script src="/static/js/mfr.child.js"></script> | ||
<script src="/assets/jsc3d-init.js"></script> | ||
|
||
<script src="/assets/mfr.child.js"></script> | ||
|
||
<!--[if !IE]><!--> | ||
<script type="text/javascript" src="${base}/js/jsc3d.js"></script> | ||
<script type="text/javascript" src="/assets/jsc3d.js"></script> | ||
<!--<![endif]--> | ||
<!--[if IE]> | ||
<script type="text/javascript" src="${base}/js/jsc3d_ie.js"></script> | ||
<script type="text/javascript" src="/assets/jsc3d_ie.js"></script> | ||
<script type="text/javascript"> | ||
JSC3D.Texture.cv = document.getElementById('mfrViewer'); | ||
</script> | ||
<![endif]--> | ||
<script src="${base}/js/jsc3d.touch.js"></script> | ||
<script src="${base}/js/jsc3d.webgl.js"></script> | ||
<script src="/assets/jsc3d.touch.js"></script> | ||
<script src="/assets/jsc3d.webgl.js"></script> | ||
|
||
% if ext in ['.3ds']: | ||
<script src="${base}/js/jsc3d.3ds.js"></script> | ||
<script src="/assets/jsc3d.3ds.js"></script> | ||
% elif ext in ['.ctm']: | ||
<script src="${base}/js/jsc3d.ctm.js"></script> | ||
<script src="/assets/jsc3d.ctm.js"></script> | ||
% endif | ||
|
||
<script> | ||
$(function () { | ||
$('[data-toggle="popover"]').popover(); | ||
$('#mfrViewer').bind('contextmenu', function () { return false; }); | ||
window.focus(); | ||
|
||
var canvas = document.getElementById('mfrViewer'); | ||
canvas.width = window.innerWidth; | ||
canvas.height = 500; | ||
|
||
var viewer = new JSC3D.Viewer(canvas); | ||
viewer.setParameter('SceneUrl', '${ext}'); | ||
viewer.setParameter('InitRotationX', -15); | ||
viewer.setParameter('InitRotationY', 0); | ||
viewer.setParameter('InitRotationZ', 0); | ||
viewer.setParameter('ModelColor', '#CCCCCC'); | ||
viewer.setParameter('BackgroundColor1', '#FFFFFF'); | ||
viewer.setParameter('BackgroundColor2', '#FFFFFF'); | ||
viewer.setParameter('RenderMode', 'textureflat'); | ||
viewer.setParameter('MipMapping', 'on'); | ||
viewer.setParameter('Renderer', 'webgl'); | ||
viewer.setParameter('Definition', 'high'); | ||
console.log("FIRST"); | ||
</script> | ||
|
||
var _getLoader = JSC3D.LoaderSelector.getLoader; | ||
JSC3D.LoaderSelector.getLoader = function (fileExtName) { | ||
var loader = _getLoader(fileExtName); | ||
if (!loader) { | ||
return viewer.reportProgress('Unable to load renderer for file of type \'' + fileExtName + '\'', 0); | ||
} | ||
var _loadFromUrl = loader.loadFromUrl; | ||
loader.loadFromUrl = _loadFromUrl.bind(loader, '${url}'); | ||
return loader; | ||
}; | ||
|
||
viewer.init(); | ||
viewer.update(); | ||
}); | ||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't want node_modules committed