INNER CODE UNIT · TypeScript

csprojFiles

KinsonDigital/Velaptor · .github/cicd-scripts/update-velaptor-nuget-versions.ts:38

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
		if (containsVelaptorNuGetRef) {
			const versionRegex = /([1-9]\d*|0)\.([1-9]\d*|0)\.([1-9]\d*|0)(-preview\.([1-9]\d*))?/;
			const oldVersion = versionRegex.exec(velaptorNuGetRef)?.map((match) => match.toString())[0] ?? "";

			const newFileData = fileData.replace(velaptorNuGetRegex, newNugetPackage);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…