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

Astro add docs #2958

Merged
merged 11 commits into from
Apr 6, 2022
Merged

Astro add docs #2958

merged 11 commits into from
Apr 6, 2022

Conversation

aFuzzyBear
Copy link
Contributor

@aFuzzyBear aFuzzyBear commented Apr 1, 2022

The premise of this PR is to introduce the a new cli function astro docs.

The purpose of this utility function is to launch the systems browser to point to the Astro Docs site.

Progress

browse(url) - this is the main function that launches the browser.

So far, it is agnostic to the following platforms;

  • Android,
  • Linux,
  • MacOS
  • Windows
  • Gitpod
  • Stackblitz

It doesnt work on CodeSandbox, as I was unable to find their own built in browser function. The only other thought I had to overcome this is to sniff out the CSB platform and have it open a new window and point it that way.

That is the method works, just cant seem to tie it into the cli properly, I would need to spend a bit more time on that tomorrow.

If all else fails Ill try to apply the 'open' package by sindresorhus, If I continue to have no luck,

Changes

  • Introduces a new CLI command astro docs
  • One short launch to the Docs

//TODO: Don't forget a changeset! pnpm exec changeset

Testing

I really need to figure this out, perhaps once I get the actual cli bit to work,

Docs

Yet to be written but it should be simple.


## astro docs

A single command to launch your systems browser pointing to Astro's Doc site. This is to help provide a fast way to launch the Doc site directly from your terminal! 

Something along that line, since there isnt much to it.


Considerations

I am considering the idea of a astro browser <url> CLI utility, I find that this could just be a novelty feature that may serve no other purpose than to give those terminal dwellers a fun way of launching a website from within their Astro project,

@changeset-bot
Copy link

changeset-bot bot commented Apr 1, 2022

🦋 Changeset detected

Latest commit: c5408cd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
astro Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Apr 1, 2022
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool! Did you borrow this from somewhere? Might be nice to add a comment to link back to the source.

@aFuzzyBear
Copy link
Contributor Author

I will do, mainly it was the commands that I found but I will link it back to the source code where I got it from =)
Just going to see about tying this into the cli tool,
Would it be out of whack to make an astro browse <url> ? it wouldnt be difficult at all to implement

@aFuzzyBear
Copy link
Contributor Author

Is it possible for someone to help me with getting this simple method over the line,
I have added it as best as I could to the CLI tool, as where I believe it should go, however the issue is that the browser() is now not launching properly, at least when I have tried to test this on Gitpod,

I do have some questions,
The first is what am I doing wrong, if there is anything, please do feed this back to me,
How/Where would I learn how to write tests for this.
If there is anything else please do let me know,

@aFuzzyBear
Copy link
Contributor Author

It now works !!!

I had miss read the cli function properly, when I realised it was a very simple fix, and it now works a peach!!

🚀👨‍🚀📚 astro docs ladies and fellow astronauts is by all accounts good to go, 🚀👨‍🚀📚

Copy link
Contributor

@JuanM04 JuanM04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, I love it! I've left some comments

packages/astro/src/cli/index.ts Show resolved Hide resolved
@aFuzzyBear aFuzzyBear marked this pull request as ready for review April 4, 2022 14:50
Copy link
Contributor Author

@aFuzzyBear aFuzzyBear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied @JuanM04 's recommendations and have moved the cmd('docs') to the supportedCommands() Also resolved the import conflicts from the main branch,

@aFuzzyBear
Copy link
Contributor Author

Kinda scared of the changeset it was asking if I wished to make a major bump of 0.25.4 and I didnt wish to regress the hard work of others, so I really have left this alone, sorry,

Applied creditation to where I found the
'inspiration' for this application.
Not working 🤷‍♂️
Embarrasing as it is I totally missed the part where logic was to be in.
Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @aFuzzyBear! I pushed up a few changes to clean things up, but amazing work getting this working!

@natemoo-re natemoo-re merged commit d0777ad into main Apr 6, 2022
@natemoo-re natemoo-re deleted the Astro-add-docs branch April 6, 2022 17:19
This was referenced Apr 6, 2022
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
* So This works 😎

* need to add to the cli next

* Renamed Files and Export
Applied creditation to where I found the
'inspiration' for this application.

* applied `astro docs` to cli

* Trying to add to CLI,
Not working 🤷‍♂️

* Converted into async method,

* 🎆🎆 It works!!! 🥳🎉🥳

Embarrasing as it is I totally missed the part where logic was to be in.

* Moved `docs` cmd to `supportedCommands`

* refactor: cleanup docs command

* chore: add changeset

* chore: rename browser to open

Co-authored-by: Nate Moore <nate@skypack.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants