sweetchuck / composer-repo-path
@todo project description
Installs: 906
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Type:composer-plugin
Requires
- php: >=7.4
- composer-plugin-api: ^2.0
- ext-json: *
Requires (Dev)
- codeception/codeception: ^4.0
- codeception/module-asserts: ^1.1
- codeception/module-cli: ^1.1
- codeception/module-filesystem: ^1.0
- composer/composer: ^2.0
- mikey179/vfsstream: ^1.6
- nuvoleweb/robo-config: ^2.0
- squizlabs/php_codesniffer: ^3.5
- stecman/symfony-console-completion: ^0.11
- sweetchuck/git-hooks: 2.x-dev
- sweetchuck/robo-git: 2.x-dev
- sweetchuck/robo-phpcs: 2.x-dev
- sweetchuck/robo-phpmd: 2.x-dev
- symfony/error-handler: ^5.0 || ^6.0
- symfony/filesystem: ^5.2 || ^6.0
This package is auto-updated.
Last update: 2024-10-26 18:28:11 UTC
README
Composer plugin to download packages which are referenced in
composer.json#/repositories
with type "path".
Problem is that when there is a composer.json like the one below, then the
../../foo/bar
directory has to be exists before the composer update
or
composer install
commands are invoked. This plugin tries to download them in
an early phase by subscribing to the "pre command" events.
{ "repositories": { "foo/bar": { "type": "path", "url": "../../foo/bar-1.x" } }, "require": { "foo/bar": "*" } }
Usage - global (recommended)
composer global require sweetchuck/composer-repo-path
cd somewhere/my/project-01
Edit yourcomposer.json
according to the following example:{ "name": "my/project-01", "minimum-stability": "dev", "prefer-stable": true, "config": { "preferred-install": "dist" }, "repositories": { "foo/bar": { "type": "path", "url": "../../foo/bar-1.x", "options": { "repo-path": { "url": "http://example.com/foo/bar.git", "branch": "1.x" } } } }, "require": { "foo/bar": "*" } }
composer update
ls -la '../../foo/bar-1.x'
Should be a regular directory.
ls -la 'vendor/foo'
"bar" should be a symlink.
Usage - project
Without a globally pre-installed sweetchuck/composer-repo-path
plugin things
are a little more complicated.
When composer update
command runs first time in a clean project, then the
sweetchuck/composer-repo-path
plugin is not available, and if the
../../foo/bar-1.x
directory is not exists, then the Composer will throw an
error.
The composer-suite plugin helps to solve this problem.
cd somewhere/my/project-01
- composer.json
{ "name": "my/project-01", "minimum-stability": "dev", "prefer-stable": true, "config": { "preferred-install": "dist" }, "repositories": {}, "require": { "foo/bar": "^1.0" }, "require-dev": { "sweetchuck/composer-repo-path": "1.x-dev", "sweetchuck/composer-suite": "1.x-dev" }, "extra": { "composer-suite": { "local": { "description": "Modifications for local development", "actions": [ { "type": "prepend", "config": { "parents": ["repositories"], "items": { "foo/bar": { "type": "path", "url": "", "options": { "repo-path": { "url": "https://example.com/foo/bar.git", "remote": "upstream", "branch": "1.x" } } } } } }, { "type": "replaceRecursive", "config": { "parents": ["require"], "items": { "foo/bar": "*" } } } ] } } } }
composer update
composer suite:generate
- optional:
COMPOSER='composer.local.json' composer repo-path:download
COMPOSER='composer.local.json' composer update
@TODO
Command - composer repo-path:list
List all the packages that are installed by symlinks.
Example: `composer repo-path:list
Example output: space separated package names.
foo/bar baz/doo tab/fal
--format='json|yaml|csv' option would be handy.
Together with Sweetchuck/composer-suite
{ "scripts": { "suite:install:local": [ "rm composer.local.json composer.local.lock", "composer suite:generate", "cp composer.lock composer.local.lock", "COMPOSER='composer.local.lock' composer update $(composer repo-path:list)" ], "suite:reset": [ "rm $(COMPOSER='composer.local.lock' composer repo-path:list --format=json | jq 'find install dirs of the symlinked packages')", "composer install" ] } }