@@ -27,7 +27,7 @@ function getTELFrontEndPackageVersion() {
2727
2828// Task that adds a second public static string to existing file that provides the TELFrontend.css version
2929gulp . task ( "add-telFrontEndVersion-to-versionInfo" , function ( done ) {
30- const versionFilePath = "TELBlazorPackageVersion/VersionInfo.cs" ;
30+ const versionFilePath = "TELBlazorPackageVersion/VersionInfo.TELFrontEnd. cs" ;
3131 const TELFrontEndPackageVersion = getTELFrontEndPackageVersion ( ) ;
3232
3333 if ( TELFrontEndPackageVersion === null ) {
@@ -37,29 +37,16 @@ gulp.task("add-telFrontEndVersion-to-versionInfo", function (done) {
3737
3838 console . log ( `Adding TELFrontEndPackageVersion to CS file at: ${ versionFilePath } ` ) ;
3939
40- if ( fs . existsSync ( versionFilePath ) ) {
41- console . log ( "File exists, adding TELFrontEndPackageVersion string" ) ;
4240
43- // Read existing content
44- let existingContent = fs . readFileSync ( versionFilePath , "utf8" ) ;
45- console . log ( "Existing content:" , existingContent ) ;
41+ // Read existing content
42+ let existingContent = fs . readFileSync ( versionFilePath , "utf8" ) ;
43+ console . log ( "Existing content:" , existingContent ) ;
4644
47- // Find the closing brace of the class
48- const closingBraceIndex = existingContent . lastIndexOf ( "}" ) ;
49- const secondLastBraceIndex = existingContent . lastIndexOf ( "}" , closingBraceIndex - 1 ) ;
45+ const content = ` namespace TELBlazor.Components.TELBlazorPackageVersion{public static partial class VersionInfo{public static readonly string TELFrontEndPackageVersion = "${ TELFrontEndPackageVersion } ";}} ` ;
5046
51- if ( closingBraceIndex > 0 && secondLastBraceIndex > 0 ) {
52- // Insert the new property before the class closing brace
53- const newContent = existingContent . substring ( 0 , secondLastBraceIndex ) +
54- ` public static string TELFrontEndPackageVersion = "${ TELFrontEndPackageVersion } "; ` +
55- existingContent . substring ( secondLastBraceIndex ) ;
56-
57- fs . writeFileSync ( versionFilePath , newContent ) ;
58- console . log ( "Second string added successfully!" ) ;
59- } else {
60- console . error ( "Couldn't find proper location to insert second string" ) ;
61- }
62- }
47+ // Write or overwrite the file completely
48+ fs . writeFileSync ( versionFilePath , content , "utf8" ) ;
49+ console . log ( `VersionInfo.TELFrontEnd.cs file updated with version ${ TELFrontEndPackageVersion } ` ) ;
6350
6451 done ( ) ;
6552} ) ;
0 commit comments