Calling Developers!
We are reenergizing our code contribution process! Learn More

How to develop packages ?

Options
filip.gojkovic955
filip.gojkovic955 Spryker Solution Partner Posts: 19 ✨ - Novice
edited May 8 in Spryker Development

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

  • Oleksandr Peresypkin
    Oleksandr Peresypkin Lead Demo Engineering Sprykee Posts: 24 ✨ - Novice
    Answer ✓
    Options

    You can try the following approach:

    {
    …
        "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 PHPStorm Settings > Version Control > Directory Mappings
    • It would be possible now to edit and commit changes from the repository of the package in the vendordirectory

    In order not to modify the project's composer.json and composer.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 variable COMPOSER=<path/to/composer.json>. For example, say you copied composer.json and composer.lock one directory level up, then you run COMPOSER=../composer.json composer config repositories.your-package-repo-identifier vcs https://github.com/your-organization/your-package.git and COMPOSER=../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.

Answers

  • Oleksandr Peresypkin
    Oleksandr Peresypkin Lead Demo Engineering Sprykee Posts: 24 ✨ - Novice
    Answer ✓
    Options

    You can try the following approach:

    {
    …
        "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 PHPStorm Settings > Version Control > Directory Mappings
    • It would be possible now to edit and commit changes from the repository of the package in the vendordirectory

    In order not to modify the project's composer.json and composer.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 variable COMPOSER=<path/to/composer.json>. For example, say you copied composer.json and composer.lock one directory level up, then you run COMPOSER=../composer.json composer config repositories.your-package-repo-identifier vcs https://github.com/your-organization/your-package.git and COMPOSER=../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.