Skip to content

Commit 4639cd4

Browse files
authored
fix: use version from manifest (#19)
1 parent f248a95 commit 4639cd4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/formats/dotnet-cli-parser.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ function registerDependency(packageTree, resolvedName) {
2727
function parse(fileContent, packageTree) {
2828
var libraries = {};
2929
var manifest = JSON.parse(fileContent);
30+
if (manifest.project) {
31+
packageTree.version = manifest.project.version;
32+
packageTree.from[0] = packageTree.name + '@' + packageTree.version;
33+
}
3034
var targets = Object
3135
.keys(manifest.targets)
3236
.map(function (key) {
@@ -64,10 +68,6 @@ function parse(fileContent, packageTree) {
6468
})
6569
});
6670

67-
if (manifest.project) {
68-
packageTree.version = manifest.project.version;
69-
}
70-
7171
// restructure tree with "from" chains.
7272
function buildPath(node, from) {
7373

test/stubs/dotnet_project/expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.0.0",
55
"packageFormatVersion": "nuget:0.0.0",
66
"from": [
7-
"dotnet_project@0.0.0"
7+
"dotnet_project@1.0.0"
88
],
99
"dependencies": {
1010
"jQuery": {

test/stubs/dummy_project_2/expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "2.2.2",
55
"packageFormatVersion": "nuget:0.0.0",
66
"from": [
7-
"dummy_project_2@0.0.0"
7+
"dummy_project_2@2.2.2"
88
],
99
"dependencies": {
1010
"knockoutjs": {

0 commit comments

Comments
 (0)