in eng/scripts/inventory-dashboard/src/formatData.ts [284:326]
function getTrackInfo(pkg: any, track: 1 | 2): TrackSpecifics {
// property and property type check
if (pkg.hasOwnProperty('New') && typeof pkg.New === "string") {
// if New prop and track param match, return track specific details
if (
(pkg.New.toLowerCase() === "true" && track === 2) ||
(pkg.New.toLowerCase() === "false" && track === 1)
) {
return {
Package: getPackage(pkg),
RepoLink: getRepoLink(pkg),
ColorCode: isBeta(pkg) ? 3 : 10,
Deprecated: getDeprecationStatus(pkg)
};
} else if (
pkg.New.toLowerCase() !== "false" &&
pkg.New.toLowerCase() !== "true"
) {
// Logging for when New Property is set but not to "true" or "false"
log.warn(
`Track could not be determined. Package New property not set to true or false. pkg.New.toLowerCase(): ${pkg.New.toLowerCase()} - Package: ${JSON.stringify(
pkg
)}`
);
if (track === 1) {
log.warn(`Track could not be determined. Package: ${JSON.stringify(pkg)}`);
return { ...TrackSpecificsDefault, Package: `UNABLE TO DETERMINE TRACK. PACKAGE: ${getPackage(pkg)}` };
}
}
// If package is a track 1 package and we're determining Track 2 contents look to see if track 1 package has a reference in it's Replace column
else if (pkg.New.toLowerCase() === "false" && track === 2 && pkg.Replace && typeof pkg.Replace === 'string') {
return {
Package: `Replaced by: ${pkg.Replace}`,
RepoLink: "",
ColorCode: 4,
Deprecated: false
};
}
}
// If a track couldn't be determined assume package is track 1
// When determined track and param track don't match, return default
return TrackSpecificsDefault;
}