Skip to content

Commit

Permalink
feat: added .vbproj support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill89 committed Oct 22, 2018
1 parent e65d520 commit 0427958
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import * as _ from 'lodash';
import {PkgTree, DepType, parseManifestFile,
getDependencyTreeFromPackagesConfig, getDependencyTreeFromCsproj} from './parsers';

const PROJ_FILE_EXTENSION = [
'.csproj',
'.vbproj',
];

export {
buildDepTreeFromPackagesConfig,
buildDepTreeFromCsproj,
Expand Down Expand Up @@ -43,18 +48,21 @@ function buildDepTreeFromFiles(
}

const manifestFileFullPath = path.resolve(root, manifestFilePath);

if (!fs.existsSync(manifestFileFullPath)) {
throw new Error(`Neither packages.config nor .csproj file found at location: ${manifestFileFullPath}`);
throw new Error('Neither packages.config nor project file found at ' +
`location: ${manifestFileFullPath}`);
}

const manifestFileContents = fs.readFileSync(manifestFileFullPath, 'utf-8');
const manifestFileExtension = path.extname(manifestFileFullPath);

if (_.endsWith(manifestFilePath, '.csproj')) {
if (_.includes(PROJ_FILE_EXTENSION, manifestFileExtension)) {
return buildDepTreeFromCsproj(manifestFileContents, includeDev);
} else if (_.endsWith(manifestFilePath, 'packages.config')) {
return buildDepTreeFromPackagesConfig(manifestFileContents, includeDev);
} else {
throw new Error(`Unsupported file ${manifestFilePath},
'Please provide either packages.config or .csproj file.`);
throw new Error(`Unsupported file ${manifestFilePath}, Please provide ` +
'either packages.config or project file.');
}
}

0 comments on commit 0427958

Please sign in to comment.