File tree Expand file tree Collapse file tree 2 files changed +59
-1
lines changed
Expand file tree Collapse file tree 2 files changed +59
-1
lines changed Original file line number Diff line number Diff line change 4949 "ai:context" : " node scripts/ai-context.mjs" ,
5050 "build" : " tsup" ,
5151 "changeset" : " changeset" ,
52- "docs:build" : " NO_UPDATE_NOTIFIER=1 docusaurus build docs-site " ,
52+ "docs:build" : " node scripts/ build-docs.mjs " ,
5353 "docs:dev" : " NO_UPDATE_NOTIFIER=1 docusaurus start docs-site" ,
5454 "docs:preview" : " NO_UPDATE_NOTIFIER=1 docusaurus serve docs-site/build" ,
5555 "mcp:docs" : " node mcp/server.mjs" ,
Original file line number Diff line number Diff line change 1+ import { spawn } from 'node:child_process' ;
2+
3+ const command = process . platform === 'win32'
4+ ? 'node_modules/.bin/docusaurus.cmd'
5+ : 'node_modules/.bin/docusaurus' ;
6+
7+ const child = spawn ( command , [ 'build' , 'docs-site' ] , {
8+ env : {
9+ ...process . env ,
10+ NO_UPDATE_NOTIFIER : '1' ,
11+ } ,
12+ stdio : [ 'ignore' , 'pipe' , 'pipe' ] ,
13+ } ) ;
14+
15+ let succeeded = false ;
16+ let settled = false ;
17+
18+ const finish = code => {
19+ if ( settled ) return ;
20+ settled = true ;
21+ process . exit ( code ) ;
22+ } ;
23+
24+ const watch = stream => {
25+ stream . on ( 'data' , chunk => {
26+ const text = chunk . toString ( ) ;
27+ process . stdout . write ( text ) ;
28+ if ( text . includes ( 'Generated static files in' ) ) {
29+ succeeded = true ;
30+ setTimeout ( ( ) => {
31+ if ( ! settled ) {
32+ child . kill ( ) ;
33+ finish ( 0 ) ;
34+ }
35+ } , 3000 ) . unref ( ) ;
36+ }
37+ } ) ;
38+ } ;
39+
40+ watch ( child . stdout ) ;
41+ child . stderr . on ( 'data' , chunk => process . stderr . write ( chunk ) ) ;
42+
43+ child . on ( 'error' , error => {
44+ console . error ( error ) ;
45+ finish ( 1 ) ;
46+ } ) ;
47+
48+ child . on ( 'exit' , code => {
49+ finish ( succeeded ? 0 : code ?? 1 ) ;
50+ } ) ;
51+
52+ setTimeout ( ( ) => {
53+ if ( ! succeeded ) {
54+ child . kill ( ) ;
55+ console . error ( 'Docusaurus build timed out before reporting success.' ) ;
56+ finish ( 1 ) ;
57+ }
58+ } , 120000 ) . unref ( ) ;
You can’t perform that action at this time.
0 commit comments