-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from apolopena/development
Feature #20: optional installs of react, vue and bootstrap
- Loading branch information
Showing
4 changed files
with
178 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
#!/bin/bash | ||
|
||
# install-optional-scaffoliding.sh | ||
# Description: | ||
# Installs various packages according to the configuration set in starter.ini | ||
|
||
# BEGIN: Parse starter.ini | ||
install_react=$(. /tmp/utils.sh parse_ini_value starter.ini react install) | ||
install_vue=$(. /tmp/utils.sh parse_ini_value starter.ini vue install) | ||
install_bootstrap=$(. /tmp/utils.sh parse_ini_value starter.ini bootstrap install) | ||
# END: Parse starter.ini | ||
|
||
# BEGIN: Install Laravel ui if needed | ||
if [[ $install_react == 1 || $install_bootstrap == 1 ]]; then | ||
echo "Optional installations that require laravel/ui scaffolding were found." | ||
echo "Installing laravel/ui scaffolding..." | ||
composer require laravel/ui:^3.2.0 | ||
err_code=$? | ||
if [ $err_code == 0 ]; then | ||
echo "SUCCESS: laravel/ui scaffolding installed." | ||
echo "Compiling fresh scaffolding and running Laravel Mix." | ||
yarn install && yarn run dev | ||
#echo "current working dir is: $(pwd)" | ||
else | ||
>&2 echo "ERROR $err_code: There was a problem installing laravel/ui" | ||
fi | ||
fi | ||
# END: Install Laravel ui if needed | ||
|
||
# BEGIN: Optional react and react-dom install | ||
if [ "$install_react" == 1 ]; then | ||
version=$(. /tmp/utils.sh parse_ini_value starter.ini react version) | ||
auth=$(. /tmp/utils.sh parse_ini_value starter.ini react auth) | ||
|
||
[ -z "$version" ] && version_msg='' || version_msg=" version $version" | ||
[ "$auth" != 1 ] && auth_msg='' || auth_msg=' with --auth' | ||
|
||
echo "React/React DOM install directive found in starter.ini" | ||
echo "Installing React and React DOM..." | ||
sleep 3 | ||
|
||
if [ "$auth" == 1 ]; then | ||
php artisan ui react --auth | ||
else | ||
php artisan ui react | ||
fi | ||
err_code=$? | ||
if [ $err_code == 0 ]; then | ||
echo "SUCCESS: React and React DOM$version_msg$auth_msg has been installed" | ||
echo "Compiling fresh scaffolding and running Laravel Mix" | ||
yarn install && yarn run dev && sleep 1 && yarn run dev | ||
|
||
if [ ! -z "$version" ]; then | ||
echo "Setting react and react-dom to$version_msg" | ||
# TODO: validate semver and valid version for the package so users cant pass in junk | ||
yarn upgrade react@$version react-dom@$version | ||
fi | ||
|
||
[ "$install_bootstrap" == 1 ] && echo "Bootstrap install directive found but ignored. Already installed." | ||
[ "$install_vue" == 1 ] && echo "Vue install directive found but ignored. The install of react superceded this." | ||
else | ||
>&2 echo "ERROR $err_code: There was a problem installing React/React DOM$version_msg$auth_msg" | ||
fi | ||
fi | ||
# END: Optional react and react-dom install | ||
|
||
# BEGIN: Optional vue install | ||
if [[ "$install_vue" == 1 && "$install_react" == 0 ]]; then | ||
version=$(. /tmp/utils.sh parse_ini_value starter.ini vue version) | ||
auth=$(. /tmp/utils.sh parse_ini_value starter.ini vue auth) | ||
|
||
[ -z "$version" ] && version_msg='' || version_msg=" version $version" | ||
[ "$auth" != 1 ] && auth_msg='' || auth_msg=' with --auth' | ||
|
||
echo "Vue install directive found in starter.ini" | ||
echo "Installing Vue..." | ||
|
||
if [ "$auth" == 1 ]; then | ||
php artisan ui vue --auth | ||
else | ||
php artisan ui vue | ||
fi | ||
err_code=$? | ||
if [ $err_code == 0 ]; then | ||
echo "SUCCESS: Vue$version_msg$auth_msg has been installed." | ||
echo "Compiling fresh scaffolding and running Laravel Mix." | ||
yarn install && yarn run dev && sleep 1 && yarn run dev | ||
|
||
if [ ! -z "$version" ]; then | ||
echo "Setting vue to$version_msg" | ||
# TODO: validate semver and valid version for the package so users cant pass in junk | ||
yarn upgrade vue@$version | ||
fi | ||
|
||
[ "$install_bootstrap" == 1 ] && echo "Bootstrap install directive found but ignored. Already installed." | ||
else | ||
>&2 echo "ERROR $err_code: There was a problem installing Vue$version_msg$auth_msg" | ||
fi | ||
fi | ||
# END: Optional vue install | ||
|
||
# BEGIN: Optional bootstrap install | ||
if [[ $install_bootstrap == 1 && $install_react == 0 && $install_vue == 0 ]]; then | ||
version=$(. /tmp/utils.sh parse_ini_value starter.ini bootstrap version) | ||
auth=$(. /tmp/utils.sh parse_ini_value starter.ini bootstrap auth) | ||
|
||
[ -z "$version" ] && version_msg='' || version_msg=" version $version" | ||
[ "$auth" != 1 ] && auth_msg='' || auth_msg=' with --auth' | ||
|
||
echo "Bootstrap install directive found in starter.ini" | ||
echo "Installing Bootstrap..." | ||
|
||
if [ "$auth" == 1 ]; then | ||
php artisan ui bootstrap --auth | ||
else | ||
php artisan ui bootstrap | ||
fi | ||
err_code=$? | ||
if [ $err_code == 0 ]; then | ||
echo "SUCCESS: Bootstrap$version_msg$auth_msg has been installed." | ||
echo "Compiling fresh scaffolding and running Laravel Mix." | ||
yarn install && yarn run dev && sleep 1 && yarn run dev | ||
|
||
if [ ! -z "$version" ]; then | ||
echo "Setting bootstrap to$version_msg" | ||
# TODO: validate semver and valid version for the package so users cant pass in junk | ||
yarn upgrade bootstrap@$version | ||
fi | ||
else | ||
>&2 echo "ERROR $err_code: There was a problem installing Bootstrap$version_msg$auth_msg" | ||
fi | ||
else | ||
version=$(. /tmp/utils.sh parse_ini_value starter.ini bootstrap version) | ||
[ -z "$version" ] && version_msg='' || version_msg=" version $version" | ||
if [[ ! -z $version && $install_bootstrap == 1 ]]; then | ||
echo "Setting bootstrap to$version_msg" | ||
yarn upgrade bootstrap@$version | ||
fi | ||
fi | ||
# END: Optional bootstrap install | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,35 @@ | ||
#################### | ||
# starter.ini | ||
# Configuration for gitpod to build your stack as you like it | ||
# Note: Boolean values should always be set to 1 (true) or 0 (false) | ||
# Additional Note: Version numbers for node packages support semantic versioning or can be left blank | ||
#################### | ||
|
||
[development] | ||
# Valid values: apache, php | ||
default_server=apache | ||
# 1 = show (no browser auto refresh), 1 = hide (browser auto refresh) | ||
show_debug_session_query_param=0 | ||
|
||
[phpmyadmin] | ||
# 1 = install phpmyadmin, 0 = do not install phpmyadmin | ||
install=1 | ||
# This install happens in .gitpod.Dockerfile so it can get cached one way or the other, | ||
# force a build of the image workspace (see .gitpod.Dockerfile) to get your desired results. | ||
install=1 | ||
|
||
[react] | ||
# An install of react also installs and upgrades react-dom to the same version set below | ||
# if install = 1 then vue will not be installed if its install value is also set to 1 | ||
install=0 | ||
auth=0 | ||
version= | ||
|
||
[vue] | ||
# An install of react will supercede an install of vue, choose one or the other | ||
install=0 | ||
auth=0 | ||
version= | ||
|
||
[bootstrap] | ||
# Installs of either react or vue have bootstrap already so this section will be superceded in those cases | ||
install=0 | ||
# auth only appies here when react or vue are not installed. | ||
auth=0 | ||
version= |