Skip to content

Commit

Permalink
ddev-readme upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
hanoii committed Mar 25, 2024
1 parent 0457514 commit 8de8481
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .ddev/addon-metadata/readme/manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: readme
repository: https://github.com/hanoii/ddev-readme/tarball/main
version: ""
install_date: "2024-03-25T12:33:22-03:00"
install_date: "2024-03-25T14:24:23-03:00"
project_files:
- web-build/Dockerfile.readme
- readme/watch.js
- readme/.prettierrc
- readme/build.sh
- readme/.ahoy.readme.yml
- web-build/Dockerfile.readme
- config.readme.yaml
Expand Down
2 changes: 1 addition & 1 deletion .ddev/config.readme.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ddev-generated
hooks:
post-start:
- exec: nohup bash -c 'if [ -z "${DDEV_README_WATCH_DISABLED-}" ]; then { ahoy -f /var/www/html/.ddev/readme/.ahoy.readme.yml watch & } ; fi' > /dev/null 2>&1
- exec: nohup bash -c 'if [ -z "${DDEV_README_WATCH_DISABLED-}" ]; then { node /var/www/html/.ddev/readme/watch.js & } ; fi' > /dev/null 2>&1
7 changes: 2 additions & 5 deletions .ddev/readme/.ahoy.readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ ahoyapi: v2
commands:
build:
usage: 'Tidy up README.md'
cmd: |
prettier /var/www/html/README.md --write --config=/var/www/html/.ddev/readme/.prettierrc
markdown-toc -i /var/www/html/README.md
cmd: /var/www/html/.ddev/readme/build.sh

watch:
usage: 'Watch README.md for changes'
cmd: |
node /var/www/html/.ddev/readme/watch.js
cmd: node /var/www/html/.ddev/readme/watch.js
6 changes: 6 additions & 0 deletions .ddev/readme/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#ddev-generated
set -e -o pipefail

prettier /var/www/html/README.md --write --config=/var/www/html/.ddev/readme/.prettierrc
markdown-toc -i /var/www/html/README.md
4 changes: 2 additions & 2 deletions .ddev/readme/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const timeout = 2000
function watch() {
console.log("Watching for changes on README.md...")
let watcher = fs.watch('/var/www/html/README.md', (event, filename) => {
exec("ahoy -f /var/www/html/.ddev/readme/.ahoy.readme.yml build", (error, stdout, stderr) => {
exec("/var/www/html/.ddev/readme/build.sh", (error, stdout, stderr) => {
console.log(stdout);
})
watcher.close()
Expand All @@ -17,7 +17,7 @@ function watch() {
})
}

exec("ahoy -f /var/www/html/.ddev/readme/.ahoy.readme.yml build", (error, stdout, stderr) => {
exec("/var/www/html/.ddev/readme/build.sh", (error, stdout, stderr) => {
console.log(stdout);
})
setTimeout(() => {
Expand Down

0 comments on commit 8de8481

Please sign in to comment.