Skip to content

Commit 4c2f1f2

Browse files
committed
Revert "OXDEV-8635: Adjust Readme file for new module"
This reverts commit 97e5025.
1 parent 97e5025 commit 4c2f1f2

1 file changed

Lines changed: 137 additions & 42 deletions

File tree

README.md

Lines changed: 137 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# OXID eShop Examples Module
22

3-
[![Development](https://github.com/OXID-eSales/examples-module/actions/workflows/trigger.yaml/badge.svg?branch=b-7.3.x)](https://github.com/OXID-eSales/examples-module/actions/workflows/trigger.yaml)
4-
[![Latest Version](https://img.shields.io/packagist/v/OXID-eSales/examples-module?logo=composer&label=latest&include_prereleases&color=orange)](https://packagist.org/packages/oxid-esales/examples-module)
5-
[![PHP Version](https://img.shields.io/packagist/php-v/oxid-esales/examples-module)](https://github.com/oxid-esales/examples-module)
3+
[![Development](https://github.com/OXID-eSales/module-template/actions/workflows/trigger.yaml/badge.svg?branch=b-7.1.x)](https://github.com/OXID-eSales/module-template/actions/workflows/trigger.yaml)
4+
[![Latest Version](https://img.shields.io/packagist/v/OXID-eSales/module-template?logo=composer&label=latest&include_prereleases&color=orange)](https://packagist.org/packages/oxid-esales/module-template)
5+
[![PHP Version](https://img.shields.io/packagist/php-v/oxid-esales/module-template)](https://github.com/oxid-esales/module-template)
66

7-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=OXID-eSales_examples-module&metric=alert_status)](https://sonarcloud.io/dashboard?id=OXID-eSales_examples-module)
8-
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=OXID-eSales_examples-module&metric=coverage)](https://sonarcloud.io/dashboard?id=OXID-eSales_examples-module)
9-
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=OXID-eSales_examples-module&metric=sqale_index)](https://sonarcloud.io/dashboard?id=OXID-eSales_examples-module)
7+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=OXID-eSales_module-template&metric=alert_status)](https://sonarcloud.io/dashboard?id=OXID-eSales_module-template)
8+
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=OXID-eSales_module-template&metric=coverage)](https://sonarcloud.io/dashboard?id=OXID-eSales_module-template)
9+
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=OXID-eSales_module-template&metric=sqale_index)](https://sonarcloud.io/dashboard?id=OXID-eSales_module-template)
1010

1111

12-
The examples module contains examples for the most common use cases (see below)
12+
Reusable module template for extending OXID eShop core functionality.
13+
14+
The module template contains examples for the most common use cases (see below)
1315
like OXID suggests it could be implemented.
1416

1517
This module also comes with all the quality tools OXID recommends to use.
@@ -20,20 +22,24 @@ This module also comes with all the quality tools OXID recommends to use.
2022
3. [Goals](#goals)
2123
4. [Examples](#examples)
2224
5. [Install and try it out](#install-and-try-it-out)
23-
6. [Development installation](#development-installation)
24-
7. [Development installation on OXID eShop SDK](#development-installation-on-oxid-eshop-sdk)
25-
8. [Things to be aware of](#things-to-be-aware-of)
26-
9. [Running tests and quality tools](#running-tests-and-quality-tools)
27-
10. [Additional info](#additional-info)
25+
6. [Use as a base for own module](#use-as-a-base-for-own-module)
26+
7. [Things to be aware of](#things-to-be-aware-of)
27+
8. [Running tests and quality tools](#running-tests-and-quality-tools)
28+
9. [Additional info](#additional-info)
2829

2930
## Branch compatibility
3031

3132
* b-7.3.x branch - compatible with OXID eShop compilation 7.3.x and the respective branch
33+
* b-7.2.x branch / v4.x version - compatible with OXID eShop compilation 7.2.x and the respective branch
34+
* b-7.1.x branch / v3.x version - compatible with OXID eShop compilation 7.1.x and the respective branch
35+
* b-7.0.x branch / v2.x version - compatible with OXID eShop compilation b-7.0.x
36+
* b-6.5.x branch / v1.0.0 version - compatible with OXID eShop compilation b-6.5.x
37+
* b-6.4.x branch is compatible with OXID eShop compilation b-6.4.x
3238

3339
## The Idea
3440

3541
OXID eSales would like to provide a lightweight reusable example module incorporating
36-
our best practices recommendations to be used for developing own module solutions.
42+
our best practices recommendations to be used as a template for developing own module solutions.
3743

3844
Story:
3945
- Module will extend a block on shop start page to show a greeting message (visible when module is active).
@@ -50,7 +56,15 @@ Story:
5056

5157
## Goals
5258

53-
Install and try out the module with simple examples to most common development questions.
59+
There are three main goals this repository is intended to help with:
60+
61+
* Install and try out the module with simple examples to most common development questions.
62+
* The provided solution can be used as a base for your own module. It will help creating
63+
the personalized module base with all the examples listed in the Examples section.
64+
* The repository can be used for creating a clean skeleton with only preconfigured
65+
OXID recommended quality tools for your new module.
66+
67+
Please jump to the section that fits your needs.
5468

5569
## Examples
5670

@@ -126,38 +140,116 @@ composer require oxid-esales/module-template
126140

127141
and [activate the module](https://docs.oxid-esales.com/developer/en/latest/development/modules_components_themes/module/installation_setup/setup.html#setup-activation).
128142

129-
## Development installation
143+
## Use as a base for own module
130144

131-
To be able running the tests and other preconfigured quality tools, please install the module as a [root package](https://getcomposer.org/doc/04-schema.md#root-package).
145+
In case you'd like to use this module as a template for your own module, this section is for you.
132146

133-
The next section shows how to install the module as a root package by using the OXID eShop SDK.
147+
**Important** Instructions here are for the case you intend to develop a module for OXID eShop 7.2.x. For other
148+
versions, refer to the version specific branch.
134149

135-
In case of different environment usage, please adjust by your own needs.
150+
Before starting to do something, please, read the whole section once, then decide on required questions, decide
151+
what you want to achieve, and follow the procedure.
136152

137-
## Development installation on OXID eShop SDK
153+
### Terms
138154

139-
The installation instructions below are shown for the current [SDK](https://github.com/OXID-eSales/docker-eshop-sdk)
140-
for shop 7.3. Make sure your system meets the requirements of the SDK.
155+
First, lets decide on terms:
141156

142-
0. Ensure all docker containers are down to avoid port conflicts
157+
* Module is installable to `vendor/<yourPackageName>` directory. The package name is **lowercased** and
158+
looks like: `<yourVendorName>/<yourModuleName>`, example: `oxid-esales/module-template`. Decide
159+
what will be your new module package name.
160+
* Please note that combination of `<yourVendorName>` and `<yourModuleRootDirectory>` should be unique. Based on this
161+
information your module id will be composed and will look like: `<yourVendorPrefix>_<yourModuleRootDirectory>`. In
162+
our case it is `oe_moduletemplate`.
163+
* It is recommended to use only alphanumeric characters, in case you need a separator you can use dash ("-") or underscore("_").
164+
* Decide on your module's namespace - `<YourVendorName>\<YourModuleName>`, example: `OxidEsales\ModuleTemplate`.
165+
* Decide on your module's ID - `<YourVendorPrefix>_<yourModuleName alphanumeric part>`, example: `oe_moduletemplate`.
166+
* It is recommended to use only alphanumeric characters, in case you need a separator you can use underscore. More
167+
information about module id can be found [here](https://docs.oxid-esales.com/developer/en/latest/development/modules_components_themes/module/skeleton/metadataphp/amodule/id.html).
143168

144-
1. Clone the SDK for the new project
145-
```shell
146-
echo MyProject && git clone https://github.com/OXID-eSales/docker-eshop-sdk.git $_ && cd $_
147-
```
169+
In the following examples, your information required places will be shown as placeholders: `<yourPackageName>`, it means
170+
you should put your package name at that place, without brackets, for example:
148171

149-
2. Clone the repository to the source directory
150-
```shell
151-
git clone --recurse-submodules https://github.com/OXID-eSales/graphql-base-module.git --branch=b-7.3.x ./source
152172
```
173+
composer config repositories.<yourPackageName> path source/modules/<yourVendorName>/<yourModuleName>
174+
```
175+
will possibly look like:
176+
```
177+
composer config repositories.my-vendor-name/my-module-name path source/modules/mvn/mymodulerootdir
178+
```
179+
in our case it is:
180+
```
181+
composer config repositories.oxid-esales/module-template path source/modules/oe/module-template
182+
```
183+
184+
### Procedure
185+
186+
The following procedure describes how to create a base for your further module, and shows the basic installation for the development process:
187+
188+
#### 1. Use the Template
189+
190+
Click on the "Use this template" button on the template [main page](https://github.com/OXID-eSales/module-template) to
191+
create your module repository from the given template.
192+
193+
Please make sure to NOT choose the 'take all branches' option, as this will clone the repository with everything
194+
we have in our repository. Having all branches also will trigger the github actions for all branches and you dont want this usually.
195+
196+
As an outcome of this step, you should have a repository with one "Initial commit" of our current latest repository state.
197+
198+
#### 2. Personalize and cleanup the module
199+
200+
To personalize the module, use the "bin/personalize.sh" script. This script will prompt you for required information and do the work.
201+
202+
To cleanup the module from all current examples and make it a clean skeleton, use the "bin/cleanexamples.sh" script. This script will remove all example solutions code.
203+
204+
Its not mandatory to cleanup the module from examples, but you have this option if you want to start from the clean skeleton.
205+
206+
For this step, clone your module repository anywhere to your local directory and run the desired scripts.
153207

154-
3. Run the recipe to setup the development environment, you can decide which shop edition to install. Omitting the flag installs EE.
155-
```shell
156-
./source/recipes/setup-development.sh -s CE
208+
```bash
209+
git clone <yourGitRepositoryUrl> myModule
210+
cd myModule
211+
212+
// Run the personalize script
213+
./bin/personalize.sh
214+
215+
// Run the clean examples script if you want to start from the clean skeleton
216+
./bin/cleanexamples.sh
217+
218+
git commit -am "Personalize and cleanup the module"
219+
git push origin
157220
```
158221
159-
You should be able to access the shop with http://localhost.local and the admin panel with http://localhost.local/admin
160-
(credentials: noreply@oxid-esales.com / admin)
222+
Please note that the module comes with a database table, translations, settings and some templates which still have the original
223+
names after personalization, if cleanup was not done. Just keep an eye on all that's prefixed 'OEEM', 'oeem', 'OEEXAMPLESMODULE' etc.
224+
225+
Also, you will need to adjust the README, CHANGELOG, LICENSE, metadata and the GitHub workflow file, with your
226+
credentials and names. For running SonarCloud as part of the steps in GitHub workflow you
227+
will need to configure SonarCloud and to create a secret environment variable for your repository called SONAR_TOKEN.
228+
The token itself is provided by SonarCloud.
229+
230+
#### 3. Install the module for Development
231+
232+
For installing the module for development our recommended way, check the "Development installation section",
233+
or do it any other way you prefer, but make sure to reconfigure our preconfigured quality tools to fit your installation.
234+
235+
### Development installation
236+
237+
We recommend developing the module as independent as possible. This means that the module for development should
238+
be installed as a root package, with its own strict dependencies if such are needed.
239+
240+
Consider using our docker based SDK and our ["Recipes"](https://github.com/OXID-eSales/docker-eshop-sdk-recipes) to
241+
install this module development variant. Make sure you have all your current docker containers stopped before starting on this.
242+
243+
```bash
244+
cd ~/Projects
245+
echo ModuleTemplate && git clone https://github.com/OXID-eSales/docker-eshop-sdk.git $_ && cd $_
246+
git clone --recurse-submodules https://github.com/OXID-eSales/docker-eshop-sdk-recipes recipes/oxid-esales
247+
248+
// Important: In case you want to develop your module created from module template, edit the recipe with your
249+
// module repository and module id first
250+
251+
./recipes/oxid-esales/module-template/b-7.2.x-root.sh -eCE
252+
```
161253
162254
## Things to be aware of
163255
@@ -192,15 +284,10 @@ As already mentioned above, in the 7.x versions of OXID eShop, the module code o
192284
namespace needs to point there. In our case this looks like
193285
194286
```bash
195-
"autoload": {
287+
"autoload": {
196288
"psr-4": {
197-
"OxidEsales\\ExamplesModule\\": "src/"
198-
}
199-
},
200-
"autoload-dev": {
201-
"psr-4": {
202-
"OxidEsales\\ExamplesModule\\Tests\\": "tests/",
203-
"OxidEsales\\EshopCommunity\\Tests\\": "./vendor/oxid-esales/oxideshop-ce/tests"
289+
"OxidEsales\\ModuleTemplate\\": "src/",
290+
"OxidEsales\\ModuleTemplate\\Tests\\": "tests/"
204291
}
205292
},
206293
```
@@ -270,6 +357,13 @@ In our case, we cover the reaction of the startpage to the different possibiliti
270357
The great thing about codeception tests is - they can create screenshot and html
271358
output in failure case, so you literally get a picture of the fail (`tests/Coreception/_output/`).
272359
360+
### Development Environment - Docker SDK
361+
362+
You can install the shop on whatever system fits your needs, but please check the
363+
[OXID Docker SDK recipes](https://github.com/OXID-eSales/docker-eshop-sdk-recipes).
364+
That's what we use in OXID Development to quickly set up whatever development environment we need and
365+
we are constantly trying to improve them.
366+
273367
### Github Actions Workflow
274368
275369
The module template comes complete with a github actions workflow. No need to rig up some separate continuous integration
@@ -307,6 +401,7 @@ Ps: a failing shop test might also turn up issues in your module, in that case f
307401
* Bug tracker - https://bugs.oxid-esales.com
308402
* Developer Documentation - https://docs.oxid-esales.com/developer/en/latest/
309403
* Quality Tools and Requirements - https://docs.oxid-esales.com/developer/en/latest/development/modules_components_themes/quality.html
404+
* Docker SDK recipes - https://github.com/OXID-eSales/docker-eshop-sdk-recipes
310405
* Docker SDK - https://github.com/OXID-eSales/docker-eshop-sdk
311406
312407
### Contact us

0 commit comments

Comments
 (0)