Skip to content

Commit

Permalink
modularize (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasplesch authored Jul 21, 2024
1 parent e3f33c9 commit a8d655e
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion build/src-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 );
Expand Down

0 comments on commit a8d655e

Please sign in to comment.