File tree Expand file tree Collapse file tree 4 files changed +43
-1
lines changed
Expand file tree Collapse file tree 4 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 2323 - run : pnpm -w test
2424
2525 - name : Deploy live demos
26- run : pnpm run deploy # pnpm deploy is a whole other thing apparently
26+ run : pnpm -w deploy-live-demos
2727
2828 - name : Validate live demo links
2929 run : pnpm -w validate-live-demo-links
Original file line number Diff line number Diff line change 1+ import "zx/globals" ;
2+ import subprocess from "node:child_process" ;
3+ import { getTemplates } from "./util" ;
4+
5+ export type DeployLiveDemosConfig = {
6+ templateDirectory : string ;
7+ } ;
8+
9+ export default async function deployLiveDemos ( {
10+ templateDirectory,
11+ } : DeployLiveDemosConfig ) {
12+ const templates = getTemplates ( templateDirectory ) ;
13+ await Promise . all (
14+ templates . map ( ( { path : templatePath } ) => {
15+ subprocess . execSync ( "npm install" , {
16+ cwd : templatePath ,
17+ } ) ;
18+ subprocess . execSync ( "npm run build --if-present" , {
19+ cwd : templatePath ,
20+ } ) ;
21+ subprocess . execSync ( "npm run deploy" , {
22+ cwd : templatePath ,
23+ } ) ;
24+ } ) ,
25+ ) ;
26+ }
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { validateD2CButtons } from "./validateD2CButtons";
1111import { setupHooks } from "./setupHooks" ;
1212import { depsInfo } from "./depsInfo" ;
1313import { depsUpdate } from "./depsUpdate" ;
14+ import deployLiveDemos from "./deployLiveDemos" ;
1415
1516const program = new Command ( ) ;
1617
@@ -100,6 +101,20 @@ program
100101 ) ;
101102 } ) ;
102103
104+ program
105+ . command ( "deploy-live-demos" )
106+ . description ( "Builds and deploys each template in isolataion" )
107+ . argument (
108+ "[path-to-template(s)]" ,
109+ "path to directory containing template(s)" ,
110+ "." ,
111+ )
112+ . action ( ( templateDirectory ) => {
113+ return actionWithSummary ( "Deploy live demos" , ( ) =>
114+ deployLiveDemos ( { templateDirectory } ) ,
115+ ) ;
116+ } ) ;
117+
103118program
104119 . command ( "validate-live-demo-links" )
105120 . description ( "Ensures every template has a live demo that returns a 200" )
Original file line number Diff line number Diff line change 2626 "check:templates" : " templates lint ." ,
2727 "check:turbo" : " turbo run check cf-typegen --force" ,
2828 "deploy" : " turbo run deploy" ,
29+ "deploy-live-demos" : " templates deploy-live-demos ." ,
2930 "fix" : " pnpm run fix:templates && pnpm run fix:lockfiles && pnpm run fix:turbo && pnpm run fix:prettier" ,
3031 "fix:deps" : " syncpack format && syncpack fix-mismatches" ,
3132 "fix:lockfiles" : " templates generate-npm-lockfiles ." ,
You can’t perform that action at this time.
0 commit comments