From a8d655ecd7e3cf8ac9fe8bfb8f8e8a07d7226c14 Mon Sep 17 00:00:00 2001 From: Andreas Plesch Date: Sun, 21 Jul 2024 15:25:47 -0400 Subject: [PATCH] modularize (#392) --- build/src-builder.js | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/build/src-builder.js b/build/src-builder.js index f9fa1142a9..643b1df988 100644 --- a/build/src-builder.js +++ b/build/src-builder.js @@ -76,7 +76,9 @@ async function concatVersions() version[ packageName ] = version[ packageName ].replace( "__X3DOM_REVISION__", REVISION ); version[ packageName ] = version[ packageName ].replace( "__X3DOM_DATE__", DATE ); } - + version[ packageName + "_MODULE"] = `${version[packageName]} +export default x3dom; +export { x3dom };`; lastPackageName = packageName; } @@ -100,38 +102,74 @@ async function build() versions[ "BASIC_MIN" ] = terser.minify( versions[ "BASIC" ], terser_options ).code; + console.log( "> Minify x3dom-module.js ..." ); + + versions[ "BASIC_MODULE_MIN" ] = terser.minify( versions[ "BASIC_MODULE" ], terser_options ).code; + console.log( "> Minify x3dom-full.js ..." ); versions[ "FULL_MIN" ] = terser.minify( versions[ "FULL" ], terser_options ).code; + console.log( "> Minify x3dom-full-module.js ..." ); + + versions[ "FULL_MODULE_MIN" ] = terser.minify( versions[ "FULL_MODULE" ], terser_options ).code; + console.log( "> Minify x3dom-physics.js ..." ); versions[ "PHYSICS_MIN" ] = terser.minify( versions[ "PHYSICS" ], terser_options ).code; + console.log( "> Minify x3dom-physics-module.js ..." ); + + versions[ "PHYSICS_MODULE_MIN" ] = terser.minify( versions[ "PHYSICS_MODULE" ], terser_options ).code; + console.log( "> Write x3dom.debug.js ..." ); fs.writeFileSync( DIST_FOLDER + "x3dom.debug.js", HEADER + versions[ "BASIC" ] ); + console.log( "> Write x3dom-module.debug.js ..." ); + + fs.writeFileSync( DIST_FOLDER + "x3dom-module.debug.js", HEADER + versions[ "BASIC_MODULE" ] ); + console.log( "> Write x3dom.js ..." ); fs.writeFileSync( DIST_FOLDER + "x3dom.js", HEADER + versions[ "BASIC_MIN" ] ); + console.log( "> Write x3dom-module.js ..." ); + + fs.writeFileSync( DIST_FOLDER + "x3dom-module.js", HEADER + versions[ "BASIC_MODULE_MIN" ] ); + console.log( "> Write x3dom-full.debug.js ..." ); fs.writeFileSync( DIST_FOLDER + "x3dom-full.debug.js", HEADER + versions[ "FULL" ] ); + console.log( "> Write x3dom-full-module.debug.js ..." ); + + fs.writeFileSync( DIST_FOLDER + "x3dom-full-module.debug.js", HEADER + versions[ "FULL_MODULE" ] ); + console.log( "> Write x3dom-full.js ..." ); fs.writeFileSync( DIST_FOLDER + "x3dom-full.js", HEADER + versions[ "FULL_MIN" ] ); + console.log( "> Write x3dom-full-module.js ..." ); + + fs.writeFileSync( DIST_FOLDER + "x3dom-full-module.js", HEADER + versions[ "FULL_MODULE_MIN" ] ); + console.log( "> Write x3dom-physics.debug.js ..." ); fs.writeFileSync( DIST_FOLDER + "x3dom-physics.debug.js", HEADER + versions[ "PHYSICS" ] ); + console.log( "> Write x3dom-physics-module.debug.js ..." ); + + fs.writeFileSync( DIST_FOLDER + "x3dom-physics-module.debug.js", HEADER + versions[ "PHYSICS_MODULE" ] ); + console.log( "> Write x3dom-physics.js ..." ); fs.writeFileSync( DIST_FOLDER + "x3dom-physics.js", HEADER + versions[ "PHYSICS_MIN" ] ); + console.log( "> Write x3dom-physics-module.js ..." ); + + fs.writeFileSync( DIST_FOLDER + "x3dom-physics-module.js", HEADER + versions[ "PHYSICS_MODULE_MIN" ] ); + console.log( "> Write VERSION ..." ); fs.writeFileSync( DIST_FOLDER + "VERSION", VERSION_FILE );