| 372 | |
| 373 | |
| 374 | def prepare_js_release( |
| 375 | context: Context, package: PackageInfo |
| 376 | ) -> Callable[[bool], None]: |
| 377 | node_auth_token = os.getenv("NODE_AUTH_TOKEN") |
| 378 | if node_auth_token is None: |
| 379 | msg = "NODE_AUTH_TOKEN environment variable must be set" |
| 380 | raise Exit(msg) |
| 381 | |
| 382 | with context.cd(JS_DIR): |
| 383 | context.run("npm ci") |
| 384 | context.run("npm run build") |
| 385 | |
| 386 | def publish(dry_run: bool) -> None: |
| 387 | with context.cd(JS_DIR): |
| 388 | if dry_run: |
| 389 | context.run(f"npm --workspace {package.name} pack --dry-run") |
| 390 | return |
| 391 | context.run( |
| 392 | f"npm --workspace {package.name} publish --access public", |
| 393 | env={"NODE_AUTH_TOKEN": node_auth_token}, |
| 394 | ) |
| 395 | |
| 396 | return publish |
| 397 | |
| 398 | |
| 399 | def prepare_py_release( |