@@ -98,35 +98,6 @@ class ExposeHTTPResult(TypedDict):
9898 domain : str
9999
100100
101- class DeployBuildOptions (TypedDict , total = False ):
102- """Build configuration for deployment."""
103-
104- mode : Literal ["none" ]
105- """The build mode to use. Currently only 'none' is supported. Defaults to 'none'."""
106-
107- entrypoint : str
108- """The entrypoint file path relative to the path option. Defaults to 'main.ts'."""
109-
110- args : builtins .list [str ]
111- """Arguments to pass to the entrypoint script."""
112-
113-
114- class DeployOptions (TypedDict , total = False ):
115- """Options for deploying an app using deno.deploy()."""
116-
117- path : str
118- """The path to the directory to deploy. If relative, it is relative to /app. Defaults to '.'."""
119-
120- production : bool
121- """Whether to deploy in production mode. Defaults to True."""
122-
123- preview : bool
124- """Whether to deploy a preview deployment. Defaults to False."""
125-
126- build : DeployBuildOptions
127- """Build options to use."""
128-
129-
130101class BuildLog (TypedDict ):
131102 """A build log entry from app deployment."""
132103
@@ -676,13 +647,24 @@ async def repl(
676647 return process
677648
678649 async def deploy (
679- self , app : str , * , options : Optional [DeployOptions ] = None
650+ self ,
651+ app : str ,
652+ * ,
653+ entrypoint : Optional [str ] = None ,
654+ args : Optional [builtins .list [str ]] = None ,
655+ path : Optional [str ] = None ,
656+ production : Optional [bool ] = None ,
657+ preview : Optional [bool ] = None ,
680658 ) -> AsyncBuild :
681659 """Deploy the contents of the sandbox to the specified app in Deno Deploy platform.
682660
683661 Args:
684662 app: The app ID or slug to deploy to.
685- options: Deployment configuration options.
663+ entrypoint: The entrypoint file path relative to the path option. Defaults to 'main.ts'.
664+ args: Arguments to pass to the entrypoint script.
665+ path: The path to the directory to deploy. If relative, it is relative to /app. Defaults to '/app'.
666+ production: Whether to deploy in production mode. Defaults to True.
667+ preview: Whether to deploy a preview deployment. Defaults to False.
686668
687669 Returns:
688670 An AsyncBuild object with the revision ID and methods to check status and logs.
@@ -697,9 +679,7 @@ async def deploy(
697679 "main.ts",
698680 'Deno.serve(() => new Response("Hi from sandbox.deploy()"))',
699681 )
700- build = await sandbox.deno.deploy("my-deno-app", options={
701- "build": {"entrypoint": "main.ts"}
702- })
682+ build = await sandbox.deno.deploy("my-deno-app", entrypoint="main.ts")
703683 print(f"Deployed revision ID: {build.id}")
704684 revision = await build.done
705685 print(f"Revision status: {revision['status']}")
@@ -713,27 +693,17 @@ async def deploy(
713693
714694 # Build request body
715695 body : dict [str , Any ] = {
716- "entrypoint" : (
717- options .get ("build" , {}).get ("entrypoint" , "main.ts" )
718- if options
719- else "main.ts"
720- ),
696+ "entrypoint" : entrypoint if entrypoint is not None else "main.ts" ,
721697 "sandboxId" : self ._sandbox_id ,
698+ "path" : path if path is not None else "/app" ,
722699 }
723700
724- if options :
725- if "build" in options and "args" in options ["build" ]:
726- body ["args" ] = options ["build" ]["args" ]
727- if "production" in options :
728- body ["production" ] = options ["production" ]
729- if "preview" in options :
730- body ["preview" ] = options ["preview" ]
731- if "path" in options :
732- body ["path" ] = options ["path" ]
733- else :
734- body ["path" ] = "/app"
735- else :
736- body ["path" ] = "/app"
701+ if args is not None :
702+ body ["args" ] = args
703+ if production is not None :
704+ body ["production" ] = production
705+ if preview is not None :
706+ body ["preview" ] = preview
737707
738708 # Make the deploy request
739709 async with httpx .AsyncClient () as http_client :
@@ -861,12 +831,25 @@ def repl(
861831 )
862832 return DenoRepl (self ._rpc , self ._bridge , async_repl )
863833
864- def deploy (self , app : str , * , options : Optional [DeployOptions ] = None ) -> Build :
834+ def deploy (
835+ self ,
836+ app : str ,
837+ * ,
838+ entrypoint : Optional [str ] = None ,
839+ args : Optional [builtins .list [str ]] = None ,
840+ path : Optional [str ] = None ,
841+ production : Optional [bool ] = None ,
842+ preview : Optional [bool ] = None ,
843+ ) -> Build :
865844 """Deploy the contents of the sandbox to the specified app in Deno Deploy platform.
866845
867846 Args:
868847 app: The app ID or slug to deploy to.
869- options: Deployment configuration options.
848+ entrypoint: The entrypoint file path relative to the path option. Defaults to 'main.ts'.
849+ args: Arguments to pass to the entrypoint script.
850+ path: The path to the directory to deploy. If relative, it is relative to /app. Defaults to '/app'.
851+ production: Whether to deploy in production mode. Defaults to True.
852+ preview: Whether to deploy a preview deployment. Defaults to False.
870853
871854 Returns:
872855 A Build object with the revision ID and methods to check status and logs.
@@ -881,15 +864,22 @@ def deploy(self, app: str, *, options: Optional[DeployOptions] = None) -> Build:
881864 "main.ts",
882865 'Deno.serve(() => new Response("Hi from sandbox.deploy()"))',
883866 )
884- build = sandbox.deno.deploy("my-deno-app", options={
885- "build": {"entrypoint": "main.ts"}
886- })
867+ build = sandbox.deno.deploy("my-deno-app", entrypoint="main.ts")
887868 print(f"Deployed revision ID: {build.id}")
888869 revision = build.done
889870 print(f"Revision status: {revision['status']}")
890871 ```
891872 """
892- async_build = self ._bridge .run (self ._async .deploy (app , options = options ))
873+ async_build = self ._bridge .run (
874+ self ._async .deploy (
875+ app ,
876+ entrypoint = entrypoint ,
877+ args = args ,
878+ path = path ,
879+ production = production ,
880+ preview = preview ,
881+ )
882+ )
893883 return Build (async_build .id , app , self ._client , self ._bridge )
894884
895885
0 commit comments