INNER CODE UNIT · TypeScript
velaptorNuGetRegex
KinsonDigital/Velaptor · .github/cicd-scripts/update-velaptor-nuget-versions.ts:33
const velaptorNuGetRegex = new RegExp(
`<PackageReference\\s+Include\\s*=\\s*"${nugetPkgName}"\\s+Version\\s*=\\s*"([1-9]\\d*|0)\\.([1-9]\\d*|0)\\.([1-9]\\d*|0)(-preview\\.([1-9]\\d*))?"\\s*/>`,
);
// Get all the csproj files
const csprojFiles = Array.from(walkSync(rootDirPath, { includeFiles: true, exts: [".csproj"] })).map((e) => e.path);
// Replace the nuget package reference with the new version
csprojFiles.forEach((csProjFile) => {
try {
const fileData = Deno.readTextFileSync(csProjFile);
const nugetRefs = velaptorNuGetRegex.exec(fileData)?.map((match) => match.toString()) ?? [];
const velaptorNuGetRef = nugetRefs.length > 0 ? nugetRefs[0] : "";
const containsVelaptorNuGetRef = !isNothing(velaptorNuGetRef);
// If the file contains the nuget package