Skip to content

[FEAT] Update to ES6 Modules #8

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

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
343c2f4
Naively Replace ES5 Module Syntax with ES6 Module Syntax
zalo Feb 13, 2021
0f1f988
Replace the Originals
zalo Feb 13, 2021
0415d75
Replace a few more originals
zalo Feb 13, 2021
fb4bca7
Fix the test import paths
zalo Feb 13, 2021
8c70588
Delete the redundant "node" files
zalo Feb 13, 2021
222e981
Fix MemoryManager Export and Imports
zalo Feb 13, 2021
dc3d95d
Switch Direction Field to ES6 Modules; Update Three.js
zalo Feb 13, 2021
1e32060
Switch Discrete Curvature to ES6
zalo Feb 13, 2021
dc70fd3
Switch Discrete Exterior Calculus to ES6
zalo Feb 13, 2021
aec1174
Update Geodesic Distance to ES6
zalo Feb 13, 2021
0065653
Update Mean Curvature Flow to ES6
zalo Feb 13, 2021
7c61ee2
Update Parameterization to ES6
zalo Feb 13, 2021
5ae6cdb
Update Poisson Problem to ES6
zalo Feb 13, 2021
0bde148
Update Simplicial Complex Operators to ES6
zalo Feb 13, 2021
b4b45ac
Update Vector Field Decomposition to ES6
zalo Feb 13, 2021
fd57f93
Remove Unused Imports
zalo Feb 13, 2021
76f9e3d
Remove Unused Helpers (TODO: Replace with CDN)
zalo Feb 13, 2021
7272c86
Begin Getting Tests to Work
zalo Feb 13, 2021
b22d524
Use a Github Actions formatted Reporter
zalo Feb 13, 2021
4c7735f
Replace Original Tests, Fix Simplicial Complex Operator Test
zalo Feb 13, 2021
02e2bd5
Fix Testing Folder Reference
zalo Feb 13, 2021
da9b228
Begin reworking the docs generation
zalo Feb 14, 2021
b6ca6dd
Add Module Descriptions back to linear-algebra for JSDoc
zalo Feb 14, 2021
6861b6b
Fix Trivial Connections Link
zalo Feb 14, 2021
bad0fe2
Fix Sparse Matrix Exports
zalo Feb 14, 2021
6b5102d
Make Doc Rebuilding Automatic
zalo Feb 14, 2021
f3d6d0f
Create a Doc Author when Committing Updated Docs
zalo Feb 14, 2021
8a206e6
Rebuild Docs
actions-user Feb 14, 2021
f49b535
Fix the Image URLs after Generation
zalo Feb 14, 2021
c012cd4
Rebuild Docs
actions-user Feb 14, 2021
0d6e5dc
Switch threejs-example-modules to a version-stable CDN
zalo Feb 14, 2021
795a907
Merge branch 'feat-es6-modules' of https://github.com/zalo/geometry-p…
zalo Feb 14, 2021
e013bab
Publish this branch to Github Pages for validation
zalo Feb 14, 2021
4d7f12d
Fix three.js being loaded multiple times
zalo Feb 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: geometry-processing - Continuous Integration

on:
push

jobs:
test:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
lfs: true

- name: Install Testing Frameworks
run: |
echo '{ "type": "module", "scripts": { "test": "mocha tests/**/*.js --reporter mocha-github-actions-reporter" } }' >package.json
npm install --save-dev mocha chai mocha-github-actions-reporter

- name: Run Unit Tests
timeout-minutes: 5
run: npm test

docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
lfs: true

- name: Install Doc Generation Frameworks
run: |
echo '{ "type": "module", "scripts": { "docs": "jsdoc -c doc-config/jsdoc.conf.json -t node_modules/ink-docstrap/template/ -R README.md -r -d docs ./" } }' >package.json
npm install --save-dev jsdoc ink-docstrap

- name: Pre-Process Docs
run: |
cp doc-config/site.cosmo-rohan.css node_modules/ink-docstrap/template/static/styles/site.cosmo-rohan.css

- name: Generate Docs
run: npm run docs

- name: Post-Process Docs
run: sed -e 's/imgs\//..\/imgs\//g' docs/index.html > docs/index.html.tmp && mv docs/index.html.tmp docs/index.html

- name: Commit Updated Docs
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Actions"
git add docs
git diff-index --quiet HEAD || git commit -m "Rebuild Docs"

- name: Push Changes to branch
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
4 changes: 2 additions & 2 deletions core/corner.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

