deployer/contrib/npm.php

29 lines
668 B
PHP
Raw Normal View History

2020-04-25 23:00:08 +03:00
<?php
2020-10-02 00:11:13 +02:00
/*
## Configuration
- `bin/npm` *(optional)*: set npm binary, automatically detected otherwise.
2020-04-25 23:00:08 +03:00
2020-10-02 00:11:13 +02:00
## Usage
```php
2020-10-02 00:11:13 +02:00
after('deploy:update_code', 'npm:install');
```
2020-10-02 00:11:13 +02:00
*/
2020-04-25 23:00:08 +03:00
namespace Deployer;
set('bin/npm', function () {
2021-11-05 15:23:34 +01:00
return which('npm');
2020-04-25 23:00:08 +03:00
});
2022-01-13 14:35:12 +01:00
// Uses `npm ci` command. This command is similar to npm install,
// except it's meant to be used in automated environments such as
// test platforms, continuous integration, and deployment -- or
// any situation where you want to make sure you're doing a clean
// install of your dependencies.
2021-11-08 22:59:39 +01:00
desc('Installs npm packages');
2020-04-25 23:00:08 +03:00
task('npm:install', function () {
2022-01-13 14:35:12 +01:00
run("cd {{release_path}} && {{bin/npm}} ci");
2020-04-25 23:00:08 +03:00
});