From 7b8d8d59194885963a9e77e6bcf1aef1ec0ac597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Alfaiate?= Date: Tue, 21 Apr 2026 11:59:33 +0700 Subject: [PATCH] Add build task to npm and yarn recipes --- contrib/npm.php | 8 +++++++- contrib/yarn.php | 8 +++++++- docs/contrib/npm.md | 14 ++++++++++++-- docs/contrib/yarn.md | 14 ++++++++++++-- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/contrib/npm.php b/contrib/npm.php index 8122887c0..3d8299335 100644 --- a/contrib/npm.php +++ b/contrib/npm.php @@ -8,6 +8,7 @@ ```php after('deploy:update_code', 'npm:install'); +after('npm:install', 'npm:build'); ``` */ @@ -25,5 +26,10 @@ // install of your dependencies. desc('Installs npm packages'); task('npm:install', function () { - run("cd {{release_path}} && {{bin/npm}} ci"); + run('cd {{release_path}} && {{bin/npm}} ci'); +}); + +desc('Runs npm build'); +task('npm:build', function () { + run('cd {{release_path}} && {{bin/npm}} run build'); }); diff --git a/contrib/yarn.php b/contrib/yarn.php index aef1952df..e20b81025 100644 --- a/contrib/yarn.php +++ b/contrib/yarn.php @@ -8,6 +8,7 @@ ```php after('deploy:update_code', 'yarn:install'); +after('yarn:install', 'yarn:build'); ``` */ @@ -25,5 +26,10 @@ run('cp -R {{previous_release}}/node_modules {{release_path}}'); } } - run("cd {{release_path}} && {{bin/yarn}}"); + run('cd {{release_path}} && {{bin/yarn}}'); +}); + +desc('Runs Yarn build'); +task('yarn:build', function () { + run('cd {{release_path}} && {{bin/yarn}} build'); }); diff --git a/docs/contrib/npm.md b/docs/contrib/npm.md index 96d8593ce..a28be9a5e 100644 --- a/docs/contrib/npm.md +++ b/docs/contrib/npm.md @@ -17,18 +17,20 @@ require 'contrib/npm.php'; ## Usage ```php after('deploy:update_code', 'npm:install'); +after('npm:install', 'npm:build'); ``` ## Configuration ### bin/npm -[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L17) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L18) ## Configuration - `bin/npm` *(optional)*: set npm binary, automatically detected otherwise. ## Usage ```php after('deploy:update_code', 'npm:install'); +after('npm:install', 'npm:build'); ``` ```php title="Default value" @@ -40,7 +42,7 @@ return which('npm'); ## Tasks ### npm\:install {#npm-install} -[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L27) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L28) Installs npm packages. @@ -51,3 +53,11 @@ any situation where you want to make sure you're doing a clean install of your dependencies. +### npm\:build {#npm-build} +[Source](https://github.com/deployphp/deployer/blob/master/contrib/npm.php#L33) + +Runs npm build. + + + + diff --git a/docs/contrib/yarn.md b/docs/contrib/yarn.md index c2ffc4be3..4de4c66c5 100644 --- a/docs/contrib/yarn.md +++ b/docs/contrib/yarn.md @@ -17,18 +17,20 @@ require 'contrib/yarn.php'; ## Usage ```php after('deploy:update_code', 'yarn:install'); +after('yarn:install', 'yarn:build'); ``` ## Configuration ### bin/yarn -[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L16) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L17) ## Configuration - **bin/yarn** *(optional)*: set Yarn binary, automatically detected otherwise. ## Usage ```php after('deploy:update_code', 'yarn:install'); +after('yarn:install', 'yarn:build'); ``` ```php title="Default value" @@ -40,10 +42,18 @@ return which('yarn'); ## Tasks ### yarn\:install {#yarn-install} -[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L22) +[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L23) Installs Yarn packages. In there is a {{previous_release}}, node_modules will be copied from it before installing deps with yarn. +### yarn\:build {#yarn-build} +[Source](https://github.com/deployphp/deployer/blob/master/contrib/yarn.php#L33) + +Runs Yarn build. + + + +