INNER CODE UNIT · TypeScript
newVersionRegex
KinsonDigital/Velaptor · .github/cicd-scripts/update-velaptor-nuget-versions.ts:22
const newVersionRegex = /^([1-9]\d*|0)\.([1-9]\d*|0)\.([1-9]\d*|0)(-preview\.([1-9]\d*))?$/;
newVersion = newVersion.startsWith("v") ? newVersion.substring(1) : newVersion;
if (!newVersionRegex.test(newVersion)) {
printGitHubError(`The version '${newVersion}' is invalid. Must be of type '#.#.#[-preview.#]'.`);
Deno.exit(1);
}
const newNugetPackage = `<PackageReference Include="${nugetPkgName}" Version="${newVersion}" />`;
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);