@@ -25,7 +25,7 @@ interface GithubReleaseView {
2525 readonly assets ?: unknown ;
2626}
2727
28- interface ReleaseAssetInfo {
28+ export interface ReleaseAssetInfo {
2929 readonly name : string ;
3030 readonly sha256 : string ;
3131}
@@ -56,12 +56,14 @@ const HELP_TEXT = [
5656 " --repo <owner/name> GitHub repo to query (default: hack-dance/hack)" ,
5757] . join ( "\n" ) ;
5858
59- const parsed = parseArgs ( { argv : Bun . argv . slice ( 2 ) } ) ;
60- if ( parsed . ok ) {
61- process . exitCode = await main ( { args : parsed . args } ) ;
62- } else {
63- process . stderr . write ( `${ parsed . message } \n` ) ;
64- process . exitCode = 1 ;
59+ if ( import . meta. main ) {
60+ const parsed = parseArgs ( { argv : Bun . argv . slice ( 2 ) } ) ;
61+ if ( parsed . ok ) {
62+ process . exitCode = await main ( { args : parsed . args } ) ;
63+ } else {
64+ process . stderr . write ( `${ parsed . message } \n` ) ;
65+ process . exitCode = 1 ;
66+ }
6567}
6668
6769async function main ( { args } : { readonly args : Args } ) : Promise < number > {
@@ -246,7 +248,7 @@ function parseAssets({
246248 return out ;
247249}
248250
249- function renderFormula ( {
251+ export function renderFormula ( {
250252 repo,
251253 tag,
252254 version,
@@ -287,7 +289,7 @@ function renderFormula({
287289 ' libexec.install "hack"' ,
288290 ' (libexec/"assets").install Dir["assets/*"] if (buildpath/"assets").directory?' ,
289291 ' (libexec/"assets/binaries").install Dir["binaries/*"] if (buildpath/"binaries").directory?' ,
290- ' bin.write_env_script libexec/"hack", HACK_ASSETS_DIR: libexec/"assets"' ,
292+ ' ( bin/"hack") .write_env_script libexec/"hack", HACK_ASSETS_DIR: libexec/"assets"' ,
291293 " end" ,
292294 "" ,
293295 " test do" ,
0 commit comments