File tree Expand file tree Collapse file tree 7 files changed +54
-11
lines changed
Filter options
Expand file tree Collapse file tree 7 files changed +54
-11
lines changed
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Server setup
22
22
Deployment configurations
23
23
* [ How to deploy a Lumen application?] ( how-to-lumen.md )
24
24
* [ 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 )
25
26
* [ How to send Slack notifications?] ( how-to-slack.md )
26
27
* [ How to reload php-fpm?] ( how-to-reload-fpm.md )
27
28
* [ How to terminate horizon?] ( how-to-horizon.md )
Original file line number Diff line number Diff line change 40
40
| ` bin/composer ` | | Composer binary.
41
41
| ` bin/symlink ` | | Symlink binary.
42
42
| ` bin/npm ` | | Npm binary.
43
+ | ` bin/yarn ` | | Yarn binary.
43
44
| ` laravel_version ` | | Version of Laravel used.
44
45
| ` php_fpm_service ` | | Name of the php-fpm service. |
45
46
| ` php_fpm_command ` | ` echo "" \| sudo -S /usr/sbin/service {{php_fpm_service}} reload ` | Command used to reload the php-fpm service. |
Original file line number Diff line number Diff line change @@ -57,4 +57,7 @@ php artisan deploy:list namespace # List all tasks starting with `namespace:`
57
57
| ` local:upload ` | Upload your locally-built application to your hosts |
58
58
| ` npm:development ` | Execute npm run development |
59
59
| ` 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 |
Original file line number Diff line number Diff line change
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 ` . |
Original file line number Diff line number Diff line change @@ -141,22 +141,27 @@ public function defineDeployementPath()
141
141
public function defineAdditionalHooks ()
142
142
{
143
143
$ 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
146
150
);
147
-
151
+
148
152
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
+
152
157
}
153
-
158
+
154
159
if ($ this ->confirm ('Do you want to migrate during deployment? ' , true )) {
155
160
$ this ->builder ->add ('hooks.ready ' , 'artisan:migrate ' );
156
161
}
157
-
162
+
158
163
if ($ this ->confirm ('Do you want to terminate horizon after each deployment? ' )) {
159
164
$ this ->builder ->add ('hooks.ready ' , 'artisan:horizon:terminate ' );
160
165
}
161
166
}
162
- }
167
+ }
Original file line number Diff line number Diff line change
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 ' );
Original file line number Diff line number Diff line change 32
32
'fixtures/recipes/mocks.php ' ,
33
33
],
34
34
35
- ];
35
+ ];
You can’t perform that action at this time.
0 commit comments