Highly ambitious ATProtocol AppView service and sdks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix scripts lookup in prod container

Chad Miller bfcf0960 885cf565

+42 -21
+15 -2
api/flake.nix
··· 35 35 (pkgs.lib.hasInfix "/migrations/" path) || 36 36 (pkgs.lib.hasSuffix "/migrations" path) || 37 37 (pkgs.lib.hasInfix "/.sqlx/" path) || 38 - (pkgs.lib.hasSuffix "/.sqlx" path); 38 + (pkgs.lib.hasSuffix "/.sqlx" path) || 39 + (pkgs.lib.hasInfix "/scripts/" path) || 40 + (pkgs.lib.hasSuffix "/scripts" path); 39 41 }; 40 42 41 43 commonArgs = { ··· 86 88 ''; 87 89 }; 88 90 91 + # Copy script files 92 + scriptFiles = pkgs.stdenv.mkDerivation { 93 + name = "slice-scripts"; 94 + src = ./scripts; 95 + installPhase = '' 96 + mkdir -p $out/scripts 97 + cp -r * $out/scripts/ 98 + ''; 99 + }; 100 + 89 101 90 102 # Common OCI labels 91 103 ociLabels = { ··· 112 124 pkgs.cacert 113 125 pkgs.postgresql 114 126 pkgs.deno 127 + scriptFiles 115 128 ]; 116 - pathsToLink = [ "/bin" "/etc" ]; 129 + pathsToLink = [ "/bin" "/etc" "/scripts" ]; 117 130 }; 118 131 119 132 config = {
+27 -19
api/src/codegen/typescript.rs
··· 8 8 } 9 9 10 10 pub fn generate_client(&self, lexicons_json: &str) -> Result<String, String> { 11 - // Call the generate-typescript script with lexicon data 12 - let output = Command::new("deno") 13 - .args(["run", "--allow-all", "scripts/generate-typescript.ts"]) 14 - .arg(lexicons_json) 15 - .output() 16 - .map_err(|e| format!("Failed to execute generate-typescript script: {}", e))?; 17 - 18 - if output.status.success() { 19 - let generated_code = String::from_utf8(output.stdout) 20 - .map_err(|e| format!("Failed to parse generated code as UTF-8: {}", e))?; 21 - 22 - if generated_code.trim().is_empty() { 23 - Err("Generated code is empty".to_string()) 24 - } else { 25 - Ok(generated_code) 11 + // Try both local dev path and production path 12 + let script_paths = vec![ 13 + "scripts/generate-typescript.ts", // Local development 14 + "/scripts/generate-typescript.ts", // Production container 15 + ]; 16 + 17 + for script_path in script_paths { 18 + let output = Command::new("deno") 19 + .args(["run", "--allow-all", script_path]) 20 + .arg(lexicons_json) 21 + .output(); 22 + 23 + match output { 24 + Ok(output) if output.status.success() => { 25 + let generated_code = String::from_utf8(output.stdout) 26 + .map_err(|e| format!("Failed to parse generated code as UTF-8: {}", e))?; 27 + 28 + if generated_code.trim().is_empty() { 29 + return Err("Generated code is empty".to_string()); 30 + } else { 31 + return Ok(generated_code); 32 + } 33 + } 34 + Ok(_) => continue, // Try next path 35 + Err(_) => continue, // Try next path 26 36 } 27 - } else { 28 - let error = String::from_utf8(output.stderr) 29 - .unwrap_or_else(|_| "Unknown error occurred".to_string()); 30 - Err(format!("TypeScript generation failed: {}", error)) 31 37 } 38 + 39 + Err("Failed to find TypeScript generation script at any expected location".to_string()) 32 40 } 33 41 }