class Corner {
/**
* This class represents a corner in a {@link module:Core.Mesh Mesh}. It is a convenience
Expand Down Expand Up @@ -58,3 +56,5 @@ class Corner {
return this.index;
}
}

export default Corner;
8 changes: 6 additions & 2 deletions core/discrete-exterior-calculus.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"use strict";
import LinearAlgebra from '../linear-algebra/linear-algebra.js';
let SparseMatrix = LinearAlgebra.SparseMatrix;
let Triplet = LinearAlgebra.Triplet;

/**
* This class contains methods to build common {@link https://cs.cmu.edu/~kmcrane/Projects/DDG/paper.pdf discrete exterior calculus} operators.
* This class contains methods to build common {@link https://www.cs.cmu.edu/~kmcrane/Projects/DDG/paper.pdf discrete exterior calculus} operators.
* @memberof module:Core
*/
class DEC {
Expand Down Expand Up @@ -124,3 +126,5 @@ class DEC {
return SparseMatrix.fromTriplet(T);
}
}

export default DEC;
4 changes: 2 additions & 2 deletions core/edge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

class Edge {
/**
* This class represents an edge in a {@link module:Core.Mesh Mesh}.
Expand Down Expand Up @@ -30,3 +28,5 @@ class Edge {
return this.index;
}
}

export default Edge;
6 changes: 3 additions & 3 deletions core/face.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

class Face {
/**
* This class represents a face in a {@link module:Core.Mesh Mesh}.
Expand Down Expand Up @@ -306,4 +304,6 @@ class FaceCornerIterator {
}
}
}
}
}

export default Face;
12 changes: 10 additions & 2 deletions core/geometry.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
"use strict";
import LinearAlgebra from '../linear-algebra/linear-algebra.js';
let Vector = LinearAlgebra.Vector;
let Complex = LinearAlgebra.Complex;
let SparseMatrix = LinearAlgebra.SparseMatrix;
let Triplet = LinearAlgebra.Triplet;
let ComplexSparseMatrix = LinearAlgebra.ComplexSparseMatrix;
let ComplexTriplet = LinearAlgebra.ComplexTriplet;

class Geometry {
/**
Expand Down Expand Up @@ -245,7 +251,7 @@ class Geometry {

/**
* Computes the circumcentric dual area of a vertex.
* @see {@link http://cs.cmu.edu/~kmcrane/Projects/Other/TriangleAreasCheatSheet.pdf}
* @see {@link http://www.cs.cmu.edu/~kmcrane/Projects/Other/TriangleAreasCheatSheet.pdf}
* @method module:Core.Geometry#circumcentricDualArea
* @param {module:Core.Vertex} v The vertex whose circumcentric dual area needs to be computed.
* @returns {number}
Expand Down Expand Up @@ -572,3 +578,5 @@ function normalize(positions, vertices, rescale = true) {
}
}
}

export { Geometry, normalize };
4 changes: 2 additions & 2 deletions core/halfedge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

/**
* This module implements a halfedge mesh data structure and its associated geometry.
* A halfedge mesh stores mesh elements such as vertices, edges and faces as well as
Expand Down Expand Up @@ -58,3 +56,5 @@ class Halfedge {
return this.index;
}
}

export default Halfedge;
4 changes: 2 additions & 2 deletions core/mesh-subset.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

class MeshSubset {
/**
* This class represents a subset of a {@link module:Core.Mesh Mesh}
Expand Down Expand Up @@ -212,3 +210,5 @@ class MeshSubset {
return true;
}
}

export default MeshSubset;
10 changes: 8 additions & 2 deletions core/mesh.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
"use strict";
import Vertex from './vertex.js';
import Edge from './edge.js';
import Face from './face.js';
import Halfedge from './halfedge.js';
import Corner from './corner.js';

class Mesh {
/**
Expand Down Expand Up @@ -207,7 +211,7 @@ class Mesh {
}

// index elements
this.indexElements();
this.indexElements();

return true;
}
Expand Down Expand Up @@ -401,3 +405,5 @@ function indexElements(elementList) {

return index;
}

export { Mesh, indexElements }
6 changes: 3 additions & 3 deletions core/vertex.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

class Vertex {
/**
* This class represents a vertex in a {@link module:Core.Mesh Mesh}.
Expand Down Expand Up @@ -335,4 +333,6 @@ class VertexCornerIterator {
}
}
}
}
}

export default Vertex;
2 changes: 1 addition & 1 deletion doc-config/jsdoc.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"hardwrap": true
},
"source": {
"excludePattern": "geometry-processing-js/node"
"excludePattern": "node_modules"
}
}
6 changes: 3 additions & 3 deletions docs/classes.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html#normalize">normalize</a></li><li><a href="global.html#indexElements">indexElements</a></li><li><a href="global.html#Detector">Detector</a></li><li><a href="global.html#clamp">clamp</a></li><li><a href="global.html#colormap">colormap</a></li><li><a href="global.html#hsv">hsv</a></li>
<li><a href="global.html#normalize">normalize</a></li><li><a href="global.html#indexElements">indexElements</a></li><li><a href="global.html#clamp">clamp</a></li><li><a href="global.html#colormap">colormap</a></li><li><a href="global.html#hsv">hsv</a></li>
</ul>
</li>

Expand Down Expand Up @@ -318,9 +318,9 @@ <h4 class="modal-title">Search results</h4>


<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a>

on Mon Jan 13th 2020
on Sun Feb 14th 2021

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
75 changes: 3 additions & 72 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html#normalize">normalize</a></li><li><a href="global.html#indexElements">indexElements</a></li><li><a href="global.html#Detector">Detector</a></li><li><a href="global.html#clamp">clamp</a></li><li><a href="global.html#colormap">colormap</a></li><li><a href="global.html#hsv">hsv</a></li>
<li><a href="global.html#normalize">normalize</a></li><li><a href="global.html#indexElements">indexElements</a></li><li><a href="global.html#clamp">clamp</a></li><li><a href="global.html#colormap">colormap</a></li><li><a href="global.html#hsv">hsv</a></li>
</ul>
</li>

Expand Down Expand Up @@ -152,75 +152,6 @@ <h2>



<h3 class="subsection-title">Members</h3>

<dl>

<hr>
<dt class="name" id="Detector">
<h4 id="Detector"><span class="type-signature"></span>Detector<span class="type-signature"></span></h4>


</dt>
<dd>





<dl class="details">



















<dt class="tag-author method-doc-label method-doc-details-label">Author:</dt>
<dd class="tag-author">
<ul>
<li>alteredq / http://alteredqualia.com/</li>

<li>mr.doob / http://mrdoob.com/</li>
</ul>
</dd>

















</dl>



</dd>

</dl>



<h3 class="subsection-title">Methods</h3>
Expand Down Expand Up @@ -1226,9 +1157,9 @@ <h4 class="modal-title">Search results</h4>


<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a>

on Mon Jan 13th 2020
on Sun Feb 14th 2021

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down
12 changes: 5 additions & 7 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li><a href="global.html#normalize">normalize</a></li><li><a href="global.html#indexElements">indexElements</a></li><li><a href="global.html#Detector">Detector</a></li><li><a href="global.html#clamp">clamp</a></li><li><a href="global.html#colormap">colormap</a></li><li><a href="global.html#hsv">hsv</a></li>
<li><a href="global.html#normalize">normalize</a></li><li><a href="global.html#indexElements">indexElements</a></li><li><a href="global.html#clamp">clamp</a></li><li><a href="global.html#colormap">colormap</a></li><li><a href="global.html#hsv">hsv</a></li>
</ul>
</li>

Expand Down Expand Up @@ -147,9 +147,7 @@ <h2>Dependencies (all included)</h2>
<h2>About Javascript</h2>
<p>The implementation of geometry-processing-js attempts to minimize the use of obscure Javascript language features. It should not be too difficult for anyone with experience in a dynamic language like Python or familiar with the principles of Object Oriented Programming to get a handle on Javascript syntax by reading through some of the code in this framework. The documentation contains examples specific to this framework which will also be of help. For a more formal introduction to Javascript, checkout this really nice <a href="https://javascript.info">tutorial</a>.</p>
<h2>Building the Documentation</h2>
<p>This documentation was generated using <a href="http://usejsdoc.org/">jsdoc</a> and <a href="https://www.npmjs.com/package/ink-docstrap">ink-docstrap</a>. We used a modified version of the <a href="http://docstrap.github.io/docstrap/themes/cosmo/">cosmo</a> theme. After installing jsdoc and ink-docstrap, you can build the documentation by running</p>
<pre class="prettyprint source"><code>jsdoc -c node_modules/ink-docstrap/template/jsdoc.conf.json -t node_modules/ink-docstrap/template/ -R geometry-processing-js/README.md -r -d geometry-processing-js/docs
</code></pre>
<p>See <a href="doc-config/build-instructions.md">guide here</a>.</p>
<h2>Authors</h2>
<p><a href="http://rohansawhney.io">Rohan Sawhney</a></p>
<p>Email: rohansawhney@cs.cmu.edu</p>
Expand Down Expand Up @@ -206,9 +204,9 @@ <h4 class="modal-title">Search results</h4>


<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.6</a>

on Mon Jan 13th 2020
on Sun Feb 14th 2021

using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
</span>
Expand Down Expand Up @@ -299,4 +297,4 @@ <h4 class="modal-title">Search results</h4>


</body>
</html>
</html>
Loading