Comments (5)
@greg-1-anderson, @webflo, maybe we should go with a separate drupal-scaffold.lock
file that can be committed to the repo and the user is in control of. That way we do not need to rely on installed.json, composer.lock or a "magic check" for the scaffold files. We also could put content in that for further features like, "never update files automatically unless triggered manually".
from drupal-scaffold.
I think we are learning why composer by default will not update scaffold files. 😄 I am not ready to give up on this feature, though; I think we have things well under control for composer update
, and just need to figure out what to do on composer install
and composer create-project
.
An option such as "never update unless triggered manually" would be better off placed in the "extras" section of composer.json, as this would likely be a project-wide setting. I could perhaps see the logic in allowing a per-environment override of this setting, but (a) I'm not sure I see the use case (I'm not sure that a manual override option is the best way to make scaffold updates do the right thing in CI), and (b) a ".lock" file is usually something that the user saves, but does not manually edit. I don't think we should break with convention on this point.
Perhaps the real solution here is to side-step the issue, and download the scaffold files only on composer create-project
and composer update
, and leave composer install
out of the mix entirely. This would take care of CI nicely, and would also prompt people to commit their scaffold files as they should. If anyone is starting a new project and needs the scaffold files (and somehow did not get them with composer create-project), they can always get them with composer update
, or by running the scaffold operation directly.
from drupal-scaffold.
My suggestion above is not great for folks who are used to the git clone
, composer install
workflow. Ideally, this would get the scaffold files if they are needed, without the user needing to know anything about special rules for the project.
So, it would be good if the scaffold files automatically download on composer install
, but ideally not on the CI server, in a way that is easy for the user to explicitly control. The use case here is not entirely analogous to the function of composer.lock
. I am going to suggest that we use the extra
section for this.
We could introduce two new options, "update-action" and "install-action", which control the behavior on composer update
and composer install
, respectively.
"extra": {
"drupal-scaffold": {
"update-action": true,
"install-action": {
"if-not-env": "CI"
}
}
If the value is true
or false
, then the scaffold files are always / never downloaded. If the value is an array, then we have a number of selections available:
if-env
: Download the scaffold files if the specified environment variable is defined.
if-not-env
: Download the scaffold files if the specified environment variable is not defined.
file-exists
: Download the scaffold files if a file exists at the specified path.
file-missing
: Download the scaffold files if there is no file at the specified path.
We could have more or fewer options here, as desired (I don't know if anything other than file-missing
is really needed). We could fill in a reasonable default in drupal-composer/drupal-project
, such as "file-missing": "web/sites/default/default.settings.php"
. This would pretty much do the right thing in most scenarios without needing the user to touch it, and would be reasonably self-documenting (and would be complimented with real documentation, of course).
I'd be happy to make a PR if this sounds like a reasonable solution.
from drupal-scaffold.
I'm not set on #19. We need the right balance of configuration options vs. simplicity. Maybe just one option identifying the scaffold file to test, defaulting to index.php
?
from drupal-scaffold.
I closed #19, because that PR was essentially writing code in config .yml files, which is not ideal. Code should be in code, and config should be simple.
So, I propose the following two rules:
drupal-scaffold
runs in only two circumstances: aftercomposer-update
, and on-demand.- Folks who want
drupal-scaffold
to run aftercomposer-install
can do it in their own post-install hook.
Number 2 will essentially be for templates such as drupal-composer; we can also include instructions in our README.
In drupal-composer, we can have script
entries for drupal-scaffold
and the post-install hook (existing). Then, in the post-install script (existing), we can put in a code block:
if [ ! -f web/index.php ] ; then
composer drupal-scaffold
fi
This will do the right thing for folks who just grab the project via composer create-project
or git clone; composer install
: the scaffold files will be set up on the initial run, and, if they follow instructions and commit the scaffold files to their repository (which will be the path of least resistance, since the scaffold files are not .gitignore'd), then the scaffold files will not be fetched on the CI server. I think this is the simplest / least opaque solution.
from drupal-scaffold.
Related Issues (20)
- Drupal composer create-project Failed to download /plain/ directory HOT 6
- PrestissimoFileFetcher errors with newest Curl Version 7.64.0 HOT 5
- Downloading scaffold files fails
- Error when running `composer update` HOT 3
- Comparison to Composer Scaffold HOT 7
- post-drupal-scaffold-cmd not working anymore? HOT 1
- Can't exclude files HOT 2
- PHP Parse error when trying to run composer self-update
- Re-scaffolding index.php causes SoftException 500 Error
- Compatibility with Composer 2 HOT 3
- Plugin::scaffold call is deprecated but README says it should be added to post-install commands HOT 5
- Copy development.services.yml
- Add ability to specify a location for includes
- Error in post install script HOT 27
- Cannot run 'composer drupal-scaffold' in 2.5.0 HOT 3
- Fatal error: Interface 'Composer\Plugin\Capability\CommandProvider' not found HOT 5
- Add README.txt files to the scaffold
- .eslintrc.json - how to make it work with the extends?
- html
- generation of autoload.php file should respect umask value
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from drupal-scaffold.