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

cli option to output files as individual part files or .zip of parts #1263

Closed tsdexter closed 1 year ago

tsdexter commented 1 year ago

Adds the CLI export utilities a -p flag to output multiple parts as separate files as well as a -z flag to zip the multiple files into one design.zip exported file

related: https://github.com/jscad/OpenJSCAD.org/issues/1262

All Submissions:

Note: please do NOT include build files (those generate by the build-xxx commands) with your PR,

Thank you for your help in advance, much appreciated !

tsdexter commented 1 year ago

Example CLI output jscad index.js -p -z:

image

Example CLI output: jscad index.js -p:

image

Example Filesystem output from both commands, after extracting the .zip:

image
tsdexter commented 1 year ago

I will make adjustments sometime tomorrow. I agree generateParts would be less ambiguous.

I also thought about having zip flag for single part exports as well, but figured it wasn't necessary as they will always be one file anyway. However, I think there is still the use case of having a zip file for sharing and other use cases where certain formats are disallowed. I will add it as an option for all export types.

tsdexter commented 1 year ago

@z3dev I've added zip functionality to all exports (single or multi-file). I've created a test for single file .zip exports as well as refactoring the zip tests to actually check the contents of the zip file, instead of just its existence.

tsdexter commented 1 year ago

@z3dev another feature that would be useful for me specifically is a license flag. I would envision its use like:

jscad index.js -l "path/to/license.txt"

If the flag is used and the file exists, it would automatically use the .zip functionality and export all of your models files alongside the license.txt in a .zip file.

Should I add this to the CLI as a useful feature for everyone, or do you think this should be handled in my own workflow?

tsdexter commented 1 year ago

@z3dev whats the process for merging/releasing?