我在composer.json中的存储库中添加了mypackage:
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packages.drupal.org/8"
},
"mypackage": {
"type": "package",
"package": {
"name": "company_name/mypackage",
"type": "drupal-module",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/company_name/mypackage",
"reference": "master"
}
}
}
},
我运行composer require company_name/mypackage-master --prefer-dist
该软件包确实已下载,但仍然添加了.git目录。我希望无需.git目录即可下载包。我将如何完成?我只有一个主分支,在github中没有释放。
在此处发表了作曲家问题中的问题。为了解决这个问题,我做了以下操作:
-
将
composer.json
文件添加到我的软件包:{"name": "company_name/mymodule", "type": "drupal-custom-module", "description": "My description", "keywords": ["Drupal"], "license": "GPL-2.0+", "homepage": "https://github.com/company_name/mymodule", "support": { "issues": "https://github.com/company_name/mymodule/issues", "source": "https://github.com/company_name/mymodule" }, "require": { }}
-
在
composer.json
文件中更新存储库(不是模块composer.json
文件("repositories": { "drupal-packagist": { "type": "composer", "url": "https://packages.drupal.org/8" }, "my-package": { "type": "vcs", "url": "https://github.com/company_name/mypackage" }},
-
运行
composer require company_name/mymodule --prefer-dist
。