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

Install a package without saving it into composer.json ? #7061

Closed
crtlf opened this issue Jan 30, 2018 · 4 comments
Closed

Install a package without saving it into composer.json ? #7061

crtlf opened this issue Jan 30, 2018 · 4 comments
Labels

Comments

@crtlf
Copy link

crtlf commented Jan 30, 2018

I'm trying to create a composer.json that generates a ready-to-use Drupal 8 (based on the excellent Drupal Project). It works well, but I want to include a custom theme that'll be use as a base for any developer. This theme is call in the composer.json "my-package/my-theme": "*", and is automatically include in the Drupal's theme folder. Perfect!

The problem is : when you make a change to this theme, if you run a composer install or composer update, all your changes get deleted. I understand that's a normal behavior of Composer.

So, is it possible to install a package without saving it into composer.json / composer.lock ?

  • I tried to do a composer remove my-package/my-theme --no-update, but it removed my package only in composer.json and not composer.lock, which give the same result.
  • Am I supposed to install my package, and then delete it manually from composer.json and composer.lock ?
  • Am I missing a secret option ?
@Jean85
Copy link
Contributor

Jean85 commented Jan 31, 2018

Any code in your folder vendor is not committed in your CVS in any way. That's why you shouldn't edit any file in the vendor folder, it will be lost.

Have you tried any other existing solution, like https://github.com/drupal-composer/drupal-project ?

@crtlf
Copy link
Author

crtlf commented Feb 1, 2018

Yes, I'm aware of that, and I'm actually using Drupal project.
I was just looking for a solution to download a package without making any reference of it in composer.json and composer.lock files. But it does not seems possible.

For anyone wanting to achieve the same thing as me, I finally make a custom script launched after install that :

  • Make a copy of the theme folder
  • Change any mention of the previous theme system name to the new one (filenames + directly into files)
  • Remove theme with composer remove command
  • And finally enable the new theme

It works for me as the downloaded theme is just a base to start development and not an actual theme that will be updated.

@curry684
Copy link
Contributor

curry684 commented Feb 1, 2018

I was just looking for a solution to download a package without making any reference of it in composer.json and composer.lock files. But it does not seems possible.

This is intentionally impossible as well, not a missing feature or anything. The vendor folder is Composer's alone to meddle with.

Fyi - Node's npm is not only able to install packages without saving them, it's even default. And this is one of the main reasons many people are now using yarn instead because it cannot not save, as it is highly frustrating to discover while deploying to production that you forgot to add --save to that one vital dependency. One of Composer's main design goals is absolute dev/prod parity for dependencies.

@crtlf
Copy link
Author

crtlf commented Feb 1, 2018

Seems logic now I see it. Thank's for your time helping me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants