add version to Framework struct

This commit is contained in:
Jarred Sumner
2022-02-20 16:24:36 -08:00
parent 8f1b2b2350
commit 59109a309f
2 changed files with 11 additions and 0 deletions

View File

@@ -2005,6 +2005,9 @@ pub const Framework = struct {
fallback: EntryPoint = EntryPoint{},
display_name: string = "",
/// "version" field in package.json
version: string = "",
/// "name" field in package.json
package: string = "",
development: bool = true,
resolved: bool = false,

View File

@@ -299,6 +299,14 @@ pub const PackageJSON = struct {
}
}
if (json.get("version")) |version| {
if (version.asString(allocator)) |str| {
if (str.len > 0) {
pair.framework.version = str;
}
}
}
if (framework_object.expr.asProperty("static")) |static_prop| {
if (static_prop.expr.asString(allocator)) |str| {
if (str.len > 0) {