This repository was archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Fix mac errors for local server #233
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ set -e | |
|
|
||
| # USAGE: | ||
| # 1. Install Hugo: https://www.docsy.dev/docs/getting-started/#install-hugo | ||
| # | ||
| # | ||
| # 2. For Mac OSX: The script uses the `gnu` version of `sed`. To install `gnu-sed`, you use brew: | ||
| # 1. Run `brew install gnu-sed` | ||
| # 2. Add it to your `PATH`. For example, add the following line to your `~/.bash_profile`: | ||
|
|
@@ -52,6 +52,11 @@ BUILDALLRELEASES="false" | |
| BUILDSINGLEBRANCH="false" | ||
| PRBUILD="false" | ||
|
|
||
| # Default Hugo build options | ||
| # disable Hugo server | ||
| SERVER="" | ||
| # disable live reload | ||
| LIVERELOAD=" --watch=false --disableLiveReload" | ||
|
|
||
| # OPTIONS: | ||
| # | ||
|
|
@@ -68,28 +73,39 @@ PRBUILD="false" | |
| # | ||
| # USAGE: Append the -a true to the command. | ||
| # Example: | ||
| # ./scripts/build.sh -a true -s | ||
| # | ||
| # ./scripts/build.sh -a true -s true | ||
| # | ||
| # Examples: | ||
| # - Default local clone static HTML build: | ||
| # | ||
| # - Default: Build local clone to static HTML (output to 'public' folder): | ||
| # ./scripts/localbuild.sh | ||
| # | ||
| # - Local clone build with localhost server: | ||
| # ./scripts/localbuild.sh -s | ||
| # - Locally build knative.dev: | ||
| # ./scripts/localbuild.sh -a true | ||
| # | ||
| # - Clone all docs releases from knative/docs and then run local build: | ||
| # ./scripts/localbuild.sh -a true -s | ||
| # - Run Hugo server (localhost): | ||
| # | ||
| # - Locally build content from specified fork and branch: | ||
| # ./scripts/localbuild.sh -f repofork -b branchname -s | ||
| # - Local clone build (-s true): | ||
| # ./scripts/localbuild.sh -s true | ||
| # | ||
| # - Locally build a specific version from $FORK: | ||
| # ./scripts/localbuild.sh -b branchname -s | ||
| # - Local clone build with live reload (-s reload): | ||
| # - Useful for website changes only (doesn't work on docs) | ||
| # ./scripts/localbuild.sh -s reload | ||
| # | ||
| SERVER="" | ||
| while getopts f:b:a:s arg; do | ||
| case $arg in | ||
| # - Additional build options - build from remote Fork and Branch: | ||
| # | ||
| # - Build content from specified fork and branch: | ||
| # - Build any branch from your fork or from someones in a PR | ||
| # ./scripts/localbuild.sh -f REPOFORK -b BRANCHNAME | ||
| # | ||
| # - Locally build a specific branch from $FORK ($DEFAULTFORK): | ||
| # ./scripts/localbuild.sh -b BRANCHNAME | ||
| # | ||
| # - Combine other -s or -a flags. Example: | ||
| # ./scripts/localbuild.sh -f my-docs-contributor-fork -a true -s reload | ||
| # | ||
| while getopts "f:b:a:s:" arg; do | ||
| case "${arg}" in | ||
| f) | ||
| echo '--- BUILDING FROM ---' | ||
| echo 'FORK:' "${OPTARG}" | ||
|
|
@@ -109,20 +125,24 @@ while getopts f:b:a:s arg; do | |
| ;; | ||
| a) | ||
| echo 'BUILDING ALL RELEASES FROM KNATIVE/DOCS' | ||
| # If 'true', all knative/docs branches are built to mimic a | ||
| # "production" build. | ||
| # REQUIRED: If you specify a fork ($FORK), all of the same branches | ||
| # If 'true', all knative/docs branches are built to mimic a | ||
| # "production" build. | ||
| # REQUIRED: If you specify a fork ($FORK), all of the same branches | ||
| # (with the same branch names) that are built in knative.dev must | ||
| # also exist and be available in the that $FORK (ie, 'release-0.X'). | ||
| # See /config/production/params.toml for the list of the branches | ||
| # their names that are currently built in knative.dev. | ||
| # also exist and be available in the that $FORK (ie, 'release-0.X'). | ||
| # See scripts/docs-version-settings.sh for the list of the built branches. | ||
| BUILDALLRELEASES="${OPTARG}" | ||
| BUILDENVIRONMENT="production" | ||
| BUILDSINGLEBRANCH="false" | ||
| ;; | ||
| s) | ||
| echo 'Running hugo in server mode' | ||
| echo 'Running Hugo server' | ||
| SERVER="server" | ||
| if [ "${OPTARG}" = "reload" ]; then | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. primary change (2/3) - if you use the "reload" flag, enable live reload in Hugo server |
||
| echo 'with live reload' | ||
| LIVERELOAD=" --disableFastRender --renderToDisk" | ||
| fi | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
|
|
@@ -134,7 +154,7 @@ source scripts/processsourcefiles.sh | |
|
|
||
| # BUILD MARKDOWN | ||
| # Start HUGO build | ||
| hugo $SERVER --baseURL "" --environment "$BUILDENVIRONMENT" | ||
| hugo $SERVER --baseURL "" --environment "$BUILDENVIRONMENT" $LIVERELOAD --gc | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. primary change (3/3) - also added |
||
|
|
||
| if [ -z "$SERVER" ]; then | ||
| echo '' | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
primary change (1/3) - by default disable Hugo server live reload