| 
									
										
										
										
											2024-01-22 13:34:15 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | [tasks.wasm_build] | 
					
						
							|  |  |  | script_runner = "bash" | 
					
						
							|  |  |  | script = [ | 
					
						
							|  |  |  |     """ | 
					
						
							|  |  |  |     #!/bin/bash | 
					
						
							|  |  |  |     BASE_DIR=$(pwd) | 
					
						
							| 
									
										
										
										
											2024-01-30 05:36:27 +08:00
										 |  |  |     crates=("lib-dispatch" "flowy-encrypt" "lib-infra" "flowy-notification" "flowy-date" "flowy-error" "collab-integrate" "flowy-document") | 
					
						
							| 
									
										
										
										
											2024-01-22 13:34:15 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # Iterate over each crate and build it | 
					
						
							|  |  |  |     for crate in "${crates[@]}"; do | 
					
						
							|  |  |  |       echo "🔥🔥🔥  Building $crate with wasm-pack..." | 
					
						
							|  |  |  |       cd "$BASE_DIR/rust-lib/$crate" || { echo "Failed to enter directory $crate"; exit 1; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-30 09:33:34 +08:00
										 |  |  |       wasm-pack build || { echo "Build failed for $crate"; exit 1; } | 
					
						
							| 
									
										
										
										
											2024-01-22 13:34:15 +08:00
										 |  |  |     done | 
					
						
							|  |  |  |     """ | 
					
						
							|  |  |  | ] | 
					
						
							| 
									
										
										
										
											2024-01-30 05:36:27 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [tasks.web_clean] | 
					
						
							|  |  |  | description = "Remove all the building artifacts" | 
					
						
							|  |  |  | run_task = { name = [ | 
					
						
							|  |  |  |     "rust_lib_clean", | 
					
						
							|  |  |  |     "rm_macro_build_cache", | 
					
						
							|  |  |  |     "rm_rust_generated_files", | 
					
						
							|  |  |  |     "rm_web_generated_protobuf_files", | 
					
						
							|  |  |  |     "rm_web_generated_event_files", | 
					
						
							| 
									
										
										
										
											2024-02-04 05:50:23 +08:00
										 |  |  |     "rm_pkg", | 
					
						
							| 
									
										
										
										
											2024-01-30 05:36:27 +08:00
										 |  |  | ] } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-04 05:50:23 +08:00
										 |  |  | [tasks.rm_pkg] | 
					
						
							|  |  |  | private = true | 
					
						
							|  |  |  | script = [""" | 
					
						
							|  |  |  | cd ${WEB_LIB_PATH} | 
					
						
							|  |  |  | rimraf dist pkg | 
					
						
							|  |  |  | """] | 
					
						
							|  |  |  | script_runner = "@duckscript" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-30 05:36:27 +08:00
										 |  |  | [tasks.rm_web_generated_protobuf_files] | 
					
						
							|  |  |  | private = true | 
					
						
							|  |  |  | script = [""" | 
					
						
							|  |  |  |   protobuf_file_paths = glob_array ${WEB_BACKEND_SERVICE_PATH}/models | 
					
						
							|  |  |  |   if not array_is_empty ${protobuf_file_paths} | 
					
						
							|  |  |  |     echo Remove generated protobuf files: | 
					
						
							|  |  |  |     for path in ${protobuf_file_paths} | 
					
						
							|  |  |  |         echo remove ${path} | 
					
						
							|  |  |  |         rm -rf ${path} | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  |   """] | 
					
						
							|  |  |  | script_runner = "@duckscript" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [tasks.rm_web_generated_event_files] | 
					
						
							|  |  |  | private = true | 
					
						
							|  |  |  | script = [""" | 
					
						
							|  |  |  |   event_file_paths = glob_array ${WEB_BACKEND_SERVICE_PATH}/events | 
					
						
							|  |  |  |   if not array_is_empty ${event_file_paths} | 
					
						
							|  |  |  |     echo Remove generated protobuf files: | 
					
						
							|  |  |  |     for path in ${event_file_paths} | 
					
						
							|  |  |  |         echo remove ${path} | 
					
						
							|  |  |  |         rm -rf ${path} | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  |   """] | 
					
						
							|  |  |  | script_runner = "@duckscript" |