@@ -35,7 +35,6 @@ def __call__(self, session: Session) -> Callable[[bool], None]:
3535SRC_DIR = ROOT_DIR / "src"
3636CLIENT_DIR = SRC_DIR / "client"
3737REACTPY_DIR = SRC_DIR / "reactpy"
38- LANGUAGE_TYPES : list [LanguageName ] = ["py" , "js" ]
3938TAG_PATTERN = re .compile (
4039 # start
4140 r"^"
@@ -46,7 +45,6 @@ def __call__(self, session: Session) -> Callable[[bool], None]:
4645 # end
4746 r"$"
4847)
49- print (TAG_PATTERN .pattern )
5048REMAINING_ARGS = Option (nargs = REMAINDER , type = str )
5149
5250
@@ -89,6 +87,12 @@ def format(session: Session) -> None:
8987 session .run ("npm" , "run" , "format" , external = True )
9088
9189
90+ @group .session
91+ def tsc (session : Session ) -> None :
92+ session .chdir (CLIENT_DIR )
93+ session .run ("npx" , "tsc" , "-b" , "-w" , "packages/app" , external = True )
94+
95+
9296@group .session
9397def example (session : Session ) -> None :
9498 """Run an example"""
@@ -269,16 +273,38 @@ def build_python(session: Session) -> None:
269273
270274
271275@group .session
272- def publish (session : Session , dry_run : bool = False ) -> None :
276+ def publish (
277+ session : Session ,
278+ publish_dry_run : Annotated [
279+ bool ,
280+ Option (help = "whether to test the release process" ),
281+ ] = False ,
282+ publish_fake_tags : Annotated [
283+ Sequence [str ],
284+ Option (nargs = "*" , type = str , help = "fake tags to use for a dry run release" ),
285+ ] = (),
286+ ) -> None :
273287 packages = get_packages (session )
274288
275289 release_prep : dict [LanguageName , ReleasePrepFunc ] = {
276290 "js" : prepare_javascript_release ,
277291 "py" : prepare_python_release ,
278292 }
279293
294+ if publish_fake_tags and not publish_dry_run :
295+ session .error ("Cannot specify --publish-fake-tags without --publish-dry-run" )
296+
297+ parsed_tags : list [TagInfo ] = []
298+ for tag in publish_fake_tags or get_current_tags (session ):
299+ tag_info = parse_tag (tag )
300+ if tag_info is None :
301+ session .error (
302+ f"Invalid tag { tag } - must be of the form <package>-<language>-<version>"
303+ )
304+ parsed_tags .append (tag_info )
305+
280306 publishers : list [tuple [Path , Callable [[bool ], None ]]] = []
281- for tag , tag_pkg , tag_ver in get_current_tags ( session ) :
307+ for tag , tag_pkg , tag_ver in parsed_tags :
282308 if tag_pkg not in packages :
283309 session .error (f"Tag { tag } references package { tag_pkg } that does not exist" )
284310
@@ -296,7 +322,7 @@ def publish(session: Session, dry_run: bool = False) -> None:
296322 for pkg_path , publish in publishers :
297323 session .log (f"Publishing { pkg_path } ..." )
298324 session .chdir (pkg_path )
299- publish (dry_run )
325+ publish (publish_dry_run )
300326
301327
302328# --- Utilities ------------------------------------------------------------------------
@@ -420,7 +446,7 @@ class PackageInfo(NamedTuple):
420446 version : str
421447
422448
423- def get_current_tags (session : Session ) -> list [TagInfo ]:
449+ def get_current_tags (session : Session ) -> list [str ]:
424450 """Get tags for the current commit"""
425451 # check if unstaged changes
426452 try :
@@ -468,24 +494,20 @@ def get_current_tags(session: Session) -> list[TagInfo]:
468494 if not tags :
469495 session .error ("No tags found for current commit" )
470496
471- parsed_tags : list [TagInfo ] = []
472- for tag in tags :
473- match = TAG_PATTERN .match (tag )
474- if not match :
475- session .error (
476- f"Invalid tag { tag } - must be of the form <package>-<language>-<version>"
477- )
478- parsed_tags .append (
479- TagInfo (
480- tag ,
481- match ["name" ], # type: ignore[index]
482- match ["version" ], # type: ignore[index]
483- )
484- )
497+ session .log (f"Found tags: { tags } " )
485498
486- session . log ( f"Found tags: { [ info . tag for info in parsed_tags ] } " )
499+ return tags
487500
488- return parsed_tags
501+
502+ def parse_tag (tag : str ) -> TagInfo | None :
503+ match = TAG_PATTERN .match (tag )
504+ if not match :
505+ return None
506+ return TagInfo (
507+ tag ,
508+ match ["name" ], # type: ignore[index]
509+ match ["version" ], # type: ignore[index]
510+ )
489511
490512
491513class TagInfo (NamedTuple ):
0 commit comments