File tree Expand file tree Collapse file tree 3 files changed +17
-21
lines changed
Expand file tree Collapse file tree 3 files changed +17
-21
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
33import yargs from "yargs" ;
4+ import { alerts } from "./core" ;
45import { IMPLEMENTATIONS } from "./implementations" ;
56import { main } from "./main" ;
67import { Aliases , NAME_FORMATS } from "./sass" ;
@@ -145,4 +146,8 @@ const { _: patterns, ...rest } = yargs
145146 . parseSync ( ) ;
146147
147148// eslint-disable-next-line @typescript-eslint/no-floating-promises
148- main ( patterns [ 0 ] as string , { ...rest } ) ;
149+ main ( patterns [ 0 ] as string , { ...rest } ) . catch ( ( error ) => {
150+ alerts . error ( "Encountered an error while generating type definitions." ) ;
151+ alerts . error ( error ) ;
152+ process . exitCode = 1 ;
153+ } ) ;
Original file line number Diff line number Diff line change @@ -34,10 +34,10 @@ const withLogLevelsRestriction =
3434
3535const error = withLogLevelsRestriction (
3636 [ "verbose" , "error" , "info" ] ,
37- ( message : string ) => console . log ( chalk . red ( message ) )
37+ ( message : string ) => console . warn ( chalk . red ( message ) )
3838) ;
3939const warn = withLogLevelsRestriction ( [ "verbose" ] , ( message : string ) =>
40- console . log ( chalk . yellowBright ( message ) )
40+ console . warn ( chalk . yellowBright ( message ) )
4141) ;
4242const notice = withLogLevelsRestriction (
4343 [ "verbose" , "info" ] ,
Original file line number Diff line number Diff line change 11import { bundleRequire } from "bundle-require" ;
22import JoyCon from "joycon" ;
33import path from "path" ;
4- import { alerts , CLIOptions , ConfigOptions } from "./core" ;
4+ import { CLIOptions , ConfigOptions } from "./core" ;
55import { getDefaultImplementation } from "./implementations" ;
66import { nameFormatDefault } from "./sass" ;
77import {
@@ -39,25 +39,16 @@ export const loadConfig = async (): Promise<
3939 ) ;
4040
4141 if ( configPath ) {
42- try {
43- const configModule = await bundleRequire ( {
44- filepath : configPath ,
45- } ) ;
42+ const configModule = await bundleRequire ( {
43+ filepath : configPath ,
44+ } ) ;
4645
47- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
48- const config : ConfigOptions =
49- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
50- configModule . mod . config || configModule . mod . default || configModule . mod ;
46+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
47+ const config : ConfigOptions =
48+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
49+ configModule . mod . config || configModule . mod . default || configModule . mod ;
5150
52- return config ;
53- } catch ( error ) {
54- alerts . error (
55- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
56- `An error occurred loading the config file "${ configPath } ":\n${ error } `
57- ) ;
58-
59- return { } ;
60- }
51+ return config ;
6152 }
6253
6354 return { } ;
You can’t perform that action at this time.
0 commit comments