File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change 22
33import * as path from 'path' ;
44import * as chokidar from 'chokidar' ;
5- import glob from 'glob' ;
5+ import _glob from 'glob' ;
66import * as yargs from 'yargs' ;
77import chalk from 'chalk' ;
88import { DtsCreator } from './dts-creator' ;
99import { DtsContent } from "./dts-content" ;
10+ import * as util from "util" ;
11+
12+ const glob = util . promisify ( _glob ) ;
1013
1114const yarg = yargs . usage ( 'Create .css.d.ts from CSS modules *.css files.\nUsage: $0 [options] <input directory>' )
1215 . example ( '$0 src/styles' , '' )
@@ -39,7 +42,7 @@ async function writeFile(f: string): Promise<void> {
3942 }
4043} ;
4144
42- function main ( ) {
45+ async function main ( ) {
4346 let rootDir : string ;
4447 let searchDir : string ;
4548 if ( argv . h ) {
@@ -66,14 +69,8 @@ function main() {
6669 } ) ;
6770
6871 if ( ! argv . w ) {
69- glob ( filesPattern , { } , ( err , files ) => {
70- if ( err ) {
71- console . error ( err ) ;
72- return ;
73- }
74- if ( ! files || ! files . length ) return ;
75- files . forEach ( writeFile ) ;
76- } ) ;
72+ const files = await glob ( filesPattern ) ;
73+ files . forEach ( writeFile ) ;
7774 } else {
7875 console . log ( 'Watch ' + filesPattern + '...' ) ;
7976
You can’t perform that action at this time.
0 commit comments