pex-renderer icon indicating copy to clipboard operation
pex-renderer copied to clipboard

Examples folder organisation

Open vorg opened this issue 6 years ago • 4 comments

We have moved to one js file per example structure with example-name.js files. That's great. But now we also have non-example-file.js there like build.js or helpers.js. It's a bit confusing as you need to read the source to find it is it example or not. It additionally breaks sketchbook-cli (multi file budo-like runner).

Proposal:

  • Move examples/build.js to examples/scripts/build.js
  • Move examples/helpers.js to examples/helpers/index.js or examples/lib/helpers.js
  • The examples/examples.js becomes then unnecessary as you can just do fs.readdir and filter all js files that we now know are only example files.
  • examples/index.html can be then generated too

Missing

  • common.js
  • index.js

vorg avatar Mar 20 '19 15:03 vorg

Or even better we could contribute to sketchbook-cli as gallery export in on wishlist there.

vorg avatar Mar 20 '19 15:03 vorg

helpers.js -> that should be in pex-renderer core or pex-helpers build.js -> that has been replaced by webpack.config.js examples.js -> that has been replaced by index.js index.html -> i guess we need that for design

@dmnsgn any feedback on this? Is there current setup messy for you? Can we live with one webpack js file or should we move sources to /src or build scripts to /lib ?

vorg avatar Sep 09 '19 08:09 vorg

Ideal examples structure:

  • webpack.config.js
  • index.js: entry to allow serving examples with dynamic imports
  • index.html: design and serve the build/main.js
  • one file per example
  • asset/screenshots/scripts folders

We're close to that, we just need to move helpers. Scripts could be in their own packages as well, as it would be nice to unify pex-renderer/context/gui/gl examples workflow.

Can we live with one webpack js file or should we move sources to /src or build scripts to /lib ?

Are you still talking about the examples here or pex-renderer lib? If the latter, we could have a single file at root folder with two entries:

  • generate UMD/ESM build
  • serve examples

dmnsgn avatar Sep 09 '19 08:09 dmnsgn

So i guess the next step is to implement https://github.com/pex-gl/pex-renderer/issues/72 and remove helpers

vorg avatar Sep 09 '19 10:09 vorg