haxiomic / dts2hx

Converts TypeScript definition files (d.ts) to haxe externs (.hx) via the TypeScript compiler API
MIT License
131 stars 8 forks source link

Is dts2hx support folder batch gen? #109

Open sonygod opened 2 years ago

sonygod commented 2 years ago

Is dts2hx support folder batch gen?

current I have to use a command-line like these, but this cmd is too long to excute.

Is dts2hx support folder batch gen?


npx dts2hx  three/examples/jsm/animation/AnimationClipCreator three/examples/jsm/animation/CCDIKSolver three/examples/jsm/animation/MMDAnimationHelper three/examples/jsm/animation/MMDPhysics three/examples/jsm/cameras/CinematicCamera three/examples/jsm/controls/ArcballControls three/examples/jsm/controls/DragControls three/examples/jsm/controls/FirstPersonControls three/examples/jsm/controls/FlyControls three/examples/jsm/controls/OrbitControls three/examples/jsm/controls/PointerLockControls three/examples/jsm/controls/TrackballControls three/examples/jsm/controls/TransformControls three/examples/jsm/csm/CSM three/examples/jsm/csm/CSMFrustum three/examples/jsm/csm/CSMHelper three/examples/jsm/csm/CSMShader three/examples/jsm/curves/CurveExtras three/examples/jsm/curves/NURBSCurve three/examples/jsm/curves/NURBSSurface three/examples/jsm/curves/NURBSUtils three/examples/jsm/deprecated/Geometry three/examples/jsm/effects/AnaglyphEffect three/examples/jsm/effects/AsciiEffect three/examples/jsm/effects/OutlineEffect three/examples/jsm/effects/ParallaxBarrierEffect three/examples/jsm/effects/PeppersGhostEffect three/examples/jsm/effects/StereoEffect three/examples/jsm/environments/RoomEnvironment three/examples/jsm/exporters/ColladaExporter three/examples/jsm/exporters/DRACOExporter three/examples/jsm/exporters/GLTFExporter three/examples/jsm/exporters/MMDExporter three/examples/jsm/exporters/OBJExporter three/examples/jsm/exporters/PLYExporter three/examples/jsm/exporters/STLExporter three/examples/jsm/exporters/USDZExporter three/examples/jsm/geometries/BoxLineGeometry three/examples/jsm/geometries/ConvexGeometry three/examples/jsm/geometries/DecalGeometry three/examples/jsm/geometries/LightningStrike three/examples/jsm/geometries/ParametricGeometries three/examples/jsm/geometries/ParametricGeometry three/examples/jsm/geometries/RoundedBoxGeometry three/examples/jsm/geometries/TeapotGeometry three/examples/jsm/geometries/TextGeometry three/examples/jsm/helpers/LightProbeHelper three/examples/jsm/helpers/PositionalAudioHelper three/examples/jsm/helpers/RectAreaLightHelper three/examples/jsm/helpers/VertexNormalsHelper three/examples/jsm/helpers/VertexTangentsHelper three/examples/jsm/interactive/HTMLMesh three/examples/jsm/interactive/InteractiveGroup three/examples/jsm/interactive/SelectionBox three/examples/jsm/interactive/SelectionHelper three/examples/jsm/libs/fflate.module.min three/examples/jsm/libs/stats.module three/examples/jsm/lights/LightProbeGenerator three/examples/jsm/lights/RectAreaLightUniformsLib three/examples/jsm/lines/Line2 three/examples/jsm/lines/LineGeometry three/examples/jsm/lines/LineMaterial three/examples/jsm/lines/LineSegments2 three/examples/jsm/lines/LineSegmentsGeometry three/examples/jsm/lines/Wireframe three/examples/jsm/lines/WireframeGeometry2 three/examples/jsm/loaders/3DMLoader three/examples/jsm/loaders/3MFLoader three/examples/jsm/loaders/AMFLoader three/examples/jsm/loaders/BasisTextureLoader three/examples/jsm/loaders/BVHLoader three/examples/jsm/loaders/ColladaLoader three/examples/jsm/loaders/DDSLoader three/examples/jsm/loaders/DRACOLoader three/examples/jsm/loaders/EXRLoader three/examples/jsm/loaders/FBXLoader three/examples/jsm/loaders/FontLoader three/examples/jsm/loaders/GCodeLoader three/examples/jsm/loaders/GLTFLoader three/examples/jsm/loaders/HDRCubeTextureLoader three/examples/jsm/loaders/IFCLoader three/examples/jsm/loaders/KMZLoader three/examples/jsm/loaders/KTX2Loader three/examples/jsm/loaders/KTXLoader three/examples/jsm/loaders/LDrawLoader three/examples/jsm/loaders/LogLuvLoader three/examples/jsm/loaders/LottieLoader three/examples/jsm/loaders/LUT3dlLoader three/examples/jsm/loaders/LUTCubeLoader three/examples/jsm/loaders/LWOLoader three/examples/jsm/loaders/MD2Loader three/examples/jsm/loaders/MDDLoader three/examples/jsm/loaders/MMDLoader three/examples/jsm/loaders/MTLLoader three/examples/jsm/loaders/NRRDLoader three/examples/jsm/loaders/OBJLoader three/examples/jsm/loaders/PCDLoader three/examples/jsm/loaders/PDBLoader three/examples/jsm/loaders/PLYLoader three/examples/jsm/loaders/PRWMLoader three/examples/jsm/loaders/PVRLoader three/examples/jsm/loaders/RGBELoader three/examples/jsm/loaders/RGBMLoader three/examples/jsm/loaders/STLLoader three/examples/jsm/loaders/SVGLoader three/examples/jsm/loaders/TDSLoader three/examples/jsm/loaders/TGALoader three/examples/jsm/loaders/TiltLoader three/examples/jsm/loaders/TTFLoader three/examples/jsm/loaders/VOXLoader three/examples/jsm/loaders/VRMLLoader three/examples/jsm/loaders/VRMLoader three/examples/jsm/loaders/VTKLoader three/examples/jsm/loaders/XYZLoader three/examples/jsm/math/Capsule three/examples/jsm/math/ColorConverter three/examples/jsm/math/ConvexHull three/examples/jsm/math/ImprovedNoise three/examples/jsm/math/Lut three/examples/jsm/math/MeshSurfaceSampler three/examples/jsm/math/OBB three/examples/jsm/math/Octree three/examples/jsm/math/SimplexNoise three/examples/jsm/misc/ConvexObjectBreaker three/examples/jsm/misc/GPUComputationRenderer three/examples/jsm/misc/Gyroscope three/examples/jsm/misc/MD2Character three/examples/jsm/misc/MD2CharacterComplex three/examples/jsm/misc/MorphAnimMesh three/examples/jsm/misc/MorphBlendMesh three/examples/jsm/misc/ProgressiveLightMap three/examples/jsm/misc/RollerCoaster three/examples/jsm/misc/TubePainter three/examples/jsm/misc/Volume three/examples/jsm/misc/VolumeSlice three/examples/jsm/modifiers/CurveModifier three/examples/jsm/modifiers/EdgeSplitModifier three/examples/jsm/modifiers/SimplifyModifier three/examples/jsm/modifiers/TessellateModifier three/examples/jsm/nodes/accessors/CameraNode three/examples/jsm/nodes/accessors/ColorsNode three/examples/jsm/nodes/accessors/LightNode three/examples/jsm/nodes/accessors/NormalNode three/examples/jsm/nodes/accessors/PositionNode three/examples/jsm/nodes/accessors/ReflectNode three/examples/jsm/nodes/accessors/ResolutionNode three/examples/jsm/nodes/accessors/ScreenUVNode three/examples/jsm/nodes/accessors/UVNode three/examples/jsm/nodes/core/AttributeNode three/examples/jsm/nodes/core/ConstNode three/examples/jsm/nodes/core/ExpressionNode three/examples/jsm/nodes/core/FunctionCallNode three/examples/jsm/nodes/core/FunctionNode three/examples/jsm/nodes/core/InputNode three/examples/jsm/nodes/core/Node three/examples/jsm/nodes/core/NodeBuilder three/examples/jsm/nodes/core/NodeFrame three/examples/jsm/nodes/core/NodeLib three/examples/jsm/nodes/core/NodeUniform three/examples/jsm/nodes/core/NodeUtils three/examples/jsm/nodes/core/StructNode three/examples/jsm/nodes/core/TempNode three/examples/jsm/nodes/core/VarNode three/examples/jsm/nodes/effects/BlurNode three/examples/jsm/nodes/effects/ColorAdjustmentNode three/examples/jsm/nodes/effects/LuminanceNode three/examples/jsm/nodes/inputs/BoolNode three/examples/jsm/nodes/inputs/ColorNode three/examples/jsm/nodes/inputs/CubeTextureNode three/examples/jsm/nodes/inputs/FloatNode three/examples/jsm/nodes/inputs/IntNode three/examples/jsm/nodes/inputs/Matrix3Node three/examples/jsm/nodes/inputs/Matrix4Node three/examples/jsm/nodes/inputs/PropertyNode three/examples/jsm/nodes/inputs/ReflectorNode three/examples/jsm/nodes/inputs/RTTNode three/examples/jsm/nodes/inputs/ScreenNode three/examples/jsm/nodes/inputs/TextureNode three/examples/jsm/nodes/inputs/Vector2Node three/examples/jsm/nodes/inputs/Vector3Node three/examples/jsm/nodes/inputs/Vector4Node three/examples/jsm/nodes/materials/BasicNodeMaterial three/examples/jsm/nodes/materials/MeshStandardNodeMaterial three/examples/jsm/nodes/materials/NodeMaterial three/examples/jsm/nodes/materials/nodes/BasicNode three/examples/jsm/nodes/materials/nodes/MeshStandardNode three/examples/jsm/nodes/materials/nodes/PhongNode three/examples/jsm/nodes/materials/nodes/RawNode three/examples/jsm/nodes/materials/nodes/SpriteNode
sonygod commented 2 years ago

current I have to use this tool to generate external.

package tools;

import haxe.Timer;
import haxe.io.Path;
import sys.FileSystem;

class GenDts2hxFiles {
    static var output = "npx dts2hx ";

    public static function main() {
        var folrder = "node_modules/@types/three/examples/jsm/";

        genJSM(folrder);

        //  trace(output);
    }

    public static function genJSM(path:String) {
        var arr:Array<String> = FileSystem.readDirectory(path);

        for (c in arr) {
            var tPath1:String = Path.join([path, c]);
            if (FileSystem.isDirectory(tPath1)) {
                genJSM(tPath1);
            } else {
                // trace(tPath1);

                var index = tPath1.lastIndexOf("/three");

                final process = new sys.io.Process("npx dts2hx " + Path.withoutExtension(Path.withoutExtension(tPath1.substring(index + 1))));

                if (process.exitCode() != 0) {
                    trace("Error running process command");
                }

                final lastCommitInfo = process.stdout.readLine();
                trace(lastCommitInfo);
                process.close();
            }
        }
    }
}