11<!DOCTYPE html>
22< html lang ="en-us ">
33< head >
4- < meta charset ="utf-8 " />
4+ < meta charset ="utf-8 "/>
55 < title > Laravel Upgrade Helper</ title >
66 < meta name ="description "
7- content ="It shows what's new in the files you're using and between the new version. We know, there are release notes. This is just a quick overview. ">
7+ content ="It shows what's new in the files you're using and between the new version. We know, there are release notes. This is just a quick overview. ">
88 < link rel ="shortcut icon " href ="https://laravel.com/img/favicon/favicon.ico ">
99 < script src ="https://cdn.tailwindcss.com "> </ script >
1010 < script src ="https://unpkg.com/vue@3 "> </ script >
11- < link rel ="stylesheet " type ="text/css " href ="https://cdn.jsdelivr.net/npm/diff2html/bundles/css/diff2html.min.css " />
11+ < link rel ="stylesheet " type ="text/css " href ="https://cdn.jsdelivr.net/npm/diff2html/bundles/css/diff2html.min.css "/>
1212 < script src ="
https://cdn.jsdelivr.net/npm/[email protected] /bundles/js/diff2html.min.js "
> </ script > 1313</ head >
1414< body >
15- < header >
16- < div class ="container mx-auto flex justify-end ">
17- < a class ="text-gray-600 mt-10 " href ="https://github.com/laravel-upgrade-helper " target ="_blank ">
18- < svg class ="h-5 w-5 " xmlns ="http://www.w3.org/2000/svg " viewBox ="0 0 512 512 ">
19- < path
20- d ="M256,32C132.3,32,32,134.9,32,261.7c0,101.5,64.2,187.5,153.2,217.9a17.56,17.56,0,0,0,3.8.4c8.3,0,11.5-6.1,11.5-11.4,0-5.5-.2-19.9-.3-39.1a102.4,102.4,0,0,1-22.6,2.7c-43.1,0-52.9-33.5-52.9-33.5-10.2-26.5-24.9-33.6-24.9-33.6-19.5-13.7-.1-14.1,1.4-14.1h.1c22.5,2,34.3,23.8,34.3,23.8,11.2,19.6,26.2,25.1,39.6,25.1a63,63,0,0,0,25.6-6c2-14.8,7.8-24.9,14.2-30.7-49.7-5.8-102-25.5-102-113.5,0-25.1,8.7-45.6,23-61.6-2.3-5.8-10-29.2,2.2-60.8a18.64,18.64,0,0,1,5-.5c8.1,0,26.4,3.1,56.6,24.1a208.21,208.21,0,0,1,112.2,0c30.2-21,48.5-24.1,56.6-24.1a18.64,18.64,0,0,1,5,.5c12.2,31.6,4.5,55,2.2,60.8,14.3,16.1,23,36.6,23,61.6,0,88.2-52.4,107.6-102.3,113.3,8,7.1,15.2,21.1,15.2,42.5,0,30.7-.3,55.5-.3,63,0,5.4,3.1,11.5,11.4,11.5a19.35,19.35,0,0,0,4-.4C415.9,449.2,480,363.1,480,261.7,480,134.9,379.7,32,256,32Z " />
21- </ svg >
22- </ a >
23- </ div >
24- </ header >
25- < main id ="app ">
26- < div class ="container font-sans bg-white mx-auto ">
27- < section class ="bg-white mt-20 ">
28- < div class ="max-w-2xl px-6 text-center mx-auto ">
29- < img src ="https://laravel.com/img/logomark.min.svg " alt ="Laravel Upgrade Helper " width ="50 " class ="mx-auto " />
30- < h1 class ="mt-5 text-5xl font-semibold text-gray-800 "> Laravel Upgrade Helper</ h1 >
31- < p class ="text-gray-600 mt-4 "> It shows what's new in the files you're using and between the new version. We
32- know, there are release notes. This is just a quick overview.</ p >
33- < div >
34- < p class ="mt-5 ">
35- < select v-model ="baseVersion " @change ="upgradeVersion = upgradableVersions[0] "
36- class ="block py-2.5 px-0 w-full text-sm text-gray-500 bg-transparent border-0 border-b-2 border-gray-200 appearance-none dark:text-gray-400 dark:border-gray-700 focus:outline-none focus:ring-0 focus:border-gray-200 peer ">
37- < option value ="null "> Current Version</ option >
38- < template v-for ="tag in tags ">
39- < option :value ="tag " v-text ="tag "> </ option >
40- </ template >
41- </ select >
42- </ p >
43- < p class ="mt-5 ">
44- < select v-model ="upgradeVersion "
45- class ="block py-2.5 px-0 w-full text-sm text-gray-500 bg-transparent border-0 border-b-2 border-gray-200 appearance-none dark:text-gray-400 dark:border-gray-700 focus:outline-none focus:ring-0 focus:border-gray-200 peer ">
46- < option value ="null "> Upgrade To</ option >
47- < template v-for ="upgradableVersions in upgradableVersions ">
48- < option :value ="upgradableVersions " v-text ="upgradableVersions "> </ option >
49- </ template >
50- </ select >
51- </ p >
52- < button @click ="showDiff " id ="showBtn "
53- class ="mt-10 relative inline-flex items-center justify-center p-0.5 mb-2 mr-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-pink-500 to-orange-400 group-hover:from-pink-500 group-hover:to-orange-400 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-pink-200 dark:focus:ring-pink-800 ">
15+ < header >
16+ < div class ="container mx-auto flex justify-end ">
17+ < a class ="text-gray-600 mt-10 " href ="https://github.com/laravel-upgrade-helper " target ="_blank ">
18+ < svg class ="h-5 w-5 " xmlns ="http://www.w3.org/2000/svg " viewBox ="0 0 512 512 ">
19+ < path
20+ d ="M256,32C132.3,32,32,134.9,32,261.7c0,101.5,64.2,187.5,153.2,217.9a17.56,17.56,0,0,0,3.8.4c8.3,0,11.5-6.1,11.5-11.4,0-5.5-.2-19.9-.3-39.1a102.4,102.4,0,0,1-22.6,2.7c-43.1,0-52.9-33.5-52.9-33.5-10.2-26.5-24.9-33.6-24.9-33.6-19.5-13.7-.1-14.1,1.4-14.1h.1c22.5,2,34.3,23.8,34.3,23.8,11.2,19.6,26.2,25.1,39.6,25.1a63,63,0,0,0,25.6-6c2-14.8,7.8-24.9,14.2-30.7-49.7-5.8-102-25.5-102-113.5,0-25.1,8.7-45.6,23-61.6-2.3-5.8-10-29.2,2.2-60.8a18.64,18.64,0,0,1,5-.5c8.1,0,26.4,3.1,56.6,24.1a208.21,208.21,0,0,1,112.2,0c30.2-21,48.5-24.1,56.6-24.1a18.64,18.64,0,0,1,5,.5c12.2,31.6,4.5,55,2.2,60.8,14.3,16.1,23,36.6,23,61.6,0,88.2-52.4,107.6-102.3,113.3,8,7.1,15.2,21.1,15.2,42.5,0,30.7-.3,55.5-.3,63,0,5.4,3.1,11.5,11.4,11.5a19.35,19.35,0,0,0,4-.4C415.9,449.2,480,363.1,480,261.7,480,134.9,379.7,32,256,32Z "/>
21+ </ svg >
22+ </ a >
23+ </ div >
24+ </ header >
25+ < main id ="app ">
26+ < div class ="container font-sans bg-white mx-auto ">
27+ < section class ="bg-white mt-20 ">
28+ < div class ="max-w-2xl px-6 text-center mx-auto ">
29+ < img src ="https://laravel.com/img/logomark.min.svg " alt ="Laravel Upgrade Helper " width ="50 "
30+ class ="mx-auto "/>
31+ < h1 class ="mt-5 text-5xl font-semibold text-gray-800 "> Laravel Upgrade Helper</ h1 >
32+ < p class ="text-gray-600 mt-4 "> Quickly view differences between versions for Laravel.</ p >
33+ < div >
34+ < p class ="mt-5 ">
35+ < select v-model ="baseVersion "
36+ @change ="baseVersionChange "
37+ class ="block py-2.5 px-0 w-full text-sm text-gray-500 bg-transparent border-0 border-b-2 border-gray-200 appearance-none dark:text-gray-400 dark:border-gray-700 focus:outline-none focus:ring-0 focus:border-gray-200 peer ">
38+ < option value ="null "> Current Version</ option >
39+ < template v-for ="tag in tags ">
40+ < option :value ="tag " v-text ="tag "> </ option >
41+ </ template >
42+ </ select >
43+ </ p >
44+ < p class ="mt-5 ">
45+ < select v-model ="upgradeVersion " @change ="clearResult "
46+ class ="block py-2.5 px-0 w-full text-sm text-gray-500 bg-transparent border-0 border-b-2 border-gray-200 appearance-none dark:text-gray-400 dark:border-gray-700 focus:outline-none focus:ring-0 focus:border-gray-200 peer ">
47+ < option value ="null "> Upgrade To</ option >
48+ < template v-for ="upgradableVersions in upgradableVersions ">
49+ < option :value ="upgradableVersions " v-text ="upgradableVersions "> </ option >
50+ </ template >
51+ </ select >
52+ </ p >
53+ < button @click ="showDiff " id ="showBtn "
54+ class ="mt-10 relative inline-flex items-center justify-center p-0.5 mb-2 mr-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-pink-500 to-orange-400 group-hover:from-pink-500 group-hover:to-orange-400 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-pink-200 dark:focus:ring-pink-800 ">
5455 < span
5556 class ="relative px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0 ">
5657 Show
5758 </ span >
58- </ button >
59- </ div >
59+ </ button >
6060 </ div >
61- </ section >
61+ </ div >
62+ </ section >
63+ </ div >
64+
65+ < section v-show ="showResult && diffString !=='' " class ="container mx-auto mt-3 ">
66+ < div class ="text-center ">
67+ For release notes see:
68+ < a :href ="releaseLink " target ="_blank " class ="underline italic "> link</ a >
6269 </ div >
6370
64- < section class ="container mx-auto ">
65- < h3 v-text ="diffText " class ="text-center mt-5 font-bold "> </ h3 >
66- < div v-show ="diffString !=='' " v-html ="diffHtml "> </ div >
67- </ section >
68- </ main >
69-
70- < script >
71- const { createApp } = Vue
72-
73- createApp ( {
74- data ( ) {
75- return {
76- tags : [ ] ,
77- baseVersion : null ,
78- upgradeVersion : null ,
79- diffText : "" ,
80- diffString : "" ,
81- } ;
71+ < div class ="text-center ">
72+ Click < a :href ="diffFileLink " download > < b class ="underline text-red "> here</ b > </ a >
73+ to download patch file.
74+ </ div >
75+
76+ < div class ="text-center ">
77+ < small > You may apply file like: </ small >
78+ < small > < code v-text ="'git apply <file.diff>' "> </ code > </ small >
79+ </ div >
80+
81+ < div v-show ="diffString !=='' " v-html ="diffHtml "> </ div >
82+ </ section >
83+ </ main >
84+
85+ < script >
86+ const { createApp} = Vue
87+
88+ createApp ( {
89+ data ( ) {
90+ return {
91+ tags : [ ] ,
92+ baseVersion : null ,
93+ upgradeVersion : null ,
94+ diffString : "" ,
95+ showResult : false ,
96+ } ;
97+ } ,
98+
99+ mounted ( ) {
100+ fetch ( 'tags.txt' )
101+ . then ( response => response . text ( ) )
102+ . then ( data => this . tags = data . trim ( ) . split ( '\n' ) ) ;
103+ } ,
104+
105+ methods : {
106+ clearResult ( ) {
107+ this . diffString = "" ;
108+ this . showResult = false ;
82109 } ,
83110
84- mounted ( ) {
85- fetch ( 'tags.txt' )
86- . then ( response => response . text ( ) )
87- . then ( data => this . tags = data . trim ( ) . split ( '\n' ) ) ;
111+ baseVersionChange ( ) {
112+ this . upgradeVersion = this . upgradableVersions [ 0 ] || null ;
113+ this . clearResult ( ) ;
88114 } ,
89115
90- methods : {
91- showDiff ( ) {
92- if ( ! this . tags . includes ( this . baseVersion ) ||
93- ! this . tags . includes ( this . upgradeVersion )
94- ) {
95- alert ( 'select version' ) ; // TODO: modal here!
96- return ;
97- }
116+ showDiff ( ) {
117+ if ( ! this . tags . includes ( this . baseVersion ) ||
118+ ! this . tags . includes ( this . upgradeVersion )
119+ ) {
120+ alert ( 'select version' ) ; // TODO: modal here!
121+ return ;
122+ }
98123
99- this . diffText = '' ;
100- this . diffString = '' ;
124+ this . showResult = true ;
125+ this . diffString = '' ;
101126
102- this . diffText = `${ this . baseVersion } -> ${ this . upgradeVersion } `
127+ fetch ( this . diffFileLink )
128+ . then ( response => {
129+ if ( ! response . ok ) {
130+ alert ( 'Cannot find diff' ) ;
103131
104- fetch ( `diffs/${ this . baseVersion } ...${ this . upgradeVersion } .diff` )
105- . then ( response => {
106- if ( ! response . ok ) {
107- alert ( 'Cannot find diff' ) ;
132+ throw new Error ( "Cannot find diff" ) ;
133+ }
108134
109- throw new Error ( "Cannot find diff" ) ;
110- }
135+ return response . text ( ) ;
136+ } )
137+ . then ( diffString => {
138+ this . diffString = diffString ;
111139
112- return response . text ( ) ;
113- } )
114- . then ( diffString => {
115- this . diffString = diffString ;
140+ document . getElementById ( 'showBtn' ) . scrollIntoView ( { behavior : "smooth" } ) ;
141+ } ) ;
142+ } ,
143+ } ,
116144
117- document . getElementById ( 'showBtn' ) . scrollIntoView ( { behavior : "smooth" } ) ;
118- } ) ;
119- } ,
145+ computed : {
146+ releaseLink ( ) {
147+ return 'https://github.com/laravel/laravel/releases/tag/' + this . upgradeVersion ;
120148 } ,
121149
122- computed : {
123- diffHtml ( ) {
124- return Diff2Html . html ( this . diffString , {
125- drawFileList : true ,
126- fileListToggle : true ,
127- fileListStartVisible : false ,
128- fileContentToggle : false ,
129- matching : 'lines' ,
130- outputFormat : 'side-by-side' ,
131- synchronizedScroll : true ,
132- highlight : true ,
133- renderNothingWhenEmpty : false ,
134- } ) ;
135- } ,
136-
137- upgradableVersions ( ) {
138- if ( ! this . baseVersion ) {
139- return [ ] ;
140- }
141-
142- let sameVersionTags = this . tags . filter ( tag => {
143- return tag . slice ( 0 , 2 ) === this . baseVersion . slice ( 0 , 2 ) &&
144- this . baseVersion . localeCompare (
145- tag ,
146- undefined ,
147- { numeric : true , sensitivity : 'base' }
148- ) === - 1
149- } ) ;
150+ diffFileLink ( ) {
151+ return `diffs/${ this . baseVersion } ...${ this . upgradeVersion } .diff` ;
152+ } ,
153+
154+ diffHtml ( ) {
155+ return Diff2Html . html ( this . diffString , {
156+ drawFileList : true ,
157+ fileListToggle : true ,
158+ fileListStartVisible : false ,
159+ fileContentToggle : false ,
160+ matching : 'lines' ,
161+ outputFormat : 'side-by-side' ,
162+ synchronizedScroll : true ,
163+ highlight : true ,
164+ renderNothingWhenEmpty : false ,
165+ } ) ;
166+ } ,
167+
168+ upgradableVersions ( ) {
169+ if ( ! this . baseVersion ) {
170+ return [ ] ;
171+ }
172+
173+ let sameVersionTags = this . tags . filter ( tag => {
174+ return tag . slice ( 0 , 2 ) === this . baseVersion . slice ( 0 , 2 ) &&
175+ this . baseVersion . localeCompare (
176+ tag ,
177+ undefined ,
178+ { numeric : true , sensitivity : 'base' }
179+ ) === - 1
180+ } ) ;
150181
151- const lastIndex = this . tags . indexOf ( sameVersionTags [ sameVersionTags . length - 1 ] )
182+ const lastIndex = this . tags . indexOf ( sameVersionTags [ sameVersionTags . length - 1 ] )
152183
153- if ( lastIndex < this . tags . length - 1 ) {
154- sameVersionTags . push ( this . tags [ lastIndex + 1 ] )
155- }
184+ if ( lastIndex < this . tags . length - 1 ) {
185+ sameVersionTags . push ( this . tags [ lastIndex + 1 ] )
186+ }
156187
157- return sameVersionTags
158- } ,
188+ return sameVersionTags
159189 } ,
160- } ) . mount ( '#app' )
161- </ script >
190+ } ,
191+ } ) . mount ( '#app' )
192+ </ script >
162193</ body >
163194
164- </ html >
195+ </ html >
0 commit comments