Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd asset-packagist repository #286
Conversation
rodrigoaguilera
force-pushed the
Ymbra:8.x
branch
from
8544eb1
to
f5e6fde
Jun 25, 2017
rodrigoaguilera
referenced this pull request
Jun 25, 2017
Open
Add documentation on how to install libraries using composer.json #215
This comment has been minimized.
This comment has been minimized.
fidelix
commented
Aug 23, 2017
This works very well for me. I can recommend. |
This comment has been minimized.
This comment has been minimized.
Acquia recently released a blog post explaining this method. I hope it becomes a standard workflow. I will rebase the PR ASAP. |
weitzman
referenced this pull request
Oct 26, 2017
Closed
Make "component" packages install to libraries #324
This comment has been minimized.
This comment has been minimized.
FatherShawn
commented
Oct 26, 2017
I'm also using this method in my projects |
This comment has been minimized.
This comment has been minimized.
hawkeyetwolf
commented
Oct 27, 2017
Adding |
This comment has been minimized.
This comment has been minimized.
hawkeyetwolf
commented
Oct 27, 2017
•
This approach doesn't work for contrib modules right now because they can't safely require asset-packagist dependencies. Per the composer docs:
And this causes two problems:
What do you think? Is there any way around this? |
This comment has been minimized.
This comment has been minimized.
sun
commented
Apr 6, 2018
@derekderaps As repositories are custom by design in Composer, this seems to be the only viable solution – at least for now. For the time being, this PR resolves https://www.drupal.org/project/drupal/issues/2873160 @rodrigoaguilera Any chance you could rebase it to resolve the conflicts? |
This comment has been minimized.
This comment has been minimized.
In addition to Lightning, Drupal Commerce now ships with this approach - https://www.drupal.org/project/commerce/issues/2916058. +1 from me |
This comment has been minimized.
This comment has been minimized.
heddn
commented
Apr 6, 2018
I was originally a little reluctant to add this to composer. Reason for opposition: my theme needs certain css and fonts. Using bower (npm these days) it is fairly easy to require them. And then when anyone consumes my theme, they have everything packaged for them. In the theme. Just run Repositories are set on the base composer.json, so the repository in the theme wouldn't be available. And I'd still need a package.json for gulp, etc. So, at the end of the day, while perhaps useful in some small ways, I'm a little hesitant to think it will solve all dependency management issues on a site. For the commerce example, that was done on project base. Which means that if someone requires drupal/colorbox, they still need to know to also |
rodrigoaguilera
force-pushed the
Ymbra:8.x
branch
from
f5e6fde
to
775035e
Apr 6, 2018
This comment has been minimized.
This comment has been minimized.
Rebased :)
The extra step is still needed. Maybe in the future contrib projects can start assuming the asset repository is added to your root composer.json just like https://packages.drupal.org/8 or since the software that manages the https://asset-packagist.org endpoint is BSD licensed it can be integrated into packages.drupal.org. |
This comment has been minimized.
This comment has been minimized.
I do not understand why travis fails. Can someone help with that? |
This comment has been minimized.
This comment has been minimized.
@rodrigoaguilera I created a core issue to fix the failing tests. https://www.drupal.org/project/drupal/issues/2960214 |
mxr576
suggested changes
Apr 25, 2018
"web/libraries/{$name}": ["type:drupal-library"], | ||
"web/libraries/{$name}": [ | ||
"type:drupal-library", | ||
"vendor:npm-asset", |
This comment has been minimized.
This comment has been minimized.
mxr576
Apr 25, 2018
•
Contributor
I would rather use
"type:bower-asset", "type:npm-asset"
instead. (Just as Lightning and Commerce2 do.)
|
||
For example, to use colorbox: | ||
``` | ||
composer require npm-asset/colorbox:"^0.4" |
This comment has been minimized.
This comment has been minimized.
mxr576
Apr 25, 2018
•
Contributor
I'd also mention chosen module and its JS dependency as an example, because if you install the library from npm-asset repo then you have to add a library specific override to the installer-paths, otherwise library gets installed with an incorrect name chosen-js
.
Required line: "docroot/libraries/chosen": ["npm-asset/chosen-js"],
See:
mxr576
referenced this pull request
Apr 25, 2018
Open
Add support for installing libraries via asset-packagist #278
This comment has been minimized.
This comment has been minimized.
I made changes based on @mxr576 suggestions. Please review them. |
sun
referenced this pull request
May 2, 2018
Merged
Improved and shortened wording of new asset-packagist docs. #1
sun
reviewed
May 2, 2018
chosen module expects the library at `/libraries/chosen`, but `composer require | ||
npm-asset/chosen-js` installs the library into `/libraries/chosen-js`; the | ||
following override installs it into the expected folder: | ||
````json |
This comment has been minimized.
This comment has been minimized.
sun
May 2, 2018
Dang, one backtick too much! Sorry for that.
@rodrigoaguilera Can you quickly fix this in your branch of this PR?
This comment has been minimized.
This comment has been minimized.
sun
May 2, 2018
•
Background info: This causes the closing backticks to no longer match; i.e., all following text is formatted as code.
This comment has been minimized.
This comment has been minimized.
sun
approved these changes
May 3, 2018
This comment has been minimized.
This comment has been minimized.
Is it normal to run out of memory for php 5.6? |
rodrigoaguilera
force-pushed the
Ymbra:8.x
branch
from
a07e6a5
to
f09e011
May 10, 2018
This comment has been minimized.
This comment has been minimized.
So probably the plugins that we add increase the memory use for php 5.6. Any ideas on how we can solve it? From what I can gather right now is either we reduce the memory usage upstream or increase the allowed memory size for tests. |
This comment has been minimized.
This comment has been minimized.
sun
commented
May 11, 2018
2 of 3 builds on PHP 5.6 passed though. Could also have been a hiccup of the build platform. I do not see a button to re-test; any way to do run it again? |
This comment has been minimized.
This comment has been minimized.
I think the history of the PR hides it because of rebases it but it already failed twice and other PRs are not failing. My only guess is that the composer plugin is raising the memory usage. Another idea is to make npm-asset and bower-asset "official" types so the plugin is not needed. |
This comment has been minimized.
This comment has been minimized.
sun
commented
May 11, 2018
A completely different question would be whether drupal-composer/drupal-project still needs to support PHP 5.6 in the first place. In my opinion, attempting to support it is a complete waste of time and resources. Today, anyone building a new Drupal site with Composer based on this project template will definitely use PHP 7+. |
This comment has been minimized.
This comment has been minimized.
I am almost sure the plugins drupal-project depends on do not support php 5.6. One of the first steps would be to remove the travis tests for php 5 |
rodrigoaguilera
added some commits
Jun 25, 2017
rodrigoaguilera
and others
added some commits
May 1, 2018
rodrigoaguilera
force-pushed the
Ymbra:8.x
branch
from
f09e011
to
e465af5
Sep 14, 2018
This comment has been minimized.
This comment has been minimized.
Good to know the memory thing was just a temporary thing. Can we move this forward? I think it would be great for modules integrating a third party library to assume the repo is in the root composer.json and just declare a dependency. An example of this situation: |
This comment has been minimized.
This comment has been minimized.
shrop
commented
Sep 18, 2018
I have been working with another developer on this setup in drupal-project and it is really great. Based off the https://lightning.acquia.com/blog/round-your-front-end-javascript-libraries-composer blog post. Would love to see this land here! |
This comment has been minimized.
This comment has been minimized.
kay-o
commented
Nov 21, 2018
looks like this can be merged; anyone aware of remaining tasks? happy to help move this a step closer to being 'standard practice' if so. |
rodrigoaguilera commentedJun 25, 2017
Be able to download download third party assets with commands like
composer require bower-asset/dropzone=~4.2
closes #278