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

Refactored install command #111

Merged
merged 4 commits into from
Jan 29, 2025
Merged

Refactored install command #111

merged 4 commits into from
Jan 29, 2025

Conversation

kevinmeijer97
Copy link
Member

Changed the flow for the install command a bit, also added the configuration for the User model so we don't need #90 anymore.

The flow of the install command now is as follows:

  • We're starting with setting up Statamic by running the statamic:install command followed up by adding @php artisan statamic:install --ansi into the post-autoload-dump, as Statamic's install command doesn't do that.

Next we setup everything for the user by:

Now we setup everything for the Eloquent Driver by:

  • Publishing the config files and changing the default table_prefix
  • Calling the statamic:install:eloquent-driver command to configure the Eloquent Driver

At last we ask the user to:

  • Configure the multisite
  • Publish the Collections, Blueprints, Fieldsets & Views from rapidez/statamic
  • Make a Statamic user

Furthermore i changed the version of rapidez/sitemap to ^3.0 for it to work with Rapidez v3.

@kevinmeijer97 kevinmeijer97 changed the title Feature/install command Refactored install command Jan 23, 2025
@kevinmeijer97
Copy link
Member Author

Made a PR to Statamic so we can select specific repositories on the install command for the Eloquent Driver.

Copy link
Member

Choose a reason for hiding this comment

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

It feels weird to have this file here with a namespace that doesn't match. Maybe create a stubs directory just like Laravel handles that?

Copy link
Member Author

Choose a reason for hiding this comment

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

But the namespace matches and we dont actually publish it to the project, we load it from this repository.
See src/Commands/InstallCommand.php:85

Copy link
Member

Choose a reason for hiding this comment

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

Ah I see, but it's likely that the end user want to edit the user model.

  1. Maybe keep it as a stub and publish it? But what if there is already a model?
  2. Keep it here and extend it within the project?
  3. If there is already a user model; that file still needs this changes.

So maybe option 2 so we can simply change the "extends ..." in case 3 so it will extend the model from this package instead of the framework? project -> package -> framework

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes 2 seems fine to me as well.
But during the install command do we just keep it in the package?
So when a user wants to extend it into their project, they can do it themselves.

@royduin
Copy link
Member

royduin commented Jan 24, 2025

If you run the command twice, it doesn't mess anything up?

@kevinmeijer97
Copy link
Member Author

If you run the command twice, it doesn't mess anything up?

Added some checks and changed some stuff around to make sure nothing breaks when running the install command multiple times.

@kevinmeijer97 kevinmeijer97 requested a review from royduin January 29, 2025 12:47
@royduin royduin merged commit 4d571f4 into master Jan 29, 2025
@royduin royduin deleted the feature/install-command branch January 29, 2025 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants