joachim-n / drupal-core-development-project

Project template for developing Drupal core with a git clone.
39 stars 12 forks source link

On install, copy Drupal core's example.gitignore and add the files that we place in the core repo #30

Open joachim-n opened 1 week ago

joachim-n commented 1 week ago

The core git clone doesn't have its own .gitignore at the root, it just ships with an example.gitignore.

So we should copy this during the Composer install process, and add to it.

Those are:

rpkoller commented 1 week ago

three additions to the two mentioned entires. i just manually tested and removed the .gitignore file from the justafish addon and renamed the example gitignore file to .gitignore.

from the example.gitignore /vendor/ has to be changed to /vendorotherwise the vendor folder is shown on git status

sites/sites.php and /.gitignorehas to be added as well.

rpkoller commented 1 week ago

the following added to the composerscripts.php would work and fix the problem. but not sure if it is the cleanest and most elegant approach in php:

    copy('./repos/drupal/example.gitignore', './repos/drupal/.gitignore');
    $content = file_get_contents('./repos/drupal/.gitignore');
    $content = str_replace('/vendor/', '/vendor', $content);
    $content .= "\nsites/sites.php";
    $content .= "\n/.gitignore";
    file_put_contents('./repos/drupal/.gitignore', $content);