@@ -76,7 +76,6 @@ if (opts.help) {
7676 process . exit ( 0 ) ;
7777}
7878
79-
8079try {
8180 globalConf = require ( globalConfigFilePath ) ;
8281}
@@ -93,11 +92,10 @@ if (Array.isArray(globalConf)) {
9392 globalConf = { } ;
9493}
9594
96- const { nluFilePath, nluConfigRoot} = handleConfigCLIOpt ( cwd , opts ) ;
95+ const { nluFilePath, nluConfigRoot} = handleConfigCLIOpt ( cwd , opts ) ;
9796
9897let pkg , conf : NluConf , hasNLUJSONFile = false ;
9998
100-
10199try {
102100 conf = require ( nluFilePath ) ;
103101 opts . umbrella = opts . umbrella || Boolean ( conf . umbrella ) ;
@@ -237,7 +235,7 @@ const originalList = list.slice(0);
237235if ( ! list . includes ( mainProjectName ) ) {
238236 // always include the very project's name
239237 if ( ! opts . umbrella ) {
240- list . push ( mainProjectName ) ;
238+ list . push ( mainProjectName ) ; // TODO this might be causing the project to always link to itself?
241239 }
242240}
243241
@@ -263,17 +261,19 @@ if (opts.dry_run) {
263261
264262// add the main project to the map
265263// when we search for projects, we ignore any projects where package.json name is "mainProjectName"
266- const mainDep = map [ mainProjectName ] = {
264+ const mainDep = map [ root ] = {
267265 name : mainProjectName ,
268-
269266 bin : null as any , // conf.bin ?
270267 hasNLUJSONFile,
271268 isMainProject : true ,
272269 linkToItself : conf . linkToItself ,
273270 runInstall : conf . alwaysReinstall ,
274271 path : root ,
275272 deps : list ,
276- package : pkg
273+ package : pkg ,
274+ searchRoots : null as Array < string > ,
275+ installedSet : new Set ( ) ,
276+ linkedSet : { }
277277} ;
278278
279279async . autoInject ( {
@@ -328,7 +328,15 @@ async.autoInject({
328328
329329 mapSearchRoots ( npmCacheClean : any , cb : EVCb < any > ) {
330330 opts. verbosity > 3 && log . info ( `Mapping original search roots from your root project's "searchRoots" property.` ) ;
331- mapPaths ( searchRoots , nluConfigRoot , cb ) ;
331+ mapPaths ( searchRoots , nluConfigRoot , ( err , roots ) => {
332+
333+ if ( err ) {
334+ return cb ( err ) ;
335+ }
336+
337+ mainDep . searchRoots = roots . slice ( 0 ) ;
338+ cb ( err , roots ) ;
339+ } ) ;
332340 } ,
333341
334342 findItems ( mapSearchRoots : Array < string > , cb : EVCb < any > ) {
@@ -353,9 +361,7 @@ async.autoInject({
353361 const findProject = makeFindProject ( mainProjectName , totalList , map , ignore , opts , status , conf ) ;
354362
355363 searchRoots . forEach ( sr => {
356- q . push ( cb => {
357- findProject ( sr , cb ) ;
358- } ) ;
364+ q . push ( cb => findProject ( sr , cb ) ) ;
359365 } ) ;
360366
361367 if ( q . idle ( ) ) {
@@ -389,12 +395,12 @@ async.autoInject({
389395 return ! map [ v ] ;
390396 } ) ;
391397
392- if ( unfound . length > 0 ) {
398+ if ( false && unfound . length > 0 ) {
393399 log . warn ( `The following packages could ${ chalk . bold ( 'not' ) } be located:` ) ;
394- for ( let i of unfound . keys ( ) ) {
395- log . warn ( chalk . bold ( String ( i + 1 ) , chalk . bold . green ( unfound [ i ] ) ) ) ;
400+ for ( let i of unfound . keys ( ) ) {
401+ log . warn ( chalk . bold ( String ( i + 1 ) , chalk . bold . green ( unfound [ i ] ) ) ) ;
396402 }
397-
403+
398404 if ( ! opts . allow_missing ) {
399405 console . error ( ) ;
400406 log . warn ( 'The following paths (and their subdirectories) were searched:' ) ;
@@ -415,7 +421,7 @@ async.autoInject({
415421 cleanMap = getCleanMapOfOnlyPackagesWithNluJSONFiles ( mainProjectName , map ) ;
416422 }
417423 else {
418- cleanMap = getCleanMap ( mainProjectName , map ) ;
424+ cleanMap = getCleanMap ( mainDep , map , opts ) ;
419425 }
420426 }
421427 catch ( err ) {
@@ -451,18 +457,20 @@ async.autoInject({
451457 const cleanMap = results . runUtility ;
452458
453459 if ( cleanMap && typeof cleanMap === 'object' ) {
454-
455- const treeObj = createTree ( cleanMap , mainProjectName , originalList , opts ) ;
460+
461+ const treeObj = createTree ( cleanMap , mainDep . path , mainDep , opts ) ;
462+ // const treeObj = createTree(cleanMap, mainProjectName, originalList, opts);
456463 const treeString = treeify . asTree ( treeObj , true ) ;
457- const formattedStr = String ( treeString ) . split ( '\n' ) . map ( function ( line ) {
458- return '\t' + line ;
459- } ) ;
464+ const formattedStr = [ '' ] . concat ( String ( treeString ) . split ( '\n' ) ) . map ( function ( line ) {
465+ return ' look here: \t' + line ;
466+ } ) . concat ( '' ) ;
460467
461468 if ( opts . verbosity > 1 ) {
469+ console . log ( ) ;
462470 log . info ( chalk . cyan . bold ( 'NPM-Link-Up results as a visual:' ) , '\n' ) ;
463- console . log ( '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^' ) ;
471+ // console.log('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^');
464472 console . log ( chalk . white ( formattedStr . join ( '\n' ) ) ) ;
465- console . log ( '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^' ) ;
473+ // console.log('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^');
466474 }
467475 }
468476 else {
0 commit comments