Show force language menu in CI builds

This commit is contained in:
Samuel Elliott 2023-06-02 00:58:35 +01:00
parent b16f77d13e
commit 49b6d0dce2
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
2 changed files with 12 additions and 8 deletions

View File

@ -13,11 +13,13 @@ import { SavedToken } from '../../common/auth/coral.js';
import { SavedMoonToken } from '../../common/auth/moon.js';
import { CachedWebServicesList } from '../../common/users.js';
import createDebug from '../../util/debug.js';
import { dev, dir } from '../../util/product.js';
import { dev, dir, git } from '../../util/product.js';
import { languages } from '../i18n/index.js';
const debug = createDebug('app:main:menu');
const show_force_language_menu = dev || git?.branch?.match(/^(i18n$|trans-)/);
export default class MenuApp {
tray: Tray;
@ -121,7 +123,7 @@ export default class MenuApp {
menu.append(new MenuItem({type: 'separator'}));
menu.append(new MenuItem({label: t('show_main_window')!, click: () => this.app.showMainWindow()}));
menu.append(new MenuItem({label: t('preferences')!, click: () => this.app.showPreferencesWindow()}));
if (dev) menu.append(new MenuItem({label: 'Language', submenu: Menu.buildFromTemplate([
if (show_force_language_menu) menu.append(new MenuItem({label: 'Language', submenu: Menu.buildFromTemplate([
...this.app.i18n.options.supportedLngs || ['cimode'],
].map(l => new MenuItem({
label: languages[l as keyof typeof languages]?.name ?? l,

View File

@ -12,6 +12,12 @@ import createDebug from 'debug';
const debug = createDebug('nxapi:util:product');
interface RevisionInfo {
revision: string;
branch: string | null;
changed_files: string[];
}
//
// Embedded package/version info injected during Rollup build
//
@ -19,11 +25,7 @@ const debug = createDebug('nxapi:util:product');
/** @internal */
declare global {
var __NXAPI_BUNDLE_PKG__: any | undefined;
var __NXAPI_BUNDLE_GIT__: {
revision: string;
branch: string | null;
changed_files: string[];
} | null | undefined;
var __NXAPI_BUNDLE_GIT__: RevisionInfo | null | undefined;
var __NXAPI_BUNDLE_RELEASE__: string | null | undefined;
var __NXAPI_BUNDLE_DEFAULT_REMOTE_CONFIG__: any | undefined;
}
@ -53,7 +55,7 @@ export const docker: string | true | null = pkg.__nxapi_docker ?? await (async (
}
})();
export const git = typeof embedded_git !== 'undefined' ? embedded_git : pkg.__nxapi_git ?? await (async () => {
export const git: RevisionInfo | null = typeof embedded_git !== 'undefined' ? embedded_git : pkg.__nxapi_git as RevisionInfo | null | undefined ?? await (async () => {
try {
await fs.stat(path.join(dir, '.git'));
} catch (err) {