Skip to content

Commit ae5b79b

Browse files
authored
Add build task to npm and yarn recipes (#4195)
1 parent 45cd417 commit ae5b79b

4 files changed

Lines changed: 38 additions & 6 deletions

File tree

contrib/npm.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
99
```php
1010
after('deploy:update_code', 'npm:install');
11+
after('npm:install', 'npm:build');
1112
```
1213
1314
*/
@@ -25,5 +26,10 @@
2526
// install of your dependencies.
2627
desc('Installs npm packages');
2728
task('npm:install', function () {
28-
run("cd {{release_path}} && {{bin/npm}} ci");
29+
run('cd {{release_path}} && {{bin/npm}} ci');
30+
});
31+
32+
desc('Runs npm build');
33+
task('npm:build', function () {
34+
run('cd {{release_path}} && {{bin/npm}} run build');
2935
});

contrib/yarn.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
99
```php
1010
after('deploy:update_code', 'yarn:install');
11+
after('yarn:install', 'yarn:build');
1112
```
1213
*/
1314

@@ -25,5 +26,10 @@
2526
run('cp -R {{previous_release}}/node_modules {{release_path}}');
2627
}
2728
}
28-
run("cd {{release_path}} && {{bin/yarn}}");
29+
run('cd {{release_path}} && {{bin/yarn}}');
30+
});
31+
32+
desc('Runs Yarn build');
33+
task('yarn:build', function () {
34+
run('cd {{release_path}} && {{bin/yarn}} build');
2935
});

docs/contrib/npm.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ require 'contrib/npm.php';
1717
## Usage
1818
```php
1919
after('deploy:update_code', 'npm:install');
20+
after('npm:install', 'npm:build');
2021
```
2122

2223

2324
## Configuration
2425
### bin/npm
25-
[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L17)
26+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L18)
2627

2728
## Configuration
2829
- `bin/npm` *(optional)*: set npm binary, automatically detected otherwise.
2930
## Usage
3031
```php
3132
after('deploy:update_code', 'npm:install');
33+
after('npm:install', 'npm:build');
3234
```
3335

3436
```php title="Default value"
@@ -40,7 +42,7 @@ return which('npm');
4042
## Tasks
4143

4244
### npm\:install {#npm-install}
43-
[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L27)
45+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L28)
4446

4547
Installs npm packages.
4648

@@ -51,3 +53,11 @@ any situation where you want to make sure you're doing a clean
5153
install of your dependencies.
5254

5355

56+
### npm\:build {#npm-build}
57+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L33)
58+
59+
Runs npm build.
60+
61+
62+
63+

docs/contrib/yarn.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@ require 'contrib/yarn.php';
1717
## Usage
1818
```php
1919
after('deploy:update_code', 'yarn:install');
20+
after('yarn:install', 'yarn:build');
2021
```
2122

2223

2324
## Configuration
2425
### bin/yarn
25-
[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L16)
26+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L17)
2627

2728
## Configuration
2829
- **bin/yarn** *(optional)*: set Yarn binary, automatically detected otherwise.
2930
## Usage
3031
```php
3132
after('deploy:update_code', 'yarn:install');
33+
after('yarn:install', 'yarn:build');
3234
```
3335

3436
```php title="Default value"
@@ -40,10 +42,18 @@ return which('yarn');
4042
## Tasks
4143

4244
### yarn\:install {#yarn-install}
43-
[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L22)
45+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L23)
4446

4547
Installs Yarn packages.
4648

4749
In there is a {{previous_release}}, node_modules will be copied from it before installing deps with yarn.
4850

4951

52+
### yarn\:build {#yarn-build}
53+
[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L33)
54+
55+
Runs Yarn build.
56+
57+
58+
59+

0 commit comments

Comments
 (0)