Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 26f466e

Browse filesBrowse files
authored
Merge pull request lorisleiva#52 from andrey-helldar/add-yarn-recipe
Added use of the yarn package manager
2 parents a22c103 + e9f7f04 commit 26f466e
Copy full SHA for 26f466e

File tree

Expand file treeCollapse file tree

7 files changed

+54
-11
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+54
-11
lines changed

‎docs/README.md

Copy file name to clipboardExpand all lines: docs/README.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Server setup
2222
Deployment configurations
2323
* [How to deploy a Lumen application?](how-to-lumen.md)
2424
* [How to compile assets on deploy using npm?](how-to-npm.md)
25+
* [How to compile assets on deploy using yarn?](how-to-yarn.md)
2526
* [How to send Slack notifications?](how-to-slack.md)
2627
* [How to reload php-fpm?](how-to-reload-fpm.md)
2728
* [How to terminate horizon?](how-to-horizon.md)

‎docs/all-options.md

Copy file name to clipboardExpand all lines: docs/all-options.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
| `bin/composer` | | Composer binary.
4141
| `bin/symlink` | | Symlink binary.
4242
| `bin/npm` | | Npm binary.
43+
| `bin/yarn` | | Yarn binary.
4344
| `laravel_version` | | Version of Laravel used.
4445
| `php_fpm_service` | | Name of the php-fpm service. |
4546
| `php_fpm_command` | `echo "" \| sudo -S /usr/sbin/service {{php_fpm_service}} reload` | Command used to reload the php-fpm service. |

‎docs/all-tasks.md

Copy file name to clipboardExpand all lines: docs/all-tasks.md
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,7 @@ php artisan deploy:list namespace # List all tasks starting with `namespace:`
5757
| `local:upload` | Upload your locally-built application to your hosts |
5858
| `npm:development` | Execute npm run development |
5959
| `npm:install` | Install npm packages |
60-
| `npm:production` | Execute npm run production |
60+
| `npm:production` | Execute npm run production |
61+
| `yarn:development` | Execute yarn development |
62+
| `yarn:install` | Install yarn packages |
63+
| `yarn:production` | Execute yarn production |

‎docs/how-to-yarn.md

Copy file name to clipboard
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# How to compile assets on deploy using yarn?
2+
3+
The recipe `recipe/yarn.php` is already required within Laravel Deployer's recipe. Therefore, all you need to do is hook the `yarn` tasks in you deployment flow.
4+
5+
```php
6+
// config/deploy.php
7+
8+
'hooks' => [
9+
'build' => [
10+
'yarn:install',
11+
'yarn:production',
12+
],
13+
],
14+
```
15+
16+
# Available tasks
17+
18+
| task | description |
19+
| - | - |
20+
| `yarn:install` | Copy the `node_modules` folder from the previous release if it exists, and run `yarn install`. |
21+
| `yarn:development` | Compile your assets using `yarn develoment`. |
22+
| `yarn:production` | Compile your assets using `yarn production`. |

‎src/LaravelDeployer/Commands/DeployInit.php

Copy file name to clipboardExpand all lines: src/LaravelDeployer/Commands/DeployInit.php
+14-9Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,22 +141,27 @@ public function defineDeployementPath()
141141
public function defineAdditionalHooks()
142142
{
143143
$npm = $this->choice(
144-
'Do you want to compile your asset during deployment?',
145-
['No', 'Yes using `npm run production`', 'Yes using `npm run development`'], 1
144+
'Do you want to compile your asset during deployment with npm/yarn?',
145+
[
146+
'No',
147+
'Yes using `npm run production`',
148+
'Yes using `yarn production`',
149+
], 1
146150
);
147-
151+
148152
if ($npm !== 'No') {
149-
$build = $npm === 'Yes using `npm run production`' ? 'production' : 'development';
150-
$this->builder->add('hooks.build', 'npm:install');
151-
$this->builder->add('hooks.build', "npm:$build");
153+
$manager = $npm === 'Yes using `npm run production`' ? 'npm' : 'yarn';
154+
$this->builder->add('hooks.build', "$manager:install");
155+
$this->builder->add('hooks.build', "$manager:production");
156+
152157
}
153-
158+
154159
if ($this->confirm('Do you want to migrate during deployment?', true)) {
155160
$this->builder->add('hooks.ready', 'artisan:migrate');
156161
}
157-
162+
158163
if ($this->confirm('Do you want to terminate horizon after each deployment?')) {
159164
$this->builder->add('hooks.ready', 'artisan:horizon:terminate');
160165
}
161166
}
162-
}
167+
}

‎src/task/yarn.php

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Deployer;
4+
5+
require 'recipe/yarn.php';
6+
7+
desc('Execute yarn development');
8+
task('yarn:development', '{{bin/yarn}} development');
9+
10+
desc('Execute yarn production');
11+
task('yarn:production', '{{bin/yarn}} production');

‎tests/fixtures/configs/basic.php

Copy file name to clipboardExpand all lines: tests/fixtures/configs/basic.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232
'fixtures/recipes/mocks.php',
3333
],
3434

35-
];
35+
];

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.