Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DD#0000: feat: Added configurable themes to Magento2 #3047

Merged
merged 2 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 43 additions & 19 deletions docs/recipe/magento2.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,39 @@ in you deployer script.
```


### magento_themes
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L26)

You can also set the themes to run against. By default it'll deploy
all themes - `add('magento_themes', ['Magento/luma', 'Magento/backend']);`

```php title="Default value"
[

]
```


### static_content_jobs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L34)

Also set the number of conccurent jobs to run. The default is 1
Update using: `set('static_content_jobs', '1');`

```php title="Default value"
'1'
```


### content_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L22)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L36)





### shared_files
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L26)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L40)

Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recipe/deploy/shared.php`.

Expand All @@ -46,7 +70,7 @@ Overrides [shared_files](/docs/recipe/deploy/shared.md#shared_files) from `recip


### shared_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L31)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L45)

Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/deploy/shared.php`.

Expand All @@ -71,7 +95,7 @@ Overrides [shared_dirs](/docs/recipe/deploy/shared.md#shared_dirs) from `recipe/


### writable_dirs
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L45)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L59)

Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `recipe/deploy/writable.php`.

Expand All @@ -88,7 +112,7 @@ Overrides [writable_dirs](/docs/recipe/deploy/writable.md#writable_dirs) from `r


### clear_paths
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L51)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L65)

Overrides [clear_paths](/docs/recipe/deploy/clear_paths.md#clear_paths) from `recipe/deploy/clear_paths.php`.

Expand All @@ -107,21 +131,21 @@ Overrides [clear_paths](/docs/recipe/deploy/clear_paths.md#clear_paths) from `re


### magento_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L60)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L74)





### maintenance_mode_status_active
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L67)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L81)





### enable_zerodowntime
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L74)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L88)

Deploy without setting maintenance mode if possible

Expand All @@ -134,71 +158,71 @@ true
## Tasks

### magento:compile
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L78)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L92)

Compiles magento di.

Tasks


### magento:deploy:assets
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L85)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L99)

Deploys assets.




### magento:sync:content_version
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L90)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L112)

Syncs content version.




### magento:maintenance:enable
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L100)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L122)

Enables maintenance mode.




### magento:maintenance:disable
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L105)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L127)

Disables maintenance mode.




### magento:config:import
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L110)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L132)

Config Import.




### magento:upgrade:db
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L145)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L167)

Upgrades magento database.




### magento:cache:flush
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L172)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L194)

Flushes Magento Cache.




### deploy:magento
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L177)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L199)

Magento2 deployment operations.

Expand All @@ -213,7 +237,7 @@ This task is group task which contains next tasks:


### magento:build
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L185)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L207)

Magento2 build operations.

Expand All @@ -226,7 +250,7 @@ This task is group task which contains next tasks:


### deploy
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L191)
[Source](https://github.com/deployphp/deployer/blob/master/recipe/magento2.php#L213)

Deploys your project.

Expand Down
24 changes: 23 additions & 1 deletion recipe/magento2.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@
// in you deployer script.
set('static_content_locales', 'en_US');

// Configuration

// You can also set the themes to run against. By default it'll deploy
// all themes - `add('magento_themes', ['Magento/luma', 'Magento/backend']);`
set('magento_themes', [

]);

// Configuration

// Also set the number of conccurent jobs to run. The default is 1
// Update using: `set('static_content_jobs', '1');`
set('static_content_jobs', '1');

set('content_version', function () {
return time();
});
Expand Down Expand Up @@ -83,7 +97,15 @@

desc('Deploys assets');
task('magento:deploy:assets', function () {
run("{{bin/php}} {{release_or_current_path}}/bin/magento setup:static-content:deploy --content-version={{content_version}} {{static_content_locales}}");

$themesToCompile = '';
if (count(get('magento_themes')) > 0) {
foreach (get('magento_themes') as $theme) {
$themesToCompile .= ' -t ' . $theme;
}
}

run("{{bin/php}} {{release_or_current_path}}/bin/magento setup:static-content:deploy --content-version={{content_version}} {{static_content_locales}} $themesToCompile -j {{static_content_jobs}}");
});

desc('Syncs content version');
Expand Down