Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node launcher #134

Merged
merged 30 commits into from
Feb 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3b04307
Improve manifest lookup
kruplm Jan 31, 2023
ff2dfc5
Add lazy loading
kruplm Jan 31, 2023
a589527
Add @compose/node-launcher
kruplm Jan 31, 2023
6fa4883
Bundle modules as ES
kruplm Feb 9, 2023
ff426aa
Improve manifest lookup
kruplm Jan 31, 2023
993a250
Add lazy loading
kruplm Jan 31, 2023
71823da
Add @compose/node-launcher
kruplm Jan 31, 2023
91c0fd8
Bundle modules as ES
kruplm Feb 9, 2023
ed88d70
Merge branch 'node-launcher' of https://github.com/kruplm/ComposeUI i…
kruplm Feb 9, 2023
2d7a34a
Add node-launcher to the monorepo
kruplm Feb 9, 2023
4024f31
Add BrowserWindow
kruplm Feb 9, 2023
c99dec8
Remove unnecessary global name for bundles
kruplm Feb 9, 2023
894e03d
Rename variables
kruplm Feb 10, 2023
72671c7
Choose MainWindow Dynamically
kruplm Feb 10, 2023
d80f37c
ManifestParser is static
kruplm Feb 13, 2023
a3a4cfc
Clean up code
kruplm Feb 14, 2023
644b0f8
Set title for window
kruplm Feb 14, 2023
ed25870
Parse Command line arguments with System.CommandLine
kruplm Feb 14, 2023
e137463
Set default title if user not specified
kruplm Feb 14, 2023
0d4a429
Improve Option handling
kruplm Feb 14, 2023
d508d70
MainWebWindowOptionsParser is static and has default values.
kruplm Feb 15, 2023
9444a0c
ArgsArray is local variable
kruplm Feb 15, 2023
736fbd2
Clean-up
kruplm Feb 15, 2023
49e72e8
Improve casting
kruplm Feb 15, 2023
3f0c658
Height and Width are optional
kruplm Feb 17, 2023
2bb7ffc
Launcher throws error if there' are no arguments.
kruplm Feb 17, 2023
e3ddb68
Clean-up
kruplm Feb 17, 2023
b54808e
Merge branch 'main' into node-launcher
kruplm Feb 17, 2023
d3a7fad
Defaults are const
kruplm Feb 17, 2023
529d135
Merge branch 'node-launcher' of https://github.com/kruplm/ComposeUI i…
kruplm Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean-up
  • Loading branch information
kruplm committed Feb 15, 2023
commit 736fbd246a2c1b0c0587b7a1da2e3ff5f4c7e118
8 changes: 2 additions & 6 deletions Tryouts/Prototypes/Shell/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -28,15 +28,11 @@ namespace Shell
/// </summary>
public partial class App : Application
{
public string[] CommandLineArguments { get; set; }

private void Application_Startup(object sender, StartupEventArgs e)
{
CommandLineArguments = e.Args;

if (CommandLineArguments.Length != 0)
if (e.Args.Length != 0)
{
MainWebWindowOptions webWindowOptions = MainWebWindowOptionsParser.Parse(CommandLineArguments);
MainWebWindowOptions webWindowOptions = MainWebWindowOptionsParser.Parse(e.Args);
Application.Current.MainWindow = new MainWebWindow(webWindowOptions);
Application.Current.MainWindow.Show();
}
Original file line number Diff line number Diff line change
@@ -4,16 +4,16 @@ import { Launcher } from './Launcher.js';
export class BrowserWindow {
private launcher: Launcher;

constructor(private _config: WindowConfig) {
constructor(private config: WindowConfig) {
this.launcher = new Launcher();
}

public open() {
this.launcher.launch(this._config);
this.launcher.launch(this.config);
}

public loadUrl(_url: string) {
this._config.url=_url
this.launcher.launch(this._config);
public loadUrl(url: string) {
this.config.url = url
this.launcher.launch(this.config);
}
}
24 changes: 12 additions & 12 deletions Tryouts/Prototypes/Shell/Node-launcher/Lib/src/Launcher.ts
Original file line number Diff line number Diff line change
@@ -2,30 +2,30 @@ import { execFile } from 'child_process';
import { WindowConfig } from './WindowConfig';

export class Launcher {
private processArgs(_config?: WindowConfig) {
private processArgs(config?: WindowConfig) {
let argsArray = [];
if (_config) {
if (_config?.url) {
argsArray.push(`--url=${_config?.url}`);
if (config) {
if (config?.url) {
argsArray.push(`--url=${config?.url}`);
}

if (_config?.width) {
argsArray.push(`--width=${_config?.width}`);
if (config?.width) {
argsArray.push(`--width=${config?.width}`);
}

if (_config?.height) {
argsArray.push(`--height=${_config?.height}`);
if (config?.height) {
argsArray.push(`--height=${config?.height}`);
}
if (_config?.title) {
argsArray.push(`--title=${_config?.title}`);
if (config?.title) {
argsArray.push(`--title=${config?.title}`);
}
}

return argsArray;
}

public launch(_config?: WindowConfig) {
let argsArray = this.processArgs(_config);
public launch(config?: WindowConfig) {
let argsArray = this.processArgs(config);
//TODO replace after application is properly packaged and added to PATH
BalassaMarton marked this conversation as resolved.
Show resolved Hide resolved
var path = process.cwd() + "\\Tryouts\\Prototypes\\Shell\\bin\\Debug\\net6.0-windows\\";
const child = execFile(path + "Shell.exe", argsArray, (error, stdout, stderr) => {