Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added parameter to ignore NPM #32

Merged
merged 9 commits into from
Nov 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

29 changes: 21 additions & 8 deletions provision/vvv-init.sh
Original file line number Diff line number Diff line change
@@ -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' '')

@@ -130,7 +131,7 @@ function try_npm_install() {
echo " * Clearing npm cache"
npm_config_loglevel=error npm cache clean --force
echo " * Running npm install again"
npm_config_loglevel=error 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"
@@ -185,8 +186,12 @@ else
handle_git_wp
fi

try_npm_install
try_npm_build
if [[ "${NPM}" == "true" ]]; then
try_npm_install
try_grunt_build
else
echo ' * NPM package installation ignored'
fi
Mte90 marked this conversation as resolved.
Show resolved Hide resolved

if [[ ! -f "${VVV_PATH_TO_SITE}/public_html/wp-config.php" ]]; then
configure_wp
@@ -196,14 +201,22 @@ maybe_install_wp
check_for_wp_importer

echo " * Checking for WordPress build"
if [[ ! -d "${VVV_PATH_TO_SITE}/public_html/build" ]]; then
echo " * Running NPM build... This may take a few moments."
cd "${VVV_PATH_TO_SITE}/public_html/"
try_npm_build
echo " * NPM Build completed."
if [[ "${NPM}" == "true" ]]; then
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 --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"