File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed
extensions/package-manager/js/src/admin Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import MajorUpdater from './MajorUpdater';
77import ExtensionItem from './ExtensionItem' ;
88import { Extension } from 'flarum/admin/AdminApplication' ;
99import ItemList from 'flarum/common/utils/ItemList' ;
10+ import { isProductionReady } from '../utils/versions' ;
1011
1112export interface IUpdaterAttrs extends ComponentAttrs { }
1213
@@ -24,7 +25,7 @@ export default class Updater extends Component<IUpdaterAttrs> {
2425 < div className = "ExtensionManager-updaterControls" > { this . controlItems ( ) . toArray ( ) } </ div >
2526 { this . availableUpdatesView ( ) }
2627 </ div > ,
27- core && core . package [ 'latest-major' ] ? (
28+ core && core . package [ 'latest-major' ] && isProductionReady ( core . package [ 'latest-major' ] ) ? (
2829 < MajorUpdater coreUpdate = { core . package } updateState = { app . extensionManager . control . lastUpdateRun . major } />
2930 ) : null ,
3031 ] ;
Original file line number Diff line number Diff line change 1+ export enum VersionStability {
2+ Stable = 'stable' ,
3+ Alpha = 'alpha' ,
4+ Beta = 'beta' ,
5+ RC = 'rc' ,
6+ Dev = 'dev' ,
7+ }
8+
9+ export function isProductionReady ( version : string ) : boolean {
10+ return [ VersionStability . Stable ] . includes ( stability ( version ) ) ;
11+ }
12+
13+ export function stability ( version : string ) : VersionStability {
14+ const split = version . split ( '-' ) ;
15+
16+ if ( split . length === 1 ) {
17+ return VersionStability . Stable ;
18+ }
19+
20+ const stab = split [ 1 ] . split ( '.' ) [ 0 ] . toLowerCase ( ) ;
21+
22+ switch ( stab ) {
23+ case 'alpha' :
24+ return VersionStability . Alpha ;
25+ case 'beta' :
26+ return VersionStability . Beta ;
27+ case 'rc' :
28+ return VersionStability . RC ;
29+ default :
30+ return VersionStability . Dev ;
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments