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
Add --open flag to open user browser when start serving #12233
Comments
Would love to take up this issue, can you assign me the same !! |
Hi can you assign this issue to me? |
@ankitzm how is it looking? |
Yeah working on it, will be raising a PR soon. |
hey @ankitzm how it is going? it is looking good? can't wait to see it :) |
Hello, i tried working on this issue but when importing the open package via
I also attempted the solution suggested here: sindresorhus/file-type#525 (comment) but it doesn't seem to work, no errors but the browser window did not open as expected. main.registerCommand({
name: '--open',
requiresRelease: false,
pretty: false,
catalogRefresh: new catalog.Refresh.Never()
}, function (options) {
(async () => {
const { open } = await import('open')
await open('https://www.google.com')
});
}); |
Maybe try the require syntax. Depending on where it is you will have to fall back to basic Node syntax without anything else. |
Using open@8.4.2 worked with the require syntax, the following code now executes without any errors: main.registerCommand({
name: '--open',
requiresRelease: false,
pretty: false,
catalogRefresh: new catalog.Refresh.Never()
}, function (options) {
open('https://google.com')
Console.rawInfo('test')
}); However, despite no errors in the terminal output, it doesn't open any windows, I tested the package on other project and it worked. I'm not sure why it behaves this way, and I might not have the expertise to dig deeper into the issue. terminal output:
I hope this helps |
I would ask for a draft pr to see what you are doing! To add a dependency to the project, you need to add to this file meteor/scripts/dev-bundle-tool-package.js Lines 7 to 13 in d852e9c
Then run This will add the library code to the tool, making it possible to be imported. For adding a command for when you start serving, you should add the code that you commented on here: Lines 312 to 317 in d852e9c
port: { type: String, short: "p", default: DEFAULT_PORT },
open: { type: Boolean, short: "o", default: false }, // <- your code here for the open flag
'mobile-server': { type: String },
'cordova-server-port': { type: String }, Your call to the open library will probably be around here: Lines 442 to 446 in d852e9c
|
@Grubba27 is this problem solved? |
Add --open option to run command #12233
When you want to run the project and wants to open the browser when it finishes building
it would look like this:
or
it would start running the server then open your default browser
How to implement?
ROOT_URL
variable to open in the browserdiscussion for more context
Discussed in #12226
The text was updated successfully, but these errors were encountered: