keep node artifacts in webpack directory
add commands to build.rs to move assets to required location within src
This commit is contained in:
		| @@ -22,6 +22,22 @@ fn main() { | ||||
|             println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); | ||||
|             println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); | ||||
|             assert!(output.status.success()); | ||||
|  | ||||
|             // move webpack results to rust webserver src | ||||
|             let _ = Command::new("cmd") | ||||
|                 .arg("/K") | ||||
|                 .arg("move") | ||||
|                 .arg("./src_webpack/bundle.js") | ||||
|                 .arg("./src/webserver") | ||||
|                 .output() | ||||
|                 .unwrap(); | ||||
|             let _ = Command::new("cmd") | ||||
|                 .arg("/K") | ||||
|                 .arg("move") | ||||
|                 .arg("./src_webpack/index.html") | ||||
|                 .arg("./src/webserver") | ||||
|                 .output() | ||||
|                 .unwrap(); | ||||
|         } | ||||
|         Err(_) => { | ||||
|             println!("Assuming build on linux"); | ||||
| @@ -34,6 +50,18 @@ fn main() { | ||||
|             println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); | ||||
|             println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); | ||||
|             assert!(output.status.success()); | ||||
|  | ||||
|             // move webpack results to rust webserver src | ||||
|             let _ = Command::new("mv") | ||||
|                 .arg("./src_webpack/bundle.js") | ||||
|                 .arg("./src/webserver") | ||||
|                 .output() | ||||
|                 .unwrap(); | ||||
|             let _ = Command::new("mv") | ||||
|                 .arg("./src_webpack/index.html") | ||||
|                 .arg("./src/webserver") | ||||
|                 .output() | ||||
|                 .unwrap(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -49,7 +49,7 @@ module.exports = { | ||||
|   }, | ||||
|   output: { | ||||
|     filename: 'bundle.js', | ||||
|     path: path.resolve(__dirname, '../src/webserver'), | ||||
|     path: path.resolve(__dirname, '.'), | ||||
|   }, | ||||
|   devServer: { | ||||
|   } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user