Jelajahi Sumber

UtilsModularizeJsEscapeNtoEOL

gonnavis 4 tahun lalu
induk
melakukan
dc33fc3fc1
1 mengubah file dengan 5 tambahan dan 4 penghapusan
  1. 5 4
      utils/modularize.js

+ 5 - 4
utils/modularize.js

@@ -1,4 +1,5 @@
 var fs = require( 'fs' );
+var os = require('os'), EOL = os.EOL;
 THREE = require( '../build/three.js' );
 
 var srcFolder = __dirname + '/../examples/js/';
@@ -295,7 +296,7 @@ function convert( path, exampleDependencies, ignoreList ) {
 
 	var keys = Object.keys( coreDependencies )
 		.filter( value => ! classNames.includes( value ) )
-		.map( value => '\n\t' + value )
+		.map( value => EOL + '\t' + value )
 		.sort()
 		.toString();
 
@@ -308,7 +309,7 @@ function convert( path, exampleDependencies, ignoreList ) {
 
 	// core imports
 
-	if ( keys ) imports.push( `import {${keys}\n} from "${pathPrefix}../../build/three.module.js";` );
+	if ( keys ) imports.push( `import {${keys}${EOL}} from "${pathPrefix}../../build/three.module.js";` );
 
 	// example imports
 
@@ -320,9 +321,9 @@ function convert( path, exampleDependencies, ignoreList ) {
 
 	var output = '';
 
-	if ( imports.length > 0 ) output += imports.join( '\n' ) + '\n\n';
+	if ( imports.length > 0 ) output += imports.join( EOL ) + EOL + EOL;
 
-	output += contents + `\nexport { ${classNames.join( ', ' )} };\n`;
+	output += contents + `${EOL}export { ${classNames.join( ', ' )} };${EOL}`;
 
 	// console.log( output );