File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
packages/techdocs-cli/src Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @techdocs/cli ' : minor
3
+ ---
4
+
5
+ Running ` @techdocs/cli generate ` with the ` --verbose ` flag will now print the mkdocs output.
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ import { ConfigReader } from '@backstage/config';
31
31
import {
32
32
convertTechDocsRefToLocationAnnotation ,
33
33
createLogger ,
34
+ getLogStream ,
34
35
} from '../../lib/utility' ;
35
- import { stdout } from 'process' ;
36
36
37
37
export default async function generate ( opts : OptionValues ) {
38
38
// Use techdocs-node package to generate docs. Keep consistency between Backstage and CI generating docs.
@@ -110,7 +110,7 @@ export default async function generate(opts: OptionValues) {
110
110
: { } ) ,
111
111
logger,
112
112
etag : opts . etag ,
113
- ... ( process . env . LOG_LEVEL === 'debug' ? { logStream : stdout } : { } ) ,
113
+ logStream : getLogStream ( logger ) ,
114
114
siteOptions : { name : opts . siteName } ,
115
115
} ) ;
116
116
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ import {
18
18
ParsedLocationAnnotation ,
19
19
} from '@backstage/plugin-techdocs-node' ;
20
20
import * as winston from 'winston' ;
21
+ import { Writable } from 'stream' ;
22
+ import { stdout } from 'process' ;
21
23
22
24
export const convertTechDocsRefToLocationAnnotation = (
23
25
techdocsRef : string ,
@@ -52,3 +54,17 @@ export const createLogger = ({
52
54
53
55
return logger ;
54
56
} ;
57
+
58
+ export const getLogStream = ( logger : winston . Logger ) : Writable => {
59
+ if ( process . env . LOG_LEVEL === 'debug' ) {
60
+ return stdout ;
61
+ }
62
+
63
+ return new Writable ( {
64
+ defaultEncoding : 'utf8' ,
65
+ write ( chunk , _encoding , next ) {
66
+ logger . verbose ( chunk . toString ( ) . trim ( ) ) ;
67
+ next ( ) ;
68
+ } ,
69
+ } ) ;
70
+ } ;
You can’t perform that action at this time.
0 commit comments