Score:1

Uploading local files via composer

bo flag

I'm using composer to manage a Drupal 9 instance. I'm brand new to composer and have no idea what i'm doing. That being said, I've successfully set it up and have used it to install modules and an admin theme. I just purchased a theme and realized that I don't know how how to upload it with composer. For modules and the admin theme I installed, I used composer require drupal/name-of-module(or theme) but this theme doesn't have a shortname and isn't on drupal.org (but rather on my local machine after downloading it). How do I go about uploading this theme with composer? I've looked through the composer documentation but can't find anything about this scenario.

leymannx avatar
ne flag
I'd put it in web/themes/custom and then git add it. Summary: You have a git repo which contains composer.json, composer.lock, custom modules, custom themes and everything else that's not ignored by .gitignore (which foremost ignores `vendor` and `node_modules` folders). Then you commit the changes to the tracked files, pull them on your server or CI and there run `composer install` and `npm i` etc. Repo stays lightweight and dependencies only get pulled down where needed.
Score:2
bd flag

You might want to have a look at the documentation on drupal.org:

It's a lot to digest, but it goes into quite some detail on how to use composer and git to manage your site.

The gist of it is this:

You use composer to download code (modules, themes, libraries, ...) that is available somewhere on the internet (github, gitlab, npm, your companies private repositories, ...) and manage the dependencies between the different components that you download.

You use git to manage your project, that is to say your composer.json that defines how and where to get external components, but also your custom code, for example custom modules that you write but that you don't make publicly accessible somewhere, but also that theme that you have purchased. Git allows you to do version control for your project, so that you can safely make changes, go back to a known working state if you break something, and create tagged releases for fixed snapshots of your code.

Once you have all set and your site is running on your local machine as you expect it, the next question is how you get that onto a server, so that your site will become publicly available. This is what I would understand as "uploading" (and there are, as usual, multiple possible ways), but I think this is not what you meant.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.