mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-22 00:03:48 +01:00
29 lines
680 B
PHP
29 lines
680 B
PHP
<?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 which('yarn');
|
|
});
|
|
|
|
// In there is a {{previous_release}}, node_modules will be copied from it before installing deps with yarn.
|
|
desc('Installs 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}}");
|
|
});
|