A quick way to gather almost example modules of threejs
-
- Using shell to list all modules to a custom file
cd node_modules/three
egrep "export (const|function|class|interface)" examples/* -nr | grep "\.d\.ts" | egrep -v "\/GLTFLoader|\/VTKLoader|\/XLoader|\/TessellateModifier|\/Water2|\/BokehShader2|\/TextureCubeUVNode|\/TextureCubeNode|\/SubSlot" | awk -F: '{print $1}' | sed s/\.d\.ts//g | sort | uniq | awk '{print "export * from '\''three/" $1 "'\'';"}' > /yourpath/somefile.ts
-
- Add the remaining modules to /yourpath/somefile.ts
export { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
export { Water as Water2 } from 'three/examples/jsm/objects/Water2';
export { BokehShader as BokehShader2 } from 'three/examples/jsm/shaders/BokehShader2';
// The following modules can be imported separately manually
// import { VRMLLoader as XLoader } from 'three/examples/jsm/loaders/XLoader';
// import { VRMLLoader as VTKLoader } from 'three/examples/jsm/loaders/VTKLoader';
// import { SubdivisionModifier as TessellateModifier } from 'three/examples/jsm/modifiers/TessellateModifier';
-
- other discussions
-
- Using shell to list all modules to a custom file
cd node_modules/three
egrep "export (const|function|class|interface)" examples/* -nr | grep "\.d\.ts" | egrep -v "\/GLTFLoader|\/VTKLoader|\/XLoader|\/TessellateModifier|\/Water2|\/BokehShader2|\/TextureCubeUVNode|\/TextureCubeNode|\/SubSlot" | awk -F: '{print $1}' | sed s/\.d\.ts//g | sort | uniq | awk '{print "export * from '\''three/" $1 "'\'';"}' > /yourpath/somefile.ts
egrep "export (const|function|class|interface)" src/extras/* -nr | grep "\.d\.ts" | awk -F: '{print $1}' | sed s/\.d\.ts//g | sort | uniq | awk '{print "export * from '\''three/" $1 "'\'';"}' >> /yourpath/somefile.ts
-
- Add the remaining modules to /yourpath/somefile.ts
export { GLTFLoader, GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
export { Water as Water2 } from 'three/examples/jsm/objects/Water2';
export { BokehShader as BokehShader2 } from 'three/examples/jsm/shaders/BokehShader2';