forked from deployphp/deployer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyarn.php
36 lines (28 loc) · 764 Bytes
/
yarn.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/*
## Installing
Add to your _deploy.php_
```php
require 'contrib/yarn.php';
```
## Configuration
- **bin/yarn** *(optional)*: set Yarn binary, automatically detected otherwise.
## Usage
```php
after('deploy:update_code', 'yarn:install');
```
*/
namespace Deployer;
set('bin/yarn', function () {
return run('which yarn');
});
// In there is a {{previous_release}}, node_modules will be copied from it before installing deps with yarn.
desc('Install Yarn packages');
task('yarn:install', function () {
if (has('previous_release')) {
if (test('[ -d {{previous_release}}/node_modules ]')) {
run('cp -R {{previous_release}}/node_modules {{release_path}}');
}
}
run("cd {{release_path}} && {{bin/yarn}}");
});