Skip to content

Commit

Permalink
feat: use web-entrypoint.d script
Browse files Browse the repository at this point in the history
This is to match current approach of ddev to installing n, as it happens
on the start.sh script
  • Loading branch information
hanoii committed Aug 21, 2024
1 parent 771567c commit 6b8fcb0
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .ddev/addon-metadata/readme/manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: readme
repository: .
version: ""
install_date: "2024-06-10T14:45:21-03:00"
install_date: "2024-08-21T12:14:13-03:00"
project_files:
- web-build/Dockerfile.readme
- readme/.gitignore
Expand All @@ -10,7 +10,7 @@ project_files:
- readme/build.sh
- readme/whichnode.sh
- readme/.ahoy.readme.yml
- web-build/Dockerfile.readme
- web-entrypoint.d/readme-nodedeps.sh
- config.readme.yaml
global_files: []
removal_actions: []
9 changes: 0 additions & 9 deletions .ddev/web-build/Dockerfile.readme

This file was deleted.

13 changes: 13 additions & 0 deletions .ddev/web-entrypoint.d/readme-nodedeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
#ddev-generated

# We install it as a web-entrypoint.d shell because that's after n installs the
# configured version

version=$(node -v | awk -F'[v.]' '{print $2}'); \
if [ $version -lt 18 ]; then \
n install lts -d; \
n exec lts npm install -g markdown-toc prettier; \
else \
npm install -g markdown-toc prettier; \
fi
12 changes: 11 additions & 1 deletion install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ project_files:
- readme/build.sh
- readme/whichnode.sh
- readme/.ahoy.readme.yml
- web-build/Dockerfile.readme
- web-entrypoint.d/readme-nodedeps.sh
- config.readme.yaml
post_install_actions:
- |
Expand All @@ -20,3 +20,13 @@ post_install_actions:
echo "Existing "$file" does not have #ddev-generated, so can't be renamed"
fi
fi
- |
#ddev-description: [update] Remove Dockerfile
file="web-build/Dockerfile.readme"
if [ -f "$file" ]; then
if grep '#ddev-generated' "$file" > /dev/null 2>&1; then
rm $file
else
echo "Existing "$file" does not have #ddev-generated, so can't be removed"
fi
fi
13 changes: 13 additions & 0 deletions web-entrypoint.d/readme-nodedeps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
#ddev-generated

# We install it as a web-entrypoint.d shell because that's after n installs the
# configured version

version=$(node -v | awk -F'[v.]' '{print $2}'); \
if [ $version -lt 18 ]; then \
n install lts -d; \
n exec lts npm install -g markdown-toc prettier; \
else \
npm install -g markdown-toc prettier; \
fi

0 comments on commit 6b8fcb0

Please sign in to comment.