How to develop packages ?
Hi, my team and me are developing vendor package for spryker. We are exepriencing issues with develompent environment setup.
We have package in repository on github. If i download package and i want do develop it, I can not test my implementations because i don't have whole spryker project (just that package).
If I develop my package on spryker project than i can not push changes to repository of my package.
How to solve this ? What is the standard when developing packages for projects like spryker?
Can I maybe just point to another origin branch on github?
Best Answer
-
You can try the following approach:
- Add the configuration to the project's
composer.json
file to install the package from sources according to :
{ … "config": { "preferred-install": { "your-organization/your-package": : "source", "*": "dist" } } … }
- Add the repository from where to pull the package
composer config repositories.your-package-repo-identifier vcs https://github.com/your-organization/your-package.git
- Install the package
composer require your-organization/your-package:dev-your-feature-branch
- [OPTIONAL] Configure the
vendor
path of the package in the IDE to treat the files as a repository. For example, in PHPStormSettings > Version Control > Directory Mappings
- It would be possible now to edit and commit changes from the repository of the package in the
vendor
directory
In order not to modify the project's
composer.json
andcomposer.lock
and keep them a "clean" release version, you could create their development version by copying them outside the project and running the above commands with the environment variableCOMPOSER=<path/to/composer.json>
. For example, say you copiedcomposer.json
andcomposer.lock
one directory level up, then you runCOMPOSER=../composer.json composer config repositories.your-package-repo-identifier vcs https://github.com/your-organization/your-package.git
andCOMPOSER=../composer.json composer require your-organization/your-package:dev-your-feature-branch
. In this case, the package is pulled inside the project's vendor but the development composer files are outside the project and there is no chance to commit them accidentally.2 - Add the configuration to the project's
Answers
-
You can try the following approach:
- Add the configuration to the project's
composer.json
file to install the package from sources according to :
{ … "config": { "preferred-install": { "your-organization/your-package": : "source", "*": "dist" } } … }
- Add the repository from where to pull the package
composer config repositories.your-package-repo-identifier vcs https://github.com/your-organization/your-package.git
- Install the package
composer require your-organization/your-package:dev-your-feature-branch
- [OPTIONAL] Configure the
vendor
path of the package in the IDE to treat the files as a repository. For example, in PHPStormSettings > Version Control > Directory Mappings
- It would be possible now to edit and commit changes from the repository of the package in the
vendor
directory
In order not to modify the project's
composer.json
andcomposer.lock
and keep them a "clean" release version, you could create their development version by copying them outside the project and running the above commands with the environment variableCOMPOSER=<path/to/composer.json>
. For example, say you copiedcomposer.json
andcomposer.lock
one directory level up, then you runCOMPOSER=../composer.json composer config repositories.your-package-repo-identifier vcs https://github.com/your-organization/your-package.git
andCOMPOSER=../composer.json composer require your-organization/your-package:dev-your-feature-branch
. In this case, the package is pulled inside the project's vendor but the development composer files are outside the project and there is no chance to commit them accidentally.2 - Add the configuration to the project's
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 69 Spryker News
- 896 Developer Corner
- 758 Spryker Development
- 83 Spryker Dev Environment
- 361 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 23 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 68 Spryker Safari Questions
- 50 Random