wintercms/winter

Composer post create project commands fail on Windows

damsfx opened this issue · 7 comments

Winter CMS Build

dev-develop

PHP Version

8.1

Database engine

MySQL/MariaDB

Plugins installed

No response

Issue description

Related

The new composer post commands on Windows are done with all default values.

My tests are running the following on both Windows and Windows Subsystem Linux:

wintercms/winter (dev-develop 5f53526)
winter/storm (dev-develop a37c1f9)
winter/wn-backend-module (dev-develop e11d279)
winter/wn-cms-module (dev-develop 3ba7bcf)
winter/wn-system-module (dev-develop 9ac3b57)
  • Windows = ❌ the command php artisan winter:install is executed without user interaction.
  • WSL = ✅ All went well

Steps to replicate

On a Windows system, simply run composer create-project wintercms/winter example.com "dev-develop"

Workaround

No response

It works on my windows system as the old composer-installation and like the the documentaion.
When composer create-project wintercms/winter . "dev-develop" is done ypu can run winter:install and all works as know (select, database, etc)

@damsfx @nialma according to this - composer/composer#11709 (comment) - it won't be doable for php artisan winter:install to work on Windows as part of the post-create-project scripts.

Instead of @nialma's suggestion of rolling back the post-create-project-cmd changes in #1243, I wonder if we could opt instead to change it so it can bootstrap Winter non-interactively. Ideally, we can follow similar steps to what our devcontainer bootstrap script does, namely:

  • Run php artisan winter:env
  • Run php artisan key:generate
  • Create an empty database.sqlite file in the storage folder
  • Update .env and set DB_CONNECTION as sqlite and DB_DATABASE as storage/database.sqlite
  • Run php artisan migrate
  • Run php artisan winter:mirror public/

This would get the environment set up in a way that it could be run immediately.

Any thoughts on the above? (/cc @LukeTowers)

@bennothommo

just did this for myself because I work with Windows and there is currently an error. With the "step back" in Composer I'm back to the "old" installation - if there's an easier way, I don't mind - it works fine for me under Windows....

Your idea is good, but not everyone works with SQLite... they should

  1. a query of the DB can be installed
  2. DB name can be queried etc...
    The current installation mode is really good

@damsfx i work also and at the moment only with windows an php artisan winter:install does ask me anything as the "old" versions with the "step back" in the composer.js

@nialma You're right, not everyone uses SQLite, but the intention is to make it so that composer create-project wintercms/winter can be used to basically get started with a Winter project immediately and then, if necessary, the user can modify the configuration / .env file to suit their environment.

You can see that Laravel does exactly the same thing when someone runs composer create-project laravel/laravel.

@bennothommo that sounds plausible and good....

You can see that Laravel does exactly the same thing when someone runs composer create-project laravel/laravel.

and that is the reason why i use for a laravel-project a downloaded version and make it manual and not with composer...... local i use laragon with marianDB/mySQL php 8.2.24

@bennothommo @nialma For myself, I use both MariaDB and SQLite databases, depending on the needs of the project.

Aligning with Laravel's choices doesn't worry me, as long as it allows new users to have a project up and running in a single command line.
Then, for those who want other settings, there's nothing to stop them running a php artisan winter:install --force command, right?

In my opinion, the more WinterCMS is aligned with Laravel, the better! Povilas' experience in testing Laravel-based CMS fits in with this idea.

@bennothommo I'm game with your proposed flow, could we perhaps have the final step be outputting to the console instructions for running winter:install --force to make it easier to guide people to use the CLI installer if they've just created a new project so that they can go through the flow to set the other values handled by that process (user etc)?