From ea46063739dd97dd7ca48f3c399fa70b17d752db Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Tue, 8 Mar 2022 18:40:11 +0100 Subject: [PATCH 1/8] feat(npm): added parameter --- README.md | 1 + provision/vvv-init.sh | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f29f3d..be8a693 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Running this command will convert an svn based checkout to git and will require | `site_title` | The first host of the site | The title of the site after install | | `vcs` | `svn` | The type of WP checkout to make when first creating the site, valid values are `svn` and `git` | | `wp_type` | `single` | Defines what kind of site gets installed, `subdomain` `subdirectory` or `single` are valid values | +| `npm` | `true` | Execute NPM during the provision | ### The Minimum Required Configuration diff --git a/provision/vvv-init.sh b/provision/vvv-init.sh index aa0c841..2846d23 100644 --- a/provision/vvv-init.sh +++ b/provision/vvv-init.sh @@ -6,6 +6,7 @@ DOMAIN=$(get_primary_host "${VVV_SITE_NAME}".test) SITE_TITLE=$(get_config_value 'site_title' "${DOMAIN}") WP_TYPE=$(get_config_value 'wp_type' "single") DB_NAME=$(get_config_value 'db_name' "${VVV_SITE_NAME}") +NPM=$(get_config_value 'npm' "true") DB_NAME=${DB_NAME//[\\\/\.\<\>\:\"\'\|\?\!\*-]/} VCS=$(get_config_value 'vcs' '') @@ -177,8 +178,10 @@ else handle_git_wp fi -try_npm_install -try_grunt_build +if [[ "${NPM}" == "true" ]]; then + try_npm_install + try_grunt_build +fi if [[ ! -f "${VVV_PATH_TO_SITE}/public_html/wp-config.php" ]]; then configure_wp From 1d10b846776ae6f1edd1989207a654d077bc7595 Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Tue, 8 Mar 2022 18:47:27 +0100 Subject: [PATCH 2/8] feat(npm): added parameter --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index be8a693..ac87c04 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Running this command will convert an svn based checkout to git and will require | `site_title` | The first host of the site | The title of the site after install | | `vcs` | `svn` | The type of WP checkout to make when first creating the site, valid values are `svn` and `git` | | `wp_type` | `single` | Defines what kind of site gets installed, `subdomain` `subdirectory` or `single` are valid values | -| `npm` | `true` | Execute NPM during the provision | +| `npm` | `true` | Execute NPM during the provision | ### The Minimum Required Configuration From a9462ef7f7599411d7166dc2c2760d735be76d05 Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Tue, 8 Mar 2022 18:57:59 +0100 Subject: [PATCH 3/8] feat(npm): added parameter --- provision/vvv-init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provision/vvv-init.sh b/provision/vvv-init.sh index 2846d23..e932abd 100644 --- a/provision/vvv-init.sh +++ b/provision/vvv-init.sh @@ -127,7 +127,7 @@ function try_npm_install() { echo " * Clearing npm cache" npm_config_loglevel=error noroot npm cache clean --force echo " * Running npm install again" - npm_config_loglevel=error noroot npm install --no-optional + npm_config_loglevel=error noroot npm install --no-optional --force echo " * Completed npm install command, check output for issues" fi echo " * Finished running npm install" @@ -177,7 +177,7 @@ if [[ "${VCS}" == "svn" ]]; then else handle_git_wp fi - +echo "${NPM}" if [[ "${NPM}" == "true" ]]; then try_npm_install try_grunt_build From 9e69cb1d5892304f8a08e39d9b6acc529646dfbe Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Tue, 8 Mar 2022 19:05:01 +0100 Subject: [PATCH 4/8] feat(npm): added parameter --- provision/vvv-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/vvv-init.sh b/provision/vvv-init.sh index e932abd..eb72fa0 100644 --- a/provision/vvv-init.sh +++ b/provision/vvv-init.sh @@ -177,7 +177,7 @@ if [[ "${VCS}" == "svn" ]]; then else handle_git_wp fi -echo "${NPM}" + if [[ "${NPM}" == "true" ]]; then try_npm_install try_grunt_build From aa5517b909da3f91fef69eaf59b63785cc4fe02a Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Wed, 9 Mar 2022 15:01:08 +0100 Subject: [PATCH 5/8] added else with verbose info --- provision/vvv-init.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/provision/vvv-init.sh b/provision/vvv-init.sh index eb72fa0..24b601f 100644 --- a/provision/vvv-init.sh +++ b/provision/vvv-init.sh @@ -181,6 +181,8 @@ fi if [[ "${NPM}" == "true" ]]; then try_npm_install try_grunt_build +else + echo ' * NPM package installation ignored' fi if [[ ! -f "${VVV_PATH_TO_SITE}/public_html/wp-config.php" ]]; then From 54f585caa16facf4a37c1ac60b633ec9d3bc03a6 Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Wed, 9 Mar 2022 18:11:41 +0100 Subject: [PATCH 6/8] fix(composer): execute it --- provision/vvv-init.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/provision/vvv-init.sh b/provision/vvv-init.sh index 24b601f..b1d99f6 100644 --- a/provision/vvv-init.sh +++ b/provision/vvv-init.sh @@ -192,15 +192,23 @@ fi maybe_install_wp check_for_wp_importer -echo " * Checking for WordPress build" -if [[ ! -d "${VVV_PATH_TO_SITE}/public_html/build" ]]; then - echo " * Initializing grunt... This may take a few moments." - cd "${VVV_PATH_TO_SITE}/public_html/" - try_grunt_build - echo " * Grunt initialized." +if [[ "${NPM}" == "true" ]]; then + echo " * Checking for WordPress build" + if [[ ! -d "${VVV_PATH_TO_SITE}/public_html/build" ]]; then + echo " * Initializing grunt... This may take a few moments." + cd "${VVV_PATH_TO_SITE}/public_html/" + try_grunt_build + echo " * Grunt initialized." + fi fi echo " * Checking mu-plugins folder" noroot mkdir -p "${VVV_PATH_TO_SITE}/public_html/src/wp-content/mu-plugins" "${VVV_PATH_TO_SITE}/public_html/build/wp-content/mu-plugins" +echo " * Copy wp-tests-config.php for phpunit" +cp "/srv/config/wordpress-config/wp-tests-config.php" "${VVV_PATH_TO_SITE}/public_html/wp-tests-config.php" + +echo " * Install Composer packages" +noroot composer update > /dev/null + echo " * Custom site template develop provisioner completed, WP will be served from the build folder, don't forget to rebuild after changes to src" From acdc090386e382b2ee87f327616bb756021c7f8c Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Wed, 9 Mar 2022 18:20:26 +0100 Subject: [PATCH 7/8] fix(composer): execute it --- provision/vvv-init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provision/vvv-init.sh b/provision/vvv-init.sh index b1d99f6..28da8f8 100644 --- a/provision/vvv-init.sh +++ b/provision/vvv-init.sh @@ -209,6 +209,6 @@ echo " * Copy wp-tests-config.php for phpunit" cp "/srv/config/wordpress-config/wp-tests-config.php" "${VVV_PATH_TO_SITE}/public_html/wp-tests-config.php" echo " * Install Composer packages" -noroot composer update > /dev/null +noroot composer update --no-ansi --no-progress > /dev/null echo " * Custom site template develop provisioner completed, WP will be served from the build folder, don't forget to rebuild after changes to src" From ea2a6cb3f62d45d8e1eea2e19f013e0b6e08ee61 Mon Sep 17 00:00:00 2001 From: Daniele Scasciafratte Date: Wed, 16 Nov 2022 14:56:31 +0100 Subject: [PATCH 8/8] missing fi --- provision/vvv-init.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/provision/vvv-init.sh b/provision/vvv-init.sh index ff94543..2be56ab 100644 --- a/provision/vvv-init.sh +++ b/provision/vvv-init.sh @@ -200,14 +200,15 @@ fi maybe_install_wp check_for_wp_importer +echo " * Checking for WordPress build" if [[ "${NPM}" == "true" ]]; then - echo " * Checking for WordPress build" if [[ ! -d "${VVV_PATH_TO_SITE}/public_html/build" ]]; then echo " * Initializing grunt... This may take a few moments." cd "${VVV_PATH_TO_SITE}/public_html/" try_grunt_build echo " * Grunt initialized." fi +fi echo " * Checking mu-plugins folder" noroot mkdir -p "${VVV_PATH_TO_SITE}/public_html/src/wp-content/mu-plugins" "${VVV_PATH_TO_SITE}/public_html/build/wp-content/mu-plugins"