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

Fix shell script installer #184

Merged
merged 4 commits into from
Mar 24, 2022
Merged

Fix shell script installer #184

merged 4 commits into from
Mar 24, 2022

Conversation

becw
Copy link
Member

@becw becw commented Mar 11, 2022

Starting in Composer 2.2, running vendor/bin/the-build-installer resulted in the following error, even when running the installer from the correct location:

usage: dirname string [...]
Please run this command from your project root.

This seems to be because Composer 2.2.0 included changes to the way scripts in the vendor/bin/ directory are proxied/run, which broke the installer wrapper script. I'm not sure if there's a better way to fix this -- the updated script still assumes that scripts are located in the vendor/bin/ directory.

  • Script proxying was added in Composer 2.2.0 -- previously, scripts were symlinked into the vendor/bin/ directory
  • The environment variable COMPOSER_BIN_DIR was added in Composer 2.2.2
  • The environment variable was changed to COMPOSER_RUNTIME_BIN_DIR in Composer 2.2.7

Testing instructions

composer create-project palantirnet/drupal-skeleton example dev-develop --no-interaction
cd example

# Pause here and update .ddev/config.yaml to change the "name" from "drupal-skeleton" to "example"

composer require palantirnet/the-build:dev-fix-installer-dirname-error
vendor/bin/the-build-installer

# Follow the prompts to set up the site and install Drupal.

--> The project example should be set up, and ddev should be running with the installed site.

@becw becw force-pushed the fix-installer-dirname-error branch from 3aa767e to 27bbbdf Compare March 11, 2022 00:36
@becw
Copy link
Member Author

becw commented Mar 12, 2022

The way I had to write this script makes me feel like I'm doing something wrong. But, the script can't reliably find phing without being able to reliably find either the vendor/bin/ directory or itself, and between Composer 2.2.0 and previous versions, the script location changed because Composer started wrapping/proxying scripts, and then an env variable was added in 2.2.2, and then the env variable was changed in 2.2.7...... so I'm not sure what else I could have done here.

@eric-schmidt eric-schmidt self-requested a review March 17, 2022 16:08
Copy link

@eric-schmidt eric-schmidt left a comment

Choose a reason for hiding this comment

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

@becw This is all working for me! I did also test downgrading Composer to 2.1.0 just to see what would happen now that we're requiring ^2.2.2. It did cause the composer require palantirnet/the-build:dev-fix-installer-dirname-error command to fail out as expected, but I would be curious how it fails once this is merged in and is a part of the composer create-project palantirnet/drupal-skeleton command -- so we may want to test that once this is rolled out, just to see how it communicates the issue.

@becw becw merged commit 451337d into develop Mar 24, 2022
@becw becw deleted the fix-installer-dirname-error branch March 24, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants