mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-10-27 03:53:49 -05:00
Add a command to start the Electron app
This commit is contained in:
31
src/cli/app.ts
Normal file
31
src/cli/app.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { createRequire } from 'module';
|
||||
import { execFileSync } from 'child_process';
|
||||
import createDebug from 'debug';
|
||||
import type { Arguments as ParentArguments } from '../cli.js';
|
||||
import { ArgumentsCamelCase, Argv, YargsArguments } from '../util.js';
|
||||
|
||||
const debug = createDebug('cli:app');
|
||||
|
||||
export const command = 'app';
|
||||
export const desc = 'Start the Electron app';
|
||||
|
||||
export function builder(yargs: Argv<ParentArguments>) {
|
||||
return yargs;
|
||||
}
|
||||
|
||||
type Arguments = YargsArguments<ReturnType<typeof builder>>;
|
||||
|
||||
export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
||||
const require = createRequire(import.meta.url);
|
||||
const electron = require('electron');
|
||||
|
||||
if (typeof electron !== 'string') {
|
||||
throw new Error('Already running in Electron??');
|
||||
}
|
||||
|
||||
execFileSync(electron, [
|
||||
'dist/app/main/app-entry.cjs',
|
||||
], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
}
|
||||
@@ -3,3 +3,4 @@ export * as nso from './nso.js';
|
||||
export * as splatnet2 from './splatnet2.js';
|
||||
export * as pctl from './pctl.js';
|
||||
export * as androidZncaApiServerFrida from './android-znca-api-server-frida.js';
|
||||
export * as app from './app.js';
|
||||
|
||||
Reference in New Issue
Block a user