jscad / OpenJSCAD.org

JSCAD is an open source set of modular, browser and command line tools for creating parametric 2D and 3D designs with JavaScript code. It provides a quick, precise and reproducible method for generating 3D models, and is especially useful for 3D printing applications.
https://openjscad.xyz/
MIT License
2.58k stars 505 forks source link

feat(modeling): flatten exports #1294

Closed platypii closed 9 months ago

platypii commented 10 months ago

Flattens the JSCAD export hierarchy, and exports everything as a top-level export from @jscad/modeling. As discussed in #1289

import { circle, geom3, union, colorize, translate } from '@jscad/modeling'

In the process of making this change, there were some name conflict with utils. So I made some choices about exactly which util functions to export: degToRad, radToDeg, sin, cos. Also exports the constants EPS, NEPS, TAU.

I updated @ aliases and @ examples to reflect the new export structure.

This is a big change, especially for users. But the more I think about it, the more I agree with @hrgdavor that this would make a cleaner API that is better for users in the long run.

Thoughts @z3dev?

All Submissions:

z3dev commented 10 months ago

I was just expecting a new top index with flattened exports, which looks good by the way. 👍

Are you sure that the doc changes are necessary now? I'm doing battle with JSDOC right now as the latest version breaks our documentation. And pretty much all examples in the docs have to be reviewed again. Just getting the docs back is going to be a huge task.

UG... all the other tests of packages failed as well. Maybe this needs to be completed in pieces.

platypii commented 10 months ago

I'm not certain about the doc changes, I can revert those and leave them for another PR.

I am working on updating IO to make the tests pass though with the flattened exports.

platypii commented 10 months ago

@z3dev I rolled back the changes to doc aliases. I also got tests passing by making changes to IO and core packages. The changes to modeling are small and easy to check (+48 lines, -80 lines)

Changes to modeling: https://github.com/jscad/OpenJSCAD.org/pull/1294/commits/6a8a208751799b446bb2864064c1417f4d9e0e3f

The changes to IO were much more extensive, mostly just changing imports to use import * from '@jscad/modeling' and removing use of geometries. and primitives..