1- const glob = require ( 'glob' ) ;
1+ const fastGlob = require ( 'fast- glob' ) ;
22const path = require ( 'path' ) ;
33const fs = require ( 'fs' ) ;
44const yaml = require ( 'js-yaml' ) ;
5- const minimatch = require ( 'minimatch' ) ;
5+ const { minimatch } = require ( 'minimatch' ) ;
66const {
77 parse,
88 stringify,
@@ -41,19 +41,7 @@ const getAllPackageJsons = async (workspaces, cwd) => {
4141 } ) ;
4242
4343 return Promise . all (
44- workspaceGlobs . map (
45- ( workspace ) =>
46- new Promise ( ( resolve , reject ) => {
47- glob ( `${ workspace } /${ PACKAGE_JSON } ` , { cwd } , ( error , files ) => {
48- if ( error ) {
49- reject ( error ) ;
50- }
51- resolve ( files ) ;
52- } ) ;
53- } ) ,
54-
55- [ ]
56- )
44+ workspaceGlobs . map ( ( workspace ) => fastGlob ( `${ workspace } /${ PACKAGE_JSON } ` , { cwd, onlyFiles : true } ) )
5745 )
5846 . then ( ( allPackages ) =>
5947 allPackages . reduce (
@@ -216,7 +204,7 @@ const updateTsConfig = (
216204 if ( createPathMappings )
217205 assert . deepEqual ( JSON . parse ( JSON . stringify ( config ?. compilerOptions ?. paths ?? { } ) ) , paths ) ;
218206 isEqual = true ;
219- } catch ( e ) {
207+ } catch {
220208 // ignore me
221209 }
222210 if ( ! isEqual ) {
@@ -243,7 +231,7 @@ const updateTsConfig = (
243231 } catch ( error ) {
244232 console . error ( `could not read ${ tsconfigFilePath } ` , error ) ;
245233 if ( strict )
246- throw new Error ( 'Expect always a tsconfig.json in the package directory while running in strict mode' )
234+ throw new Error ( 'Expect always a tsconfig.json in the package directory while running in strict mode' , { cause : error } )
247235 }
248236} ;
249237
@@ -269,7 +257,6 @@ const execute = async ({
269257 ...configurable
270258} ) => {
271259 let changesCount = 0 ;
272- // eslint-disable-next-line no-console
273260 console . log ( 'updating tsconfigs' ) ;
274261 const packageJson = require ( path . join ( cwd , PACKAGE_JSON ) ) ;
275262
@@ -336,8 +323,6 @@ const execute = async ({
336323 console . log ( 'packagesMap' , packagesMap ) ;
337324 }
338325
339- let rootReferences = [ ] ;
340- let rootPaths = [ ] ;
341326 let tsconfigMap = { }
342327 let jsconfigMap = { }
343328 const referencesMap = { }
@@ -416,14 +401,13 @@ const execute = async ({
416401 } else {
417402 const detectedJsConfig = jsconfigMap [ packageName ] ?. detectedConfig
418403 if ( ! detectedJsConfig ) {
419- // eslint-disable-next-line no-console
420404 console . log ( `NO ${ configName === TSCONFIG_JSON ? configName : `${ configName } nor ${ TSCONFIG_JSON } ` } for ${ packageName } ` ) ;
421405 }
422406 }
423407 } ) ;
424408
425- rootReferences = rootReferenceCandidates . filter ( ( { name } ) => ! referencedPackageNames . has ( name ) ) ;
426- rootPaths = getPathsFromReferences ( rootReferences , tsconfigMap , { } , ignorePathMappings )
409+ const rootReferences = rootReferenceCandidates . filter ( ( { name } ) => ! referencedPackageNames . has ( name ) ) ;
410+ const rootPaths = getPathsFromReferences ( rootReferences , tsconfigMap , { } , ignorePathMappings )
427411
428412 if ( verbose ) {
429413 console . log ( 'rootReferences' , rootReferences ) ;
0 commit comments