Skip to content

Commit

Permalink
fix: 🐛 fix ln generation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgrv committed Jan 2, 2025
1 parent 86a5145 commit 79b7875
Show file tree
Hide file tree
Showing 18 changed files with 199 additions and 205 deletions.
16 changes: 16 additions & 0 deletions src/common-utils/_install-bin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
set -e

### Init directories
caller_filename=$(ps -o args= $PPID)
caller_filepath=$(readlink -f ${caller_filename##/bin/sh})
export source=$(dirname $caller_filepath)
export feature=$(basename $source | sed 's/_.*$//')
export target=${1:-/usr/local/share}/$feature

### Create links to utils in /usr/local/bin
find $target -type f -name "_*.sh" -exec echo {} \; -exec chmod +x {} \; | while read file
do
link=/usr/local/bin/$(basename $file | sed 's/^_//;s/.sh$//')
ln -sf $file $link
done
2 changes: 1 addition & 1 deletion src/common-utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Common Utils",
"version": "1.1.5",
"version": "1.1.6",
"description": "Common utils for tomgrv/devcontainer-features",
"dependsOn": {
"ghcr.io/devcontainers/features/common-utils": {}
Expand Down
10 changes: 0 additions & 10 deletions src/common-utils/install-bin.sh

This file was deleted.

1 change: 1 addition & 0 deletions src/common-utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ done

### Install this feature
$(dirname $0)/_install-feature.sh
$(dirname $0)/_install-bin.sh
36 changes: 0 additions & 36 deletions src/gitutils/install-stubs.sh

This file was deleted.

1 change: 1 addition & 0 deletions src/gitutils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ set -e

### Install this feature
install-feature
install-stubs
2 changes: 1 addition & 1 deletion src/gitversion/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "GitVersion feature",
"version": "3.0.1",
"version": "3.0.2",
"description": "Add gitversion to your devcontainer",
"dependsOn": {
"ghcr.io/devcontainers/features/dotnet": "",
Expand Down
36 changes: 0 additions & 36 deletions src/gitversion/install-stubs.sh

This file was deleted.

1 change: 1 addition & 0 deletions src/gitversion/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ set -e

### Install feature
install-feature
install-stubs
5 changes: 5 additions & 0 deletions src/larasets/_art.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -e

workspace=${containerWorkspaceFolder:-${CODESPACE_VSCODE_FOLDER:-.}}
[ -n "$LARAVEL_SAIL" ] && [ "$LARAVEL_SAIL" -eq 1 ] && sail artisan "$@" || php -d xdebug.mode=off $workspace/artisan "$@"
35 changes: 35 additions & 0 deletions src/larasets/_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
set -e

workspace=${containerWorkspaceFolder:-${CODESPACE_VSCODE_FOLDER:-.}}

### Install composer dependencies if composer.json exists
if [ -f $workspace/composer.json ]; then
echo "Install composer dependencies" | npx --yes chalk-cli --stdin blue
composer install --ansi --ignore-platform-reqs --no-interaction --no-progress
fi

### Install npm dependencies if package.json exists
if [ -f $workspace/package.json ]; then
echo "Install npm dependencies" | npx --yes chalk-cli --stdin blue
npm install --ws --if-present --include-workspace-root || npm install
fi

### Init db if sqlite and not exists
if [ -n "$DB_CONNECTION" ] && [ "$DB_CONNECTION" = "sqlite" ]; then

### Set default sqlite db
if [ -z "$DB_DATABASE" ]; then
export DB_DATABASE=database/database.sqlite
fi

echo "Ensure sqlite db $DB_DATABASE exist" | npx --yes chalk-cli --stdin blue
touch $workspace/$DB_DATABASE
fi

### Init env
echo "Init dotenv" | npx --yes chalk-cli --stdin blue
touch $workspace/.env

### Add APP_KEY to .env if it does not exist, in one line
grep -q "APP_KEY" $workspace/.env || echo APP_KEY=null >>$workspace/.env
5 changes: 5 additions & 0 deletions src/larasets/_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -e

workspace=${containerWorkspaceFolder:-${CODESPACE_VSCODE_FOLDER:-.}}
[ -n "$LARAVEL_SAIL" ] && [ "$LARAVEL_SAIL" -eq 1 ] && sail npm run "$@" || npm run "$@"
5 changes: 5 additions & 0 deletions src/larasets/_sail.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -e

workspace=${containerWorkspaceFolder:-${CODESPACE_VSCODE_FOLDER:-.}}
sh $([ -f sail ] && echo sail || echo $workspace/vendor/bin/sail) "$@"
10 changes: 10 additions & 0 deletions src/larasets/_seed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -e

art key:generate --force
art migrate --seed --graceful --no-interaction
art config:cache
art view:cache
art route:cache
art event:cache
art optimize:clear
49 changes: 0 additions & 49 deletions src/larasets/configure-aliases.sh

This file was deleted.

43 changes: 1 addition & 42 deletions src/larasets/configure-project.sh
Original file line number Diff line number Diff line change
@@ -1,59 +1,18 @@
#!/bin/sh
set -e

### Install composer dependencies if composer.json exists
if [ -f ${containerWorkspaceFolder:-.}/composer.json ]; then
echo "Install composer dependencies" | npx --yes chalk-cli --stdin blue
composer install --ansi --ignore-platform-reqs --no-interaction --no-progress
fi

### Install npm dependencies if package.json exists
if [ -f ${containerWorkspaceFolder:-.}/package.json ]; then
echo "Install npm dependencies" | npx --yes chalk-cli --stdin blue
npm install --ws --if-present --include-workspace-root || npm install
fi

### Init db if sqlite and not exists
if [ -n "$DB_CONNECTION" ] && [ "$DB_CONNECTION" = "sqlite" ]; then

### Set default sqlite db
if [ -z "$DB_DATABASE" ]; then
export DB_DATABASE=database/database.sqlite
fi

echo "Ensure sqlite db $DB_DATABASE exist" | npx --yes chalk-cli --stdin blue
touch ${containerWorkspaceFolder:-.}/$DB_DATABASE
fi

### Init env
echo "Init dotenv" | npx --yes chalk-cli --stdin blue
touch ${containerWorkspaceFolder:-.}/.env

### Add APP_KEY to .env if it does not exist, in one line
grep -q "APP_KEY" ${containerWorkspaceFolder:-.}/.env || echo APP_KEY=null >>${containerWorkspaceFolder:-.}/.env
init && seed

### Init laravel
if [ -f ${containerWorkspaceFolder:-.}/vendor/bin/sail ] && [ "${LARAVEL_SAIL}" -eq "1" ]; then

echo "Init laravel with sail" | npx --yes chalk-cli --stdin green
${containerWorkspaceFolder:-.}/vendor/bin/sail up --build -d
${containerWorkspaceFolder:-.}/vendor/bin/sail artisan key:generate --force
${containerWorkspaceFolder:-.}/vendor/bin/sail artisan config:cache
${containerWorkspaceFolder:-.}/vendor/bin/sail artisan view:cache
${containerWorkspaceFolder:-.}/vendor/bin/sail artisan route:cache
${containerWorkspaceFolder:-.}/vendor/bin/sail artisan optimize:clear
${containerWorkspaceFolder:-.}/vendor/bin/sail artisan migrate --seed --graceful --no-interaction
${containerWorkspaceFolder:-.}/vendor/bin/sail npx --yes pm2 --name server_dev start npm -- run dev

elif [ -f ${containerWorkspaceFolder:-.}/artisan ]; then

echo "Init laravel with artisan" | npx --yes chalk-cli --stdin green
php -d xdebug.mode=off artisan key:generate --force
php -d xdebug.mode=off artisan config:cache
php -d xdebug.mode=off artisan view:cache
php -d xdebug.mode=off artisan route:cache
php -d xdebug.mode=off artisan optimize:clear
php -d xdebug.mode=off artisan migrate --seed --graceful --no-interaction
npx --yes pm2 --name server_dev start npm -- run dev
else
echo "No laravel project found" | npx --yes chalk-cli --stdin yellow
Expand Down
Loading

0 comments on commit 79b7875

Please sign in to comment.