diff --git a/dependency-checker.ts b/dependency-checker.ts index 1763794..b8c639a 100644 --- a/dependency-checker.ts +++ b/dependency-checker.ts @@ -26,25 +26,36 @@ for ( const line of lines ) { if ( line.length === 0 ) { continue; } - + if ( lines.indexOf( line ) === 0 ) { columnIndexes[ 0 ] = line.indexOf( 'Current' ); columnIndexes[ 1 ] = line.indexOf( 'Wanted' ) + 3; columnIndexes[ 2 ] = line.indexOf( 'Latest' ) + 6; columnIndexes[ 3 ] = line.indexOf( 'Location' ) + 9; } - - let modifiedLine = line; - + + let modifiedLine = ''; + if ( columnIndexes [ 0 ] >= 0 ) { - for ( const columnIndex of columnIndexes ) { - modifiedLine = modifiedLine.substring( 0, columnIndex ) + ' | ' + modifiedLine.substring( columnIndex, modifiedLine.length ); + const stringParts = line.split( /(\s+)/ ); + + modifiedLine += '| '; + + for ( let part of stringParts ) { + if ( part.match( /\s+/ ) ) { + modifiedLine += ' | '; + } else { + modifiedLine += part; + } } - console.log( '| ' + modifiedLine + ' |' ); + + modifiedLine += ' |'; + + console.log( modifiedLine ); } else { console.log( modifiedLine ); } - + if ( lines.indexOf( line ) === 0 ) { console.log( '| --- | --- | --- | --- | --- |' ); } diff --git a/package.json b/package.json index 95f2d5a..4b63669 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,11 @@ }, "devDependencies": { "@types/inquirer": "^8.1.3", - "@types/node": "^16.11.11", + "@types/node": "^16.11.12", "@types/shelljs": "^0.8.9", "@types/yargs": "^17.0.4", "ts-node": "^10.3.0", - "typescript": "^4.5.2" + "typescript": "^4.5.3" }, "git repository": "https://github.com/open-template-hub/open-template-hub-server-generator", "repository": {