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

add a new flag with --open for the dev and the preview #6578

Merged
merged 15 commits into from
Mar 28, 2023

Conversation

JerryWu1234
Copy link
Contributor

@JerryWu1234 JerryWu1234 commented Mar 17, 2023

Changes

fix bug : #6578
I have added a new flag with --open for the dev and the preview.
And have extended the config of the schema with a property of open.

I didn't find any good method to test this property of open.

Testing

Docs

@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2023

🦋 Changeset detected

Latest commit: 5feafad

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

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 Mar 17, 2023
@JerryWu1234 JerryWu1234 changed the title add --open flag add a new flag with --open for the dev and the preview Mar 19, 2023
@JerryWu1234 JerryWu1234 marked this pull request as ready for review March 19, 2023 09:47
@JerryWu1234 JerryWu1234 requested a review from a team as a code owner March 19, 2023 09:47
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

I think we also need to document the CLI flags for --help:

['--port', `Specify which port to run on. Defaults to 3000.`],
['--host', `Listen on all addresses, including LAN and public addresses.`],
['--host <custom-address>', `Expose on a network IP address at <custom-address>`],
['--help (-h)', 'See all available flags.'],

Flags: [['--help (-h)', 'See all available flags.']],

I tried running this locally, but I'm not sure it's working. I needed to handle the open option here to work:

return {
root: typeof flags.root === 'string' ? flags.root : undefined,
site: typeof flags.site === 'string' ? flags.site : undefined,
base: typeof flags.base === 'string' ? flags.base : undefined,
port: typeof flags.port === 'number' ? flags.port : undefined,
config: typeof flags.config === 'string' ? flags.config : undefined,
host:
typeof flags.host === 'string' || typeof flags.host === 'boolean' ? flags.host : undefined,
drafts: typeof flags.drafts === 'boolean' ? flags.drafts : undefined,
experimentalAssets:
typeof flags.experimentalAssets === 'boolean' ? flags.experimentalAssets : undefined,
};

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

We need to add this new option to the help command

packages/astro/src/core/config/config.ts Show resolved Hide resolved
@ematipico
Copy link
Member

@withastro/maintainers-docs could you please double check the description of the new argument?

Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

@wulinsheng123 I could suggest an option for testing:

  • share the link to the vite option that we leverage
  • share a video/gif that shows the new argument in action

@JerryWu1234
Copy link
Contributor Author

@wulinsheng123 I could suggest an option for testing:

  • share the link to the vite option that we leverage
  • share a video/gif that shows the new argument in action

What can I do without Astro including a new feature with the property of open?

@JerryWu1234
Copy link
Contributor Author

@wulinsheng123 I could suggest an option for testing:

  • share the link to the vite option that we leverage
  • share a video/gif that shows the new argument in action

Let me try to record a video

@JerryWu1234
Copy link
Contributor Author

JerryWu1234 commented Mar 22, 2023

  • share the link to the vite option that we leverage

I apologized.
I don't totally get what you said.
And don't know how to achieve it
could you give me a tips ?
@ematipico

@JerryWu1234
Copy link
Contributor Author

JerryWu1234 commented Mar 22, 2023

packages/astro/src/core/dev/dev.ts Outdated Show resolved Hide resolved
packages/astro/src/core/preview/index.ts Outdated Show resolved Hide resolved
@sarah11918 sarah11918 removed the request for review from a team March 27, 2023 21:31
@ematipico ematipico requested a review from bluwy March 28, 2023 11:26
Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Updated the flag name slightly. LGTM. Thanks for implementing this!

@bluwy bluwy merged commit adecda7 into withastro:main Mar 28, 2023
@astrobot-houston astrobot-houston mentioned this pull request Mar 28, 2023
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