@@ -9,70 +9,6 @@ import stringify from '../lib/stringify-and-order-properties.js';
99
1010import { newBrowserEntry , updateBrowserEntry } from './utils.js' ;
1111
12- //
13- // Content of the two release note files
14- //
15- let releaseNotesText ;
16- let archivedReleaseNotesText ;
17-
18- /**
19- * initReleaseNoteFiles - Fetch both release notes file and store them
20- * @returns Logs (error messages)
21- */
22- const initReleaseNoteFiles = async ( ) => {
23- let result = '' ;
24-
25- // Fetch the regular page1
26- const releaseNote = await fetch (
27- 'https://learn.microsoft.com/en-us/deployedge/microsoft-edge-relnote-stable-channel' ,
28- ) ;
29-
30- // Check that it exists, if not exit.
31- if ( releaseNote . status != 200 ) {
32- // File not found -> log a warning
33- result = chalk `{red \nRelease note files not found for Edge (${ releaseNote . status } ).` ;
34- } else {
35- releaseNotesText = await releaseNote . text ( ) ;
36- }
37-
38- // Fetch the archived page
39- const archivedReleaseNotes = await fetch (
40- 'https://learn.microsoft.com/en-us/deployedge/microsoft-edge-relnote-archive-stable-channel' ,
41- ) ;
42- if ( archivedReleaseNotes . status != 200 ) {
43- // File not found -> log a warning
44- result += chalk `{red \nArchive release note files not found for Edge (${ archivedReleaseNotes . status } ).` ;
45- } else {
46- archivedReleaseNotesText = await archivedReleaseNotes . text ( ) ;
47- }
48-
49- return result ;
50- } ;
51-
52- /**
53- * updateReleaseNotesIfArchived - Return the new release notes URL to use
54- * @param originalURL The URL that is currently used
55- * @returns The new URL to use (eventually the same)
56- */
57- const updateReleaseNotesIfArchived = ( originalURL ) => {
58- const id = originalURL . split ( '#' ) [ 1 ] ;
59-
60- // Test if the original URL still works
61- // If the files doesn't exist or the id not found in the archive
62- // Keep the original file
63- if (
64- ! id ||
65- ! releaseNotesText ||
66- releaseNotesText . indexOf ( `<h2 id="${ id } ">` ) != - 1 ||
67- ! archivedReleaseNotesText ||
68- archivedReleaseNotesText . indexOf ( `<h2 id="${ id } ">` ) == - 1
69- ) {
70- return originalURL ; // We keep the original URL
71- }
72- // Return the archived entry.
73- return `https://learn.microsoft.com/en-us/deployedge/microsoft-edge-relnote-archive-stable-channel#${ id } ` ;
74- } ;
75-
7612/**
7713 * getFutureReleaseDate - Read the future release date
7814 * @param release The release number of the version
@@ -126,47 +62,24 @@ const getFutureReleaseDate = async (release, releaseScheduleURL) => {
12662/**
12763 * getReleaseNotesURL - Guess the URL of the release notes
12864 * @param status The status of the release
129- * @param fullRelease The release of the release
130- * @param date The date of the release
65+ * @param version The major version of the release
13166 * @returns The URL of the release notes or the empty string if not found
132- * Throws a string in case of error
67+ * @throws a string in case of error
13368 */
134- const getReleaseNotesURL = async ( status , fullRelease , date ) => {
135- // If the status isn't stable, do not give back any release notes.
136- if ( status !== 'Stable' ) {
137- return '' ;
138- }
69+ const getReleaseNotesURL = async ( status , version ) => {
70+ const url = `https://learn.microsoft.com/en-us/microsoft-edge/web-platform/release-notes/${ version } ` ;
13971
140- // Calculate the URL
141- const releaseStr = fullRelease . replace ( / \. / g, '' ) ;
142- const month = [
143- 'january' ,
144- 'february' ,
145- 'march' ,
146- 'april' ,
147- 'may' ,
148- 'june' ,
149- 'july' ,
150- 'august' ,
151- 'september' ,
152- 'october' ,
153- 'november' ,
154- 'december' ,
155- ] ;
156- const dateObj = new Date ( date ) ;
157- const dateStr = `${
158- month [ dateObj . getMonth ( ) ]
159- } -${ dateObj . getDate ( ) } -${ dateObj . getFullYear ( ) } `;
160-
161- // Check if the id exists
162- if (
163- releaseNotesText . indexOf ( `<h2 id="version-${ releaseStr } -${ dateStr } ">` ) == - 1
164- ) {
165- // Section not found -> log a warning
166- throw chalk `{red \nSection not found in official release notes for Edge ${ fullRelease } }` ;
72+ const releaseNote = await fetch ( url ) ;
73+
74+ if ( releaseNote . status != 200 ) {
75+ if ( status !== 'Stable' ) {
76+ return '' ;
77+ }
78+
79+ throw chalk `{red \nFailed to fetch Edge ${ version } release notes at ${ url } !}` ;
16780 }
16881
169- return `https://learn.microsoft.com/en-us/deployedge/microsoft-edge-relnote-stable-channel#version- ${ releaseStr } - ${ dateStr } ` ;
82+ return url ;
17083} ;
17184
17285/**
@@ -175,10 +88,7 @@ const getReleaseNotesURL = async (status, fullRelease, date) => {
17588 * @returns The log of what has been generated (empty if nothing)
17689 */
17790export const updateEdgeReleases = async ( options ) => {
178- //
179- // Read the release note files
180- //
181- let result = await initReleaseNoteFiles ( ) ;
91+ let result = '' ;
18292
18393 //
18494 // Get the JSON with the versions from edge releases
@@ -270,11 +180,7 @@ export const updateEdgeReleases = async (options) => {
270180 // Get the release notes
271181 let releaseNotesURL = '' ;
272182 try {
273- releaseNotesURL = await getReleaseNotesURL (
274- value ,
275- data [ value ] . fullVersion ,
276- data [ value ] . versionDate ,
277- ) ;
183+ releaseNotesURL = await getReleaseNotesURL ( value , data [ value ] . version ) ;
278184 } catch ( s ) {
279185 result += s ;
280186 }
@@ -325,10 +231,7 @@ export const updateEdgeReleases = async (options) => {
325231 edgeBCD . browsers [ options . bcdBrowserName ] . releases [ i . toString ( ) ]
326232 . release_date ,
327233 'retired' ,
328- updateReleaseNotesIfArchived (
329- edgeBCD . browsers [ options . bcdBrowserName ] . releases [ i . toString ( ) ]
330- . release_notes ,
331- ) ,
234+ '' ,
332235 '' ,
333236 ) ;
334237 } else {
0 commit comments