There are 2 ways: There was an old tool called “hidescripts.exe” but I don’t know if there are actual versions of it.
2nd: You can do it with the XML-Converter.
4.3 Hiding script sections: Library Parts provide a way to have the scripts hidden from the end user. This can be done in XML by adding 64 to the SectionFlags attribute of the script to be hidden. This will create a GSM file with the given scripts hidden. Converting a library part with hidden scripts back to XML will create empty script elements, so be sure to keep the original XML files after publishing the library.
GDL Object Developer
MAC OSx 10.14