diff --git a/.github/workflows/config/.lycheeignore b/.github/workflows/config/.lycheeignore deleted file mode 100644 index 260b61e7..00000000 --- a/.github/workflows/config/.lycheeignore +++ /dev/null @@ -1,15 +0,0 @@ -https://defense.gov/ -https://federal-agency.gov/.* -http://federal-agency.gov/ns/oscal -http://fedramp.gov/ns/oscal -https://fedramp.gov/ns/oscal -http://www.first.org/cvss/v2.0 -http://www.first.org/cvss/v3.0 -http://www.first.org/cvss/v3.1 -https://tools.ietf.org/html.* -http://csrc.nist.gov/ns/.* -http://csrc.nist.gov/oscal -https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/xxxx -https://cdn.telos.com/wp-content/uploads/2021/06/22150746/Xacta-360-EULA-US.pdf -https://search.usa.gov/search -https://example.com/.* diff --git a/.github/workflows/workflow-generate-website.yml b/.github/workflows/workflow-generate-website.yml index 1ba77248..5cc76026 100644 --- a/.github/workflows/workflow-generate-website.yml +++ b/.github/workflows/workflow-generate-website.yml @@ -50,7 +50,6 @@ jobs: - name: Checkout uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - submodules: recursive fetch-depth: 0 - name: Install Node.js dependencies run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" @@ -98,7 +97,7 @@ jobs: - name: Check Links uses: lycheeverse/lychee-action@76ab977fedbeaeb32029313724a2e56a8a393548 with: - args: --exclude-file ./.github/workflows/config/.lycheeignore --verbose --no-progress --accept 200,206,429 './website/**/*.html' --exclude-mail + args: --config ./src/lychee.toml './website/**/*.html' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Save Report diff --git a/.gitignore b/.gitignore index 03e2a75b..d2372ac5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ node_modules/ src/public src/resources/_gen - +lychee_report.md .hugo_build.lock diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 251352a3..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "src/themes/uswds"] - path = src/themes/uswds - url = https://github.com/usnistgov/hugo-uswds.git diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..046806c0 --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +SHELL:=/usr/bin/env bash + +.PHONY: help +# Run "make" or "make help" to get a list of user targets +# Adapted from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html +help: ## Show this help message + @grep -E '^[a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | awk 'BEGIN { \ + FS = ":.*?## "; \ + printf "\033[1m%-30s %s\033[0m\n", "TARGET", "DESCRIPTION" \ + } \ + { printf "\033[32m%-30s\033[0m %s\n", $$1, $$2 }' + +.PHONY: clean +clean: clean-site clean-linkcheck ## Clean all + +# +# Website generation / hugo +# + +SITE_OUTPUT_DIR:=src/public + +.PHONY: serve +serve: modeldoc release-assets ## Spin up a static web server for local dev + cd src; hugo serve + +.PHONY: site +site: $(SITE_OUTPUT_DIR) ## Build the site + +$(SITE_OUTPUT_DIR): + cd src; hugo --minify + +.PHONY: clean-site +clean-site: ## Clean the site + rm -fr $(SITE_OUTPUT_DIR) + +# +# Checks +# + +LYCHEE_OUTPUT_FILE:=lychee_report.md +LYCHEE_CONFIG_FILE:=./src/lychee.toml +# Flags that currently cannot be configured via the configuration file +LYCHEE_FLAGS:=--verbose --format markdown +# Extra flags for the user to override (used to set github token in GHA workflow) +LYCHEE_EXTRA_FLAGS:= + +.PHONY: linkcheck +linkcheck: $(LYCHEE_OUTPUT_FILE) ## Generate a report of all site links + +$(LYCHEE_OUTPUT_FILE): $(SITE_OUTPUT_DIR) + lychee \ + --config '$(LYCHEE_CONFIG_FILE)' \ + --output $(LYCHEE_OUTPUT_FILE) \ + $(LYCHEE_FLAGS) $(LYCHEE_EXTRA_FLAGS) \ + '$(SITE_OUTPUT_DIR)/**/*.html' + +clean-linkcheck: ## Clean the linkcheck report + rm -f $(LYCHEE_OUTPUT_FILE) diff --git a/README.md b/README.md index f041d97f..b25445d4 100644 --- a/README.md +++ b/README.md @@ -25,20 +25,11 @@ If you have any questions about OSCAL in general or if you would like to get inv Run the following Git command to clone the OSCAL-Pages repository, and you can begin editing content without any special setup. ```sh -git clone --recurse-submodules https://github.com/usnistgov/OSCAL-Pages.git +git clone https://github.com/usnistgov/OSCAL-Pages.git ``` The website content in this repository is generated into the full website with [Hugo](https://gohugo.io/). If you wish to run the website locally, you can either install hugo, or use Docker and docker-compose. -## Initializing for Development - -This repository uses submodules to load design elements required by the website. You can initialize these submodules with the command inside the cloned repository: - -```sh -cd OSCAL-Pages -git submodule update --init --recursive -``` - ## Using Hugo In terminal: diff --git a/src/config.yaml b/src/config.yaml index 3c588614..8a979182 100644 --- a/src/config.yaml +++ b/src/config.yaml @@ -10,7 +10,6 @@ languages: languageName: English weight: 1 MetaDataFormat: "yaml" -theme: "uswds" googleAnalytics: UA-66610693-1 enableGitInfo: true pygmentsCodeFences: true @@ -43,6 +42,8 @@ menu: url: https://github.com/usnistgov/OSCAL weight: 90 module: + imports: + - path: github.com/usnistgov/hugo-uswds mounts: # - source: content # target: content diff --git a/src/go.mod b/src/go.mod new file mode 100644 index 00000000..71895305 --- /dev/null +++ b/src/go.mod @@ -0,0 +1,5 @@ +module github.com/usnistgov/OSCAL-Pages/src + +go 1.20 + +require github.com/usnistgov/hugo-uswds v1.0.0 // indirect diff --git a/src/go.sum b/src/go.sum new file mode 100644 index 00000000..365613ef --- /dev/null +++ b/src/go.sum @@ -0,0 +1,2 @@ +github.com/usnistgov/hugo-uswds v1.0.0 h1:6Nwrs4XWOkxOheWWM8VTEl6aMM7cLQUNv0chuUokB8o= +github.com/usnistgov/hugo-uswds v1.0.0/go.mod h1:MkgH5fvt5GIZo70VkBav+wP6br+MzrD/+OMZ9EqDkHM= diff --git a/src/lychee.toml b/src/lychee.toml new file mode 100644 index 00000000..a10e7faf --- /dev/null +++ b/src/lychee.toml @@ -0,0 +1,22 @@ +no_progress = true +exclude_mail = true +accept = [200, 206, 429] +exclude = [ + 'https://defense.gov/', + 'https://federal-agency.gov/.*', + 'http://federal-agency.gov/ns/oscal', + 'http://fedramp.gov/ns/oscal', + 'https://fedramp.gov/ns/oscal', + 'http://www.first.org/cvss/v2.0', + 'http://www.first.org/cvss/v3.0', + 'http://www.first.org/cvss/v3.1', + 'https://tools.ietf.org/html.*', + 'http://csrc.nist.gov/ns/.*', + 'http://csrc.nist.gov/oscal', + 'https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/xxxx', + 'https://cdn.telos.com/wp-content/uploads/2021/06/22150746/Xacta-360-EULA-US.pdf', + 'https://search.usa.gov/search', + 'https://example.com/.*', + 'https://doi.org/.*', + 'http://doi.org/.*', +] diff --git a/src/themes/uswds b/src/themes/uswds deleted file mode 160000 index 96c1d7a9..00000000 --- a/src/themes/uswds +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 96c1d7a9bbe1ffb39325e3cee2787d53c93685e3