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.65k stars 514 forks source link

V3 Pre-relese Preparations #1286

Closed z3dev closed 1 year ago

z3dev commented 1 year ago

These changes adjust the packages as well as the rollup configurations. All packages now rollup to complete self-enclosing libraries, minimal code with un-mangled names.

NOTE: No code logic was changed.

All Submissions:

z3dev commented 1 year ago

@platypii @hrgdavor sorry for another large set of changes. the packages are now ready for publishing. ;)

hopefully, i can publish V3 alpha releases in the next few weeks.

hrgdavor commented 1 year ago

@z3dev I would like to draw attention to one thing: I am personally for moving away from automagic require('') loading STL or other formats, but it will continue to be fully supported for jscad V2 scripts in new jscad prototype. I prefer for V3 code to be as close to a regular js project, so idea is to make jscad io easily usable in any js project, not just jscad scripts. I am working on input type=file and from first attempts jcad/io ergonomy is bit awkward.

ideally a script would import {deserialize} from '@jscad/io' or more specific import {deserializeStl} from '@jscad/io' and then

import {deserialize} from '@jscad/io'
export const main({inputFile, numOfSlices=10}){
  const object = deserialize(inputFile.name, inputFile.content)
  // return sliced object
}

that way such script could be used in nodejs

import {readFIleSync} from 'fs'
import * as slicer from './slicer.js'

const name = process.argv[1]
const content = readFileSync(name)
const sliced = slicer.main({inputFile={name,content}})
// do something with sliced object
z3dev commented 1 year ago

@z3dev I would like to draw attention to one thing:

@hrgdavor Not sure why this was added to a closed merge request.

Wouldn't this be best as a discussion point? These ideas are going to get lost very soon.

hrgdavor commented 1 year ago

@z3dev I was eager to make the point. I will create a discussion page. We should look more into API from a perspective of how we would like to write jscad scripts more easily. ... copied the comment to #1289 discussion