chore: Unignore generated bindings.ts, needed for action builds
This commit is contained in:
parent
72681356fd
commit
e20f828bf8
13 changed files with 1245 additions and 35 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,7 +3,6 @@ dev.db-journal
|
|||
.cargo/config.toml
|
||||
.deps/*
|
||||
vite.config.ts.timestamp*
|
||||
packages/client/src/bindings.ts
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/node,rust,yarn,linux,macos,windows,intellij+all,rust-analyzer,visualstudiocode,intellij,intellij+iml,git
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=node,rust,yarn,linux,macos,windows,intellij+all,rust-analyzer,visualstudiocode,intellij,intellij+iml,git
|
||||
|
|
|
|||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
|
@ -188,5 +188,6 @@
|
|||
"*.vue": "$(capture).*.ts, $(capture).*.js, $(capture).story.vue",
|
||||
"*.w": "$(capture).*.w, I$(capture).w",
|
||||
"*.xaml": "$(capture).xaml.cs"
|
||||
}
|
||||
},
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,17 @@ macro_rules! collect_commands {
|
|||
install_update,
|
||||
// Other
|
||||
set_window_style,
|
||||
get_program_info
|
||||
]
|
||||
}};
|
||||
}
|
||||
|
||||
#[specta::specta]
|
||||
#[tauri::command]
|
||||
pub fn get_program_info() -> Result<super::statics::ProgramInfo, String> {
|
||||
Ok(super::statics::get_program_info())
|
||||
}
|
||||
|
||||
#[specta::specta]
|
||||
#[tauri::command]
|
||||
pub async fn get_minecraft_versions() -> Result<Vec<Version>, String> {
|
||||
|
|
|
|||
|
|
@ -46,8 +46,7 @@ pub async fn run_app<F: FnOnce(&tauri::AppHandle<tauri::Wry>) + Send + 'static>(
|
|||
) {
|
||||
let prebuild = tauri_specta::Builder::<tauri::Wry>::new()
|
||||
.commands(collect_commands!())
|
||||
.events(collect_events!())
|
||||
.constant("PROGRAM_INFO", get_program_info());
|
||||
.events(collect_events!());
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
prebuild
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { PROGRAM_INFO } from '@onelauncher/client/bindings';
|
||||
import { getProgramInfo } from '@onelauncher/client';
|
||||
import AnimatedRoutes from '~ui/components/AnimatedRoutes';
|
||||
import { onMount, type ParentProps } from 'solid-js';
|
||||
import { MultiProvider } from './ui/components/MultiProvider';
|
||||
|
|
@ -12,7 +12,7 @@ import { SettingsProvider } from './ui/hooks/useSettings';
|
|||
|
||||
function RootLayout(props: ParentProps) {
|
||||
onMount(() => {
|
||||
if (PROGRAM_INFO.dev_build !== true)
|
||||
if (getProgramInfo().dev_build !== true)
|
||||
document.addEventListener('contextmenu', e => e.preventDefault());
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -20,27 +20,29 @@ import ClusterRoot from '~ui/pages/cluster/ClusterRoot';
|
|||
import Onboarding from '~ui/pages/onboarding/Onboarding';
|
||||
import SettingsRoot from '~ui/pages/settings/SettingsRoot';
|
||||
import { render } from 'solid-js/web';
|
||||
import { bridge } from './imports';
|
||||
import RootLayout from './RootLayout';
|
||||
import HomePage from './ui/pages/Home';
|
||||
import UpdatesPage from './ui/pages/Updates';
|
||||
import { getProgramInfo, initProgramInfo } from '@onelauncher/client';
|
||||
|
||||
document.body.setAttribute('data-platform', bridge.PROGRAM_INFO.platform);
|
||||
initProgramInfo().finally(() => {
|
||||
document.body.setAttribute('data-platform', getProgramInfo().platform);
|
||||
|
||||
render(() => (
|
||||
<Router root={RootLayout}>
|
||||
<Route component={App}>
|
||||
<Route component={HomePage} path="/" />
|
||||
<Route component={UpdatesPage} path="/updates" />
|
||||
<Route children={<ClusterRoot.Routes />} component={ClusterRoot} path="/clusters" />
|
||||
<Route children={<SettingsRoot.Routes />} component={SettingsRoot} path="/settings" />
|
||||
<Route children={<BrowserRoot.Routes />} component={BrowserRoot} path="/browser" />
|
||||
</Route>
|
||||
render(() => (
|
||||
<Router root={RootLayout}>
|
||||
<Route component={App}>
|
||||
<Route component={HomePage} path="/" />
|
||||
<Route component={UpdatesPage} path="/updates" />
|
||||
<Route children={<ClusterRoot.Routes />} component={ClusterRoot} path="/clusters" />
|
||||
<Route children={<SettingsRoot.Routes />} component={SettingsRoot} path="/settings" />
|
||||
<Route children={<BrowserRoot.Routes />} component={BrowserRoot} path="/browser" />
|
||||
</Route>
|
||||
|
||||
<Route
|
||||
children={Onboarding.Routes}
|
||||
component={Onboarding}
|
||||
path="/onboarding"
|
||||
/>
|
||||
</Router>
|
||||
), document.getElementById('root') as HTMLElement);
|
||||
<Route
|
||||
children={Onboarding.Routes}
|
||||
component={Onboarding}
|
||||
path="/onboarding"
|
||||
/>
|
||||
</Router>
|
||||
), document.getElementById('root') as HTMLElement);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { PROGRAM_INFO, type Settings } from '@onelauncher/client/bindings';
|
||||
import type { Settings } from '@onelauncher/client/bindings';
|
||||
import { getProgramInfo } from '@onelauncher/client';
|
||||
import { useBeforeLeave } from '@solidjs/router';
|
||||
import { bridge } from '~imports';
|
||||
import { type Context, createContext, createEffect, type ParentProps, Show, useContext } from 'solid-js';
|
||||
|
|
@ -44,7 +45,7 @@ export function SettingsProvider(props: ParentProps) {
|
|||
},
|
||||
};
|
||||
|
||||
if (PROGRAM_INFO.dev_build)
|
||||
if (getProgramInfo().dev_build)
|
||||
// @ts-expect-error - Expose settings globally for debugging purposes
|
||||
window.onelauncherSettings = controller;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { PROGRAM_INFO } from '@onelauncher/client/bindings';
|
||||
import { getProgramInfo } from '@onelauncher/client';
|
||||
import { Route } from '@solidjs/router';
|
||||
import { writeText } from '@tauri-apps/plugin-clipboard-manager';
|
||||
import { Brush01Icon, CodeSnippet02Icon, MessageTextSquare01Icon, RefreshCcw02Icon, Rocket02Icon, Sliders04Icon, Users01Icon } from '@untitled-theme/icons-solid';
|
||||
|
|
@ -89,13 +89,16 @@ function Info() {
|
|||
});
|
||||
}}
|
||||
>
|
||||
{`
|
||||
{(() => {
|
||||
const PROGRAM_INFO = getProgramInfo();
|
||||
return `
|
||||
Launcher Version: ${PROGRAM_INFO.launcher_version}
|
||||
Tauri Version: ${PROGRAM_INFO.tauri_version}
|
||||
Webview Version: ${PROGRAM_INFO.webview_version}
|
||||
Platform: ${PROGRAM_INFO.platform} ${PROGRAM_INFO.arch} bit
|
||||
Build: ${PROGRAM_INFO.dev_build ? 'dev' : 'release'}
|
||||
`.trim()}
|
||||
`.trim();
|
||||
})()}
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
|
|
|||
1182
packages/client/src/bindings.ts
generated
Normal file
1182
packages/client/src/bindings.ts
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,11 +1,11 @@
|
|||
import type { PlausibleOptions as PlausibleTrackerOptions } from 'plausible-tracker';
|
||||
import type { ProgramInfo } from '../types';
|
||||
|
||||
import type { ProgramInfo } from '../bindings';
|
||||
import Plausible from 'plausible-tracker';
|
||||
import { createEffect, createSignal } from 'solid-js';
|
||||
import { createMutable } from 'solid-js/store';
|
||||
import { PROGRAM_INFO } from '../bindings';
|
||||
import { createPersistedMutable, useSolidStore } from '../library';
|
||||
import { getProgramInfo } from '../utils';
|
||||
import { useDebugState } from './useDebug';
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@ export const plausibleState: PlausibleState = createPersistedMutable(
|
|||
createMutable<PlausibleState>({
|
||||
shareFullTelemetry: false, // false by default
|
||||
platform: 'unknown',
|
||||
programInfo: PROGRAM_INFO,
|
||||
programInfo: getProgramInfo(),
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1 @@
|
|||
import type { PROGRAM_INFO } from '../bindings';
|
||||
|
||||
export type ProgramInfo = typeof PROGRAM_INFO;
|
||||
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
export * from './highlight';
|
||||
export * from './markdown';
|
||||
export * from './modrinth';
|
||||
export * from './programInfo';
|
||||
export * from './sorting';
|
||||
export * from './timer';
|
||||
|
|
|
|||
18
packages/client/src/utils/programInfo.ts
Normal file
18
packages/client/src/utils/programInfo.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { commands, type ProgramInfo } from '../bindings';
|
||||
|
||||
let _programInfo: ProgramInfo = {
|
||||
arch: 'unknown',
|
||||
platform: 'unknown',
|
||||
dev_build: true,
|
||||
launcher_version: 'unknown',
|
||||
tauri_version: 'unknown',
|
||||
webview_version: 'unknown',
|
||||
};
|
||||
|
||||
export async function initProgramInfo() {
|
||||
const result = await commands.getProgramInfo();
|
||||
if (result.status === 'ok')
|
||||
_programInfo = result.data;
|
||||
}
|
||||
|
||||
export const getProgramInfo = () => _programInfo;
|
||||
Loading…
Add table
Reference in a new issue