11/// The command to run for applying patches via socket CLI.
2- const SOCKET_PATCH_COMMAND : & str = "socket patch apply --silent --ecosystems npm" ;
2+ const SOCKET_PATCH_COMMAND : & str = "npx @socketsecurity/socket- patch apply --silent --ecosystems npm" ;
33
44/// Legacy command patterns to detect existing configurations.
55const LEGACY_PATCH_PATTERNS : & [ & str ] = & [
@@ -140,7 +140,7 @@ mod tests {
140140 let pkg: serde_json:: Value = serde_json:: json!( {
141141 "name" : "test" ,
142142 "scripts" : {
143- "postinstall" : "socket patch apply --silent --ecosystems npm"
143+ "postinstall" : "npx @socketsecurity/socket- patch apply --silent --ecosystems npm"
144144 }
145145 } ) ;
146146 let status = is_postinstall_configured ( & pkg) ;
@@ -152,15 +152,15 @@ mod tests {
152152 fn test_generate_empty ( ) {
153153 assert_eq ! (
154154 generate_updated_postinstall( "" ) ,
155- "socket patch apply --silent --ecosystems npm"
155+ "npx @socketsecurity/socket- patch apply --silent --ecosystems npm"
156156 ) ;
157157 }
158158
159159 #[ test]
160160 fn test_generate_prepend ( ) {
161161 assert_eq ! (
162162 generate_updated_postinstall( "echo done" ) ,
163- "socket patch apply --silent --ecosystems npm && echo done"
163+ "npx @socketsecurity/socket- patch apply --silent --ecosystems npm && echo done"
164164 ) ;
165165 }
166166
@@ -220,7 +220,7 @@ mod tests {
220220 let mut pkg: serde_json:: Value = serde_json:: json!( { "name" : "test" } ) ;
221221 let ( modified, new_script) = update_package_json_object ( & mut pkg) ;
222222 assert ! ( modified) ;
223- assert ! ( new_script. contains( "socket patch apply" ) ) ;
223+ assert ! ( new_script. contains( "socket- patch apply" ) ) ;
224224 assert ! ( pkg. get( "scripts" ) . is_some( ) ) ;
225225 assert ! ( pkg[ "scripts" ] [ "postinstall" ] . is_string( ) ) ;
226226 }
@@ -229,12 +229,12 @@ mod tests {
229229 fn test_update_object_noop_when_configured ( ) {
230230 let mut pkg: serde_json:: Value = serde_json:: json!( {
231231 "scripts" : {
232- "postinstall" : "socket patch apply --silent --ecosystems npm"
232+ "postinstall" : "npx @socketsecurity/socket- patch apply --silent --ecosystems npm"
233233 }
234234 } ) ;
235235 let ( modified, existing) = update_package_json_object ( & mut pkg) ;
236236 assert ! ( !modified) ;
237- assert ! ( existing. contains( "socket patch apply" ) ) ;
237+ assert ! ( existing. contains( "socket- patch apply" ) ) ;
238238 }
239239
240240 #[ test]
@@ -244,15 +244,15 @@ mod tests {
244244 update_package_json_content ( content) . unwrap ( ) ;
245245 assert ! ( modified) ;
246246 assert ! ( old_script. is_empty( ) ) ;
247- assert ! ( new_script. contains( "socket patch apply" ) ) ;
247+ assert ! ( new_script. contains( "socket- patch apply" ) ) ;
248248 // new_content should be valid JSON
249249 let parsed: serde_json:: Value = serde_json:: from_str ( & new_content) . unwrap ( ) ;
250250 assert ! ( parsed[ "scripts" ] [ "postinstall" ] . is_string( ) ) ;
251251 }
252252
253253 #[ test]
254254 fn test_update_content_already_configured ( ) {
255- let content = r#"{"scripts":{"postinstall":"socket patch apply --silent --ecosystems npm"}}"# ;
255+ let content = r#"{"scripts":{"postinstall":"npx @socketsecurity/socket- patch apply --silent --ecosystems npm"}}"# ;
256256 let ( modified, _new_content, _old, _new) =
257257 update_package_json_content ( content) . unwrap ( ) ;
258258 assert ! ( !modified) ;
@@ -269,6 +269,6 @@ mod tests {
269269 fn test_generate_whitespace_only ( ) {
270270 // Whitespace-only string should be treated as empty after trim
271271 let result = generate_updated_postinstall ( " \t " ) ;
272- assert_eq ! ( result, "socket patch apply --silent --ecosystems npm" ) ;
272+ assert_eq ! ( result, "npx @socketsecurity/socket- patch apply --silent --ecosystems npm" ) ;
273273 }
274274}
0 commit comments