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

Add a composer.json file to make headroom.js installable as part of a drupal module #319

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

CuriousCactus
Copy link

I created a fork of this repo so I could add a composer.json file, so that it can be correctly installed using composer for use with this Drupal module.

The issue discussing this is here.

The user would then need to add the code below to their project's composer.json file.

(replace curiouscactus with wickynilliams if you accept this pull request, both in the code below and in the composer.json file I added)

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/CuriousCactus/headroomjs"
    }
],
"require": {
    "curiouscactus/headroomjs": "v0.9.5",
    "drupal/headroomjs": "^1.0@beta"
}

@WickyNilliams
Copy link
Owner

Hmm is this necessary? Why is there a need for explicit support for drupal? Excuse my ignorance, I'm totally unfamliar with Drupal and its ecosystem

@CuriousCactus
Copy link
Author

Sorry for the slow reply.
This is not strictly a Drupal-specific change. It allows headroom.js to be required using composer, (a common php package manager), so that php projects can declare a dependency on it.
Does that make sense?

@hacknug
Copy link
Collaborator

hacknug commented Aug 28, 2019

Why would you manage JS dependencies with Composer and not NPM?

@WickyNilliams
Copy link
Owner

That's what I'm wondering too. Why not npm/yarn?

@CuriousCactus
Copy link
Author

An issue on the Drupal project (https://www.drupal.org/project/headroomjs/issues/3019252) implied that this was the way to do it, but on reflection I wonder if the main aim was to make it install to a /libraries folder, rather than /node-modules. Their installation process is quite manual (https://www.drupal.org/project/headroomjs) and I was attempting to make it more standard, but maybe I went about it the wrong way...

@hacknug
Copy link
Collaborator

hacknug commented Aug 28, 2019

Not sure I understand how Drupal deals with this 100% but it seems like this would require dist/ to be published on the repo so we don't need the headroom.js you added at the root of the project.

Still not 100% sure this is the way to go. Some things online seem to show it's possible to install dependencies directly from NPM/GitHub via something like this:

@WickyNilliams
Copy link
Owner

I'd rather find a solution that doesn't involve adding new config files to the repo.

Is the goal here to simplify installing the drupal headroom project? If so, I would recommend changing the install steps to avoid getting and extracting a zip from github, and instead get all the (published) files from unpkg.com:

@WickyNilliams
Copy link
Owner

@CuriousCactus hey, do you have anything to add?

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

Successfully merging this pull request may close these issues.

None yet

3 participants