-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
nav: | ||
title: Standalone Admin Watcher | ||
position: 3 | ||
|
||
--- | ||
|
||
# Standalone Admin Watcher | ||
|
||
|
||
::: info | ||
`shopware-cli extension admin-watch` can be different to the regular Admin Watcher. You can start the regular Admin Watcher with `shopware-cli project admin-watch` | ||
::: | ||
|
||
Shopware-CLI has an integrated Standalone Admin Watcher. This is useful if the regular Admin Watcher struggles with the amount of installed extensions and you only want to watch one single extension. The Standalone Watcher works by using the regular build Administration and injects only the changed files of the extension. | ||
Check warning on line 15 in products/cli/extension-commands/admin-watcher.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/admin-watcher.md#L15
Raw output
|
||
|
||
Check warning on line 16 in products/cli/extension-commands/admin-watcher.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/admin-watcher.md#L16
Raw output
|
||
Therefore the Watcher starts in few milliseconds and is very fast. Additionally, it can be targeted to an external Shopware 6 Instance to debug JavaScript or CSS changes with the external data. | ||
|
||
## Starting the Standalone Admin Watcher | ||
|
||
To start the Standalone Admin Watcher, you can use the following command: | ||
|
||
```bash | ||
shopware-cli extension admin-watch <path-to-extension> <url-to-shopware> | ||
``` | ||
|
||
The first parameter is the path to the extension you want to watch and the last parameter is the URL to the Shopware 6 instance. The URL must be reachable from the machine where the CLI is executed. You can watch also multiple extensions by providing multiple paths, but the last parameter must be the URL to the Shopware 6 instance. | ||
Check warning on line 27 in products/cli/extension-commands/admin-watcher.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/admin-watcher.md#L27
Raw output
|
||
|
||
You can pass also the path of an Shopware project to the command. In this case, the CLI will automatically detect the extensions. | ||
Check warning on line 29 in products/cli/extension-commands/admin-watcher.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/admin-watcher.md#L29
Raw output
|
||
|
||
The listing port of the Admin Watcher can be changed with `--listen :<port>`. | ||
|
||
## Usage behind a proxy | ||
|
||
If you want to use the Standalone Admin Watcher behind a proxy to have example SSL, you should set `--external-url` to the URL where the Admin Watcher will be reachable in the Browser. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
--- | ||
nav: | ||
title: Building extensions and creating archives | ||
position: 2 | ||
|
||
--- | ||
|
||
# Building extensions and creating archives | ||
|
||
Extensions consists of PHP Changes, JavaScript and CSS. To release an extension to the Shopware Store or upload it to an Shopware 6 instance without having to rebuild Storefront and Administration your extension needs to provide the compiled assets. | ||
Check warning on line 10 in products/cli/extension-commands/build.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/build.md#L10
Raw output
|
||
|
||
## Building an extension | ||
|
||
Shopware-CLI allows you to easily build the assets of an extension. To build an extension, you can use the following command: | ||
|
||
```bash | ||
shopware-cli extension build <path> | ||
``` | ||
|
||
Shopware-CLI reads the `shopware/core` requirement in `composer.json` or `manifest.xml` and uses the lowest possible Shopware Version to build the assets. This allows that the extension can be used in multiple Shopware versions. If this version is not correct, you can override it in a `.shopware-extension.yml` | ||
|
||
```yaml | ||
# .shopware-extension.yml | ||
build: | ||
shopwareVersionConstraint: '6.6.9.0' | ||
``` | ||
This has only affect on the build process and not on the installation of the extension, for full control you can specify also the environment variable `SHOPWARE_PROJECT_ROOT` pointing to a Shopware 6 project and it will use that Shopware to build the extension assets. | ||
Check warning on line 28 in products/cli/extension-commands/build.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/build.md#L28
Raw output
|
||
|
||
## Additional bundles | ||
|
||
If your plugin consists of multiple bundles, usually when you have implemented `getAdditionalBundles` in your `Plugin` class, you have to provide the path to the bundle you want to build in the config: | ||
|
||
```yaml | ||
# .shopware-extension.yml | ||
build: | ||
extraBundles: | ||
# Assumes the bundle name is the same as the directory name | ||
- path: src/Foo | ||
# Explictly specify the bundle name | ||
- path: src/Foo | ||
name: Foo | ||
``` | ||
|
||
## Using ESBuild for JavaScript Bundling | ||
|
||
::: warning | ||
Building with ESBuild works completely standalone without the Shopware Codebase. This means if you import files from Shopware, you have to copy it to your extension. | ||
::: | ||
|
||
It's possible to use ESBuild for JavaScript bundling. This is way faster than the usual Shopware bundling as Shopware itself is not nessessary to build the assets. | ||
|
||
```yaml | ||
# .shopware-extension.yml | ||
build: | ||
zip: | ||
assets: | ||
# Use ESBuild for Administration | ||
enable_es_build_for_admin: true | ||
# Use ESBuild for Storefront | ||
enable_es_build_for_storefront: true | ||
``` | ||
|
||
## Creating an archive | ||
|
||
To create an archive of an extension, you can use the following command: | ||
|
||
```bash | ||
shopware-cli extension zip <path> | ||
``` | ||
|
||
The command copies the extension to a temporary directory, builds the assets, deletes unnecessary files and creates a zip archive of the extension. The archive is placed in the current working directory. | ||
|
||
**By default the command picks the latest released git tag**, use `--disable-git` as flag to disable this behavior and use the current source code. Besides disabling it completely, you can also specify a specific tag or commit using `--git-commit`. | ||
|
||
### Bundling composer dependencies | ||
|
||
Prior to Shopware 6.5, it's required to bundle the composer dependencies into the zip file. So Shopware-CLI runs automatically `composer install` for you and strips duplicate composer dependencies to avoid conflicts. | ||
|
||
To disable this behavior, you can adjust the configuration: | ||
|
||
```yaml | ||
# .shopware-extension.yml | ||
build: | ||
zip: | ||
composer: | ||
enabled: false | ||
``` | ||
|
||
This is automatically disabled for plugins targeting Shopware 6.5 and above and `executeComposerCommands` should be used instead. | ||
|
||
### Delete files before zipping | ||
|
||
Shopware-CLI deletes a lot of known files before zipping the extension. If you want to delete more files, you can adjust the configuration: | ||
|
||
```yaml | ||
# .shopware-extension.yml | ||
build: | ||
zip: | ||
pack: | ||
excludes: | ||
paths: | ||
- <path> | ||
``` | ||
|
||
### JavaScript Build optimization | ||
|
||
If you bring additional NPM packages, make sure that you added only runtime dependencies to `dependencies` inside `package.json` and tooling to `devDependencies` and enabled `npm_strict` in the configuration: | ||
|
||
```yaml | ||
# .shopware-extension.yml | ||
build: | ||
zip: | ||
assets: | ||
npm_strict: true | ||
``` | ||
|
||
This skips unnecessary `npm install` and `npm ci` commands and only installs the runtime dependencies. | ||
|
||
### Release mode | ||
|
||
If you are building an archive for distrubution, you can enable the release mode with the flag `--release`. This will remove the App secret from the `manifest.xml` and generate changelog files if enabled. | ||
|
||
The changelog generation can be enabled with the configuration: | ||
|
||
```yaml | ||
# .shopware-extension.yml | ||
changelog: | ||
enabled: true | ||
``` | ||
|
||
and uses the commits between the last tag and the current commit to generate the changelog. It can be further configured to filter commits and build the changelog differently. | ||
|
||
```yaml | ||
changelog: | ||
enabled: true | ||
# only the commits matching to this regex will be used | ||
pattern: '^NEXT-\d+' | ||
# variables allows to extract metadata out of the commit message | ||
Check warning on line 139 in products/cli/extension-commands/build.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/build.md#L139
Raw output
|
||
variables: | ||
ticket: '^(NEXT-\d+)\s' | ||
# go template for the changelog, it loops over all commits | ||
template: | | ||
{{range .Commits}}- [{{ .Message }}](https://issues.shopware.com/issues/{{ .Variables.ticket }}) | ||
Check warning on line 144 in products/cli/extension-commands/build.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/build.md#L144
Raw output
Check warning on line 144 in products/cli/extension-commands/build.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/build.md#L144
Raw output
Check warning on line 144 in products/cli/extension-commands/build.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/build.md#L144
Raw output
|
||
{{end}} | ||
``` | ||
|
||
This example checks that all commits in the changelog needs to start with `NEXT-` in the beginning. The `variables` section allows to extract metadata out of the commit message. The `template` is a go template which loops over all commits and generates the changelog. | ||
Check warning on line 148 in products/cli/extension-commands/build.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/build.md#L148
Raw output
|
||
With the combination of `pattern`, `variables` and `template` we link the commit message to the Shopware ticket system. | ||
|
||
### Overwrites | ||
|
||
It's possible to overwrite extension configuration while zipping like to change the version and app related things | ||
|
||
```yaml | ||
shopware-cli extension zip --overwrite-version=1.0.0 <path> | ||
``` | ||
|
||
replaces the version in `composer.json` or `manifest.xml` with the given version. | ||
|
||
```yaml | ||
shopware-cli extension zip --overwrite-app-backend-url=https://example.com <path> | ||
``` | ||
|
||
replaces all external URLs in `manifest.xml` to that given URL. | ||
|
||
```yaml | ||
shopware-cli extension zip --overwrite-app-backend-secret=MySecret <path> | ||
``` | ||
|
||
replaces the App secret in `manifest.xml` with the given secret. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
nav: | ||
title: Extracting Meta Data | ||
position: 4 | ||
|
||
--- | ||
|
||
# Extracting Meta Data | ||
|
||
There are helpers in Shopware-CLI to extract data of a extension. This is useful in your CI/CD pipeline to get the extension version or the changelog for the automated release. | ||
Check warning on line 10 in products/cli/extension-commands/extract-meta-data.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/extract-meta-data.md#L10
Raw output
|
||
|
||
## Extracting the version | ||
|
||
To extract the version of an extension, you can use the following command: | ||
|
||
```bash | ||
shopware-cli extension get-version <path> | ||
``` | ||
|
||
The path can be absolute or relative to the current working directory. The command will output the version of the extension. | ||
|
||
## Extracting the changelog | ||
|
||
To extract the changelog of an extension, you can use the following command: | ||
|
||
```bash | ||
shopware-cli extension get-changelog <path> | ||
``` | ||
|
||
The path can be absolute or relative to the current working directory. The command will output the changelog of the extension. | ||
|
||
It will output always the english changelog. | ||
Check warning on line 32 in products/cli/extension-commands/extract-meta-data.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/extract-meta-data.md#L32
Raw output
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
nav: | ||
title: Extension Validation | ||
position: 1 | ||
|
||
--- | ||
|
||
# Extension Validation | ||
|
||
Shopware-CLI has an builtin validation for extensions. This is useful in your CI/CD pipeline to validate the extension before you release it. | ||
Check warning on line 10 in products/cli/extension-commands/validation.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/validation.md#L10
Raw output
|
||
|
||
## Validating an extension | ||
|
||
To validate an extension, you can use the following command: | ||
|
||
```bash | ||
shopware-cli extension validate <path> | ||
``` | ||
|
||
The path can be absolute or relative to the directory containg the extension or the zip file. The command exists with a non-zero exit code if the validation fails with a error level message. | ||
Check warning on line 20 in products/cli/extension-commands/validation.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/validation.md#L20
Raw output
|
||
|
||
## What is validated? | ||
|
||
- The composer.json has an `shopware/core` requirement and constraint is parseable | ||
- The extension metadata is filled: | ||
- `name` | ||
- `label` (german and english) | ||
- `description` (german and english) and longer than 150 characters and shorter than 185 characters | ||
- Translations have equality translated in the given languages | ||
- PHP can be correctly linted with the minimum PHP version | ||
- The theme.json can be parsed and included assets can be found | ||
Check warning on line 31 in products/cli/extension-commands/validation.md GitHub Actions / LanguageTool[LanguageTool] products/cli/extension-commands/validation.md#L31
Raw output
|
||
|
||
## Supported PHP versions for linting | ||
|
||
Following PHP versions are supported for linting: | ||
|
||
- 7.3 | ||
- 7.4 | ||
- 8.1 | ||
- 8.2 | ||
|
||
These versions don't need to be installed locally, they are downloaded on demand and executed using WebAssembly without any dependencies. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
nav: | ||
title: Shopware-CLI | ||
position: 40 | ||
|
||
--- | ||
|
||
# Shopware-CLI | ||
|
||
Shopware-CLI is an open-source external command-line interface for Shopware 6. It provides a set of commands to interact with your Shopware instance, build extensions, dump databases and more. The CLI **is a external tool** and needs to be set up separately from your Shopware instance. | ||
Check warning on line 10 in products/cli/index.md GitHub Actions / LanguageTool[LanguageTool] products/cli/index.md#L10
Raw output
|
||
|
||
The CLI consists of three main components: | ||
|
||
- Project commands: Commands to interact with your Shopware project | ||
- Extension commands: Commands to build Shopware extensions | ||
- Store commands: Commands to publish extensions to the Shopware Store or update | ||
|
||
If you want to use the CLI, you need to [install it first](installation.md) or take a look at the each area of the CLI. | ||
Check warning on line 18 in products/cli/index.md GitHub Actions / LanguageTool[LanguageTool] products/cli/index.md#L18
Raw output
|