@@ -18,25 +18,36 @@ import { ButtonMDRC } from './renderChildren/ButtonMDRC';
1818import { InlineButtonMDRC } from './renderChildren/InlineButtonMDRC' ;
1919import { ButtonBuilderModal } from './fields/button/ButtonBuilderModal' ;
2020
21+ export enum MetaBindBuild {
22+ DEV = 'dev' ,
23+ CANARY = 'canary' ,
24+ RELEASE = 'release' ,
25+ }
26+
2127export default class MetaBindPlugin extends Plugin implements IPlugin {
22- // @ts -ignore defined in `onload`
28+ // @ts -expect-error TS2564
2329 settings : MetaBindPluginSettings ;
2430
25- // @ts -ignore defined in `onload`
31+ // @ts -expect-error TS2564
2632 mdrcManager : MDRCManager ;
2733
28- // @ts -ignore defined in `onload`
34+ // @ts -expect-error TS2564
2935 metadataManager : MetadataManager ;
3036
31- // @ts -ignore defined in `onload`
37+ // @ts -expect-error TS2564
3238 api : API ;
3339
34- // @ts -ignore defined in `onload`
40+ // @ts -expect-error TS2564
3541 internal : ObsidianAPIAdapter ;
3642
43+ // @ts -expect-error TS2564
44+ build : MetaBindBuild ;
45+
3746 async onload ( ) : Promise < void > {
3847 console . log ( `meta-bind | Main >> load` ) ;
3948
49+ this . build = this . determineBuild ( ) ;
50+
4051 // load and immediately save settings to apply migrations
4152 await this . loadSettings ( ) ;
4253 await this . saveSettings ( ) ;
@@ -144,15 +155,6 @@ export default class MetaBindPlugin extends Plugin implements IPlugin {
144155 // LP editor extension
145156 this . registerEditorExtension ( createMarkdownRenderChildWidgetEditorPlugin ( this ) ) ;
146157
147- // this.addCommand({
148- // id: 'mb-debugger-command',
149- // name: 'debugger',
150- // callback: () => {
151- // // eslint-disable-next-line no-debugger
152- // debugger;
153- // },
154- // });
155-
156158 // register commands
157159 this . addCommand ( {
158160 id : 'open-docs' ,
@@ -195,6 +197,9 @@ export default class MetaBindPlugin extends Plugin implements IPlugin {
195197
196198 // register settings tab
197199 this . addSettingTab ( new MetaBindSettingTab ( this . app , this ) ) ;
200+
201+ // add indicator for dev and canary builds
202+ this . addStatusBarBuildIndicator ( ) ;
198203 }
199204
200205 onunload ( ) : void {
@@ -203,6 +208,32 @@ export default class MetaBindPlugin extends Plugin implements IPlugin {
203208 this . metadataManager . unload ( ) ;
204209 }
205210
211+ determineBuild ( ) : MetaBindBuild {
212+ if ( MB_GLOBAL_CONFIG_DEV_BUILD ) {
213+ return MetaBindBuild . DEV ;
214+ } else if ( this . manifest . version . includes ( 'canary' ) ) {
215+ return MetaBindBuild . CANARY ;
216+ } else {
217+ return MetaBindBuild . RELEASE ;
218+ }
219+ }
220+
221+ addStatusBarBuildIndicator ( ) : void {
222+ if ( this . build === MetaBindBuild . DEV ) {
223+ const item = this . addStatusBarItem ( ) ;
224+ item . setText ( 'Meta Bind Dev Build' ) ;
225+ item . addClass ( 'mb-error' ) ;
226+ this . register ( ( ) => item . remove ( ) ) ;
227+ }
228+
229+ if ( this . build === MetaBindBuild . CANARY ) {
230+ const item = this . addStatusBarItem ( ) ;
231+ item . setText ( `Meta Bind Canary Build (${ this . manifest . version } )` ) ;
232+ item . addClass ( 'mb-error' ) ;
233+ this . register ( ( ) => item . remove ( ) ) ;
234+ }
235+ }
236+
206237 isFilePathExcluded ( path : string ) : boolean {
207238 for ( const excludedFolder of this . settings . excludedFolders ) {
208239 if ( path . startsWith ( excludedFolder ) ) {
0 commit comments