1
1
import * as chalk from 'chalk' ;
2
2
import * as stringWidth from 'string-width' ;
3
- // cliui is the CLI layout engine developed by, and used within, yargs
4
- import * as cliui from 'cliui' ;
5
3
import { logger } from './logger' ;
6
4
import { output } from './output' ;
7
5
import { Schema } from './params' ;
8
6
import { nxVersion } from './versions' ;
9
7
import { readModulePackageJson } from './package-json' ;
10
8
9
+ // cliui is the CLI layout engine developed by, and used within, yargs
10
+ // the typings for cliui do not play nice with our tsconfig, it either
11
+ // works in build or in test but not both.
12
+ const cliui = require ( 'cliui' ) as typeof import ( 'cliui' ) [ 'default' ] ;
13
+
11
14
export function printHelp (
12
15
header : string ,
13
16
schema : Schema ,
@@ -91,7 +94,7 @@ function generateGeneratorOverviewOutput({
91
94
description : string ;
92
95
aliases : string [ ] ;
93
96
} ) : string {
94
- const ui = cliui ( ) ;
97
+ const ui = cliui ( null ) ;
95
98
const overviewItemsLabelWidth =
96
99
// Chars in labels "From" and "Name"
97
100
4 +
@@ -156,7 +159,7 @@ function generateExecutorOverviewOutput({
156
159
name : string ;
157
160
description : string ;
158
161
} ) : string {
159
- const ui = cliui ( ) ;
162
+ const ui = cliui ( null ) ;
160
163
const overviewItemsLeftPadding = 2 ;
161
164
const overviewItemsLabelWidth = overviewItemsLeftPadding + 'Executor:' . length ;
162
165
@@ -204,7 +207,7 @@ const formatOptionType = (optionConfig: Schema['properties'][0]) => {
204
207
} ;
205
208
206
209
function generateOptionsOutput ( schema : Schema ) : string {
207
- const ui = cliui ( ) ;
210
+ const ui = cliui ( null ) ;
208
211
const flagAndAliasLeftPadding = 4 ;
209
212
const flagAndAliasRightPadding = 4 ;
210
213
@@ -281,7 +284,7 @@ function generateOptionsOutput(schema: Schema): string {
281
284
{
282
285
text : renderedTypesAndDefault ,
283
286
padding : [ 0 , 0 , 0 , 0 ] ,
284
- align : 'right' ,
287
+ align : 'right' as const ,
285
288
} ,
286
289
] ;
287
290
@@ -295,7 +298,7 @@ function generateExamplesOutput(schema: Schema): string {
295
298
if ( ! schema . examples || schema . examples . length === 0 ) {
296
299
return '' ;
297
300
}
298
- const ui = cliui ( ) ;
301
+ const ui = cliui ( null ) ;
299
302
const xPadding = 4 ;
300
303
301
304
ui . div ( {
1 commit comments
vercel[bot] commentedon Oct 3, 2023
Successfully deployed to the following URLs:
nx-dev – ./
nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx.dev
nx-dev-git-master-nrwl.vercel.app