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

feat(cli): scaffold out astro add command #2849

Merged
merged 40 commits into from
Mar 25, 2022
Merged

feat(cli): scaffold out astro add command #2849

merged 40 commits into from
Mar 25, 2022

Conversation

natemoo-re
Copy link
Member

@natemoo-re natemoo-re commented Mar 21, 2022

Changes

  • Introduces a new astro add command to automatically configure integrations.

  • astro add preact --yes will skip any prompts, automatically make changes. Thanks @JuanM04!

  • astro add --help will print help instructions. Thanks @JuanM04!

  • See demo below:

    • npx astro add tailwind is already installed, so wizard stops early
    • npx astro add preact is not installed, configuration is updated and dependencies installed
    • npx astro add has no arguments, so an interactive wizard prompts users to select frameworks then other integrations
astro-add-2.mov

Testing

Manually tested, interactive CLI

Docs

Integrations Guide updated

@changeset-bot
Copy link

changeset-bot bot commented Mar 21, 2022

🦋 Changeset detected

Latest commit: 6e0eed5

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

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

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 21, 2022
@natemoo-re natemoo-re force-pushed the feat/add-cmd branch 2 times, most recently from e7830ca to 4a9f257 Compare March 24, 2022 21:12
@natemoo-re natemoo-re marked this pull request as ready for review March 24, 2022 21:44
packages/astro/src/cli/add.ts Outdated Show resolved Hide resolved
packages/astro/src/cli/index.ts Outdated Show resolved Hide resolved
@JuanM04
Copy link
Contributor

JuanM04 commented Mar 24, 2022

@natemoo-re I love the logging you've made! I've added some spinners, what do you think?

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.

The interactive prompt is great! I've added some comments

packages/astro/src/core/add/index.ts Outdated Show resolved Hide resolved
packages/astro/src/core/add/index.ts Outdated Show resolved Hide resolved
@FredKSchott
Copy link
Member

A few of us just got a demo of this and I can confirm it's awesome. Thank you again @JuanM04 for kicking this effort off, and @natemoo-re for helping to carry it over the line.

I chatted with some of the other core maintainers, and the plan is to release this as "experimental" in the docs and any READMEs that reference the command. We'll use the next couple of weeks to gather feedback from users before formalizing support.

@github-actions github-actions bot added the pkg: example Related to an example package (scope) label Mar 25, 2022
@natemoo-re natemoo-re merged commit 72ef7ae into main Mar 25, 2022
@natemoo-re natemoo-re deleted the feat/add-cmd branch March 25, 2022 21:26
@github-actions github-actions bot mentioned this pull request Mar 25, 2022
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
* feat(cli): scaffold out `astro add` command

* added first babel transforms

* Format output

* Added changes confirmation

* Error flow

* Add dependencies

* feat(cli): astro add cleanup pass

* feat: add support for tailwind

* chore: update lockfile

* fix: types

* chore: rever @proload/core bump

* chore: add changeset

* chore: rollback dep update

* Added spinners

* chore: remove extra deps

* Removed extra argument

* Use `execa` instead of `exec`

* Changed how lines are trimmed within diffLines

* refactor: move add to core

* refactor: remove old add entrypoint

* refactor: simplify wording

* feat: improve diff

* feat: improve diff and logging, add interactive prompt when no args passed

* Formatted files

* Added --yes

* feat: improve logging for install command

* Fixed execa

* Added help message to add

* refactor: extract consts to own file

* feat: remove implicit projectRoot behavior

* feat: improve error handling, existing integrations

* fix(tailwind): ensure existing tailwind config is not overwritten

* refactor: prefer cwd to projectRoot flag

* chore: add refactor notes

* refactor: throw createPrettyError > implicit bail

* refactor: cleanup language

* feat(cli): prompt user before generating tailwind config

* fix(cli): update config generation to use cwd

* fix: resolve root from cwd

* chore: update changelog

Co-authored-by: JuanM04 <[email protected]>
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) pkg: example Related to an example package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants