INNER CODE UNIT · TypeScript

nugetRefs

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

		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);

			Deno.writeTextFileSync(csProjFile, newFileData);

			const updateFileMsg = `The NuGet package 'KinsonDigital.Velaptor' was updated from version` +
				`'${oldVersion}' to version '${newVersion}' in the csproj file '${csProjFile}'`;
			printGitHubNotice(updateFileMsg);
		}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…