Commit 0c9affe5 authored by Jeff Escalante's avatar Jeff Escalante Committed by Calvin Leung Huang
Browse files

New Website! (#8154)

* new documentation website

* ci job adjustment

* update to latest version on downloads page

* remove transition-period scripts

* add netlify toml file

* fix docs patch

* fix ci config?

* revert go.mod changes

* a couple last markdown formatting fixes
parent 50437ab8
Showing with 234 additions and 575 deletions
+234 -575
......@@ -305,6 +305,29 @@ jobs:
- GO_VERSION: 1.12.14
- GO111MODULE: 'off'
- GOTESTSUM_VERSION: 0.3.3
website-docker-image:
docker:
- image: circleci/buildpack-deps
shell: /usr/bin/env bash -euo pipefail -c
steps:
- checkout
- setup_remote_docker
- run:
command: |
echo 'export PACKAGE_LOCK_CHANGED=$(git diff --name-only $(git log --pretty=format:'%h' -n1 HEAD~1)...HEAD | grep -c website/package-lock.json)' >> $BASH_ENV
name: Diff package-lock.json
- run:
command: |
if [ "$CIRCLE_BRANCH" = "master" ] && [ $PACKAGE_LOCK_CHANGED -gt 0 ]; then
cd website/
docker build -t hashicorp/vault-website:$CIRCLE_SHA1 .
docker tag hashicorp/vault-website:$CIRCLE_SHA1 hashicorp/vault-website:latest
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push hashicorp/vault-website
else
echo "Not building a new website docker image - branch is not master and/or dependencies have not changed."
fi
name: Build Docker Image if Necessary
workflows:
ci:
jobs:
......@@ -332,6 +355,7 @@ workflows:
- test-go-race:
requires:
- build-go-dev
- website-docker-image
version: 2
# Original config.yml file:
......@@ -574,6 +598,29 @@ workflows:
# export PATH=\"${PWD}\"/bin:${PATH}
# make test-ui-browserstack
# name: Run Browserstack Tests
# website-docker-image:
# docker:
# - image: circleci/buildpack-deps
# shell: /usr/bin/env bash -euo pipefail -c
# steps:
# - checkout
# - setup_remote_docker
# - run:
# command: |
# echo 'export PACKAGE_LOCK_CHANGED=$(git diff --name-only $(git log --pretty=format:'%h' -n1 HEAD~1)...HEAD | grep -c website/package-lock.json)' >> $BASH_ENV
# name: Diff package-lock.json
# - run:
# command: |
# if [ \"$CIRCLE_BRANCH\" = \"master\" ] && [ $PACKAGE_LOCK_CHANGED -gt 0 ]; then
# cd website/
# docker build -t hashicorp/vault-website:$CIRCLE_SHA1 .
# docker tag hashicorp/vault-website:$CIRCLE_SHA1 hashicorp/vault-website:latest
# docker login -u $DOCKER_USER -p $DOCKER_PASS
# docker push hashicorp/vault-website
# else
# echo \"Not building a new website docker image - branch is not master and/or dependencies have not changed.\"
# fi
# name: Build Docker Image if Necessary
# references:
# cache:
# go-sum: go-sum-v1-{{ checksum \"go.sum\" }}
......@@ -607,4 +654,5 @@ workflows:
# - build-go-dev
# - test-go-race:
# requires:
# - build-go-dev
\ No newline at end of file
# - build-go-dev
# - website-docker-image
\ No newline at end of file
docker:
- image: circleci/buildpack-deps
shell: /usr/bin/env bash -euo pipefail -c
steps:
- checkout
- setup_remote_docker
- run:
name: Diff package-lock.json
command: |
echo 'export PACKAGE_LOCK_CHANGED=$(git diff --name-only $(git log --pretty=format:'%h' -n1 HEAD~1)...HEAD | grep -c website/package-lock.json)' >> $BASH_ENV
- run:
name: Build Docker Image if Necessary
command: |
if [ "$CIRCLE_BRANCH" = "master" ] && [ $PACKAGE_LOCK_CHANGED -gt 0 ]; then
cd website/
docker build -t hashicorp/vault-website:$CIRCLE_SHA1 .
docker tag hashicorp/vault-website:$CIRCLE_SHA1 hashicorp/vault-website:latest
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push hashicorp/vault-website
else
echo "Not building a new website docker image - branch is not master and/or dependencies have not changed."
fi
......@@ -15,12 +15,13 @@ jobs:
- install-ui-dependencies
- build-go-dev
filters:
branches:
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
ignore: /pull\/[0-9]+/
branches:
# Forked pull requests have CIRCLE_BRANCH set to pull/XXX
ignore: /pull\/[0-9]+/
- test-go:
requires:
- build-go-dev
- test-go-race:
requires:
- build-go-dev
- website-docker-image
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[Makefile]
indent_style = tab
[{*.md,*.json}]
max_line_length = null
module.exports = {
...require('@hashicorp/nextjs-scripts/.eslintrc.js'),
/* Specify overrides here */
ignorePatterns: ['public/']
}
node_modules
.DS_Store
.next
out
.mdx-data
10.15.3
{
"ignore": {
"marked": {
"versions": "0.8.0",
"reason": "breaks IE"
}
}
}
{
"semi": false,
"singleQuote": true
}
FROM node:10.16.3-alpine
RUN apk add --update --no-cache git make g++ automake autoconf libtool nasm libpng-dev
COPY ./package.json /website/package.json
COPY ./package-lock.json /website/package-lock.json
WORKDIR /website
RUN npm install
source "https://rubygems.org"
gem 'middleman', '~> 4.2'
gem 'middleman-hashicorp', git: 'https://github.com/carrot/middleman-hashicorp'
# gem 'middleman-hashicorp', path: '/Users/jeff/Sites/middleman-hashicorp-carrot'
gem 'builder'
gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]
gem 'wdm', '~> 0.1', platforms: [:mswin, :mingw]
gem 'middleman-dato'
GIT
remote: https://github.com/carrot/middleman-hashicorp
revision: a1e3615e8f7d1c3c798d1ec7d7040ff1ba565c0f
specs:
middleman-hashicorp (0.3.28)
activesupport (~> 5.0)
middleman (~> 4.2)
middleman-dato
middleman-livereload (~> 3.4)
middleman-syntax (~> 3.0)
nokogiri (~> 1.8)
redcarpet (~> 3.3)
GEM
remote: https://rubygems.org/
specs:
activesupport (5.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
backports (3.15.0)
builder (3.2.3)
cacert (0.5.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.5)
contracts (0.13.0)
dato (0.7.7)
activesupport (>= 4.2.7)
addressable
cacert
dato_json_schema
dotenv
faraday (>= 0.9.0)
faraday_middleware (>= 0.9.0)
imgix (>= 0.3.1)
listen
mime-types
pusher-client
thor
toml
dato_json_schema (0.20.8)
dotenv (2.1.0)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
eventmachine (1.2.7)
execjs (2.7.0)
faraday (0.17.0)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.13.1)
faraday (>= 0.7.4, < 1.0)
fast_blank (1.0.0)
fastimage (2.1.7)
ffi (1.11.1)
haml (5.1.2)
temple (>= 0.8.0)
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.6.0)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
imgix (3.1.1)
addressable
json (2.2.0)
kramdown (1.17.0)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
memoist (0.16.0)
middleman (4.3.5)
coffee-script (~> 2.2)
haml (>= 4.0.5)
kramdown (~> 1.2)
middleman-cli (= 4.3.5)
middleman-core (= 4.3.5)
middleman-cli (4.3.5)
thor (>= 0.17.0, < 2.0)
middleman-core (4.3.5)
activesupport (>= 4.2, < 5.1)
addressable (~> 2.3)
backports (~> 3.6)
bundler
contracts (~> 0.13.0)
dotenv
erubis
execjs (~> 2.0)
fast_blank
fastimage (~> 2.0)
hamster (~> 3.0)
hashie (~> 3.4)
i18n (~> 0.9.0)
listen (~> 3.0.0)
memoist (~> 0.14)
padrino-helpers (~> 0.13.0)
parallel
rack (>= 1.4.5, < 3)
sassc (~> 2.0)
servolux
tilt (~> 2.0.9)
uglifier (~> 3.0)
middleman-dato (0.9.0)
activesupport
dato (>= 0.7.0)
dotenv (<= 2.1)
middleman-core (>= 4.1.10)
middleman-livereload (3.4.6)
em-websocket (~> 0.5.1)
middleman-core (>= 3.3)
rack-livereload (~> 0.3.15)
middleman-syntax (3.2.0)
middleman-core (>= 3.2)
rouge (~> 3.2)
mime-types (3.3)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009)
mini_portile2 (2.4.0)
minitest (5.12.2)
multipart-post (2.1.1)
nokogiri (1.10.4)
mini_portile2 (~> 2.4.0)
padrino-helpers (0.13.3.4)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.4)
tilt (>= 1.4.1, < 3)
padrino-support (0.13.3.4)
activesupport (>= 3.1)
parallel (1.18.0)
parslet (1.8.2)
public_suffix (4.0.1)
pusher-client (0.6.2)
json
websocket (~> 1.0)
rack (2.0.7)
rack-livereload (0.3.17)
rack
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
redcarpet (3.5.0)
rouge (3.12.0)
sassc (2.2.1)
ffi (~> 1.9)
servolux (0.13.0)
temple (0.8.2)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.10)
toml (0.2.0)
parslet (~> 1.8.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
websocket (1.2.8)
PLATFORMS
ruby
DEPENDENCIES
builder
bundler (= 2.0.1)
middleman (~> 4.2)
middleman-dato
middleman-hashicorp!
tzinfo-data
wdm (~> 0.1)
# Proprietary License
This license is temporary while a more official one is drafted. However,
this should make it clear:
The text contents of this website are MPL 2.0 licensed.
The design contents of this website are proprietary and may not be reproduced
or reused in any way other than to run the website locally. The license for
the design is owned solely by HashiCorp, Inc.
configure-cache:
@mkdir -p tmp/cache .bundle
# Default: run this if working on the website locally to run in watch mode.
website:
@echo "==> Downloading latest Docker image..."
@docker pull hashicorp/vault-website
@echo "==> Starting website in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--workdir "/website" \
--volume "$(shell pwd):/website" \
--volume "/website/node_modules" \
--publish "3000:3000" \
hashicorp/vault-website \
npm start
build: configure-cache
# This command will generate a static version of the website to the "out" folder.
build:
@echo "==> Downloading latest Docker image..."
@docker pull hashicorp/vault-website
@echo "==> Starting build in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--volume "$(shell pwd):/opt/buildhome/repo" \
--volume "$(shell pwd)/tmp/cache:/opt/buildhome/cache" \
--user buildbot:$(shell id -g) \
--env "ENV=production" \
netlify/build \
build "sh bootstrap.sh && middleman build --verbose"
--workdir "/website" \
--volume "$(shell pwd):/website" \
--volume "/website/node_modules" \
hashicorp/vault-website \
npm run static
# If you are changing node dependencies locally, run this to generate a new
# local Docker image with the dependency changes included.
build-image:
@echo "==> Building Docker image..."
@docker build -t hashicorp-vault-website-local .
website: configure-cache
# Use this if you have run `build-image` to use the locally built image
# rather than our CI-generated image to test dependency changes.
website-local:
@echo "==> Downloading latest Docker image..."
@docker pull hashicorp/vault-website
@echo "==> Starting website in Docker..."
@docker run \
--interactive \
--rm \
--tty \
--volume "$(shell pwd):/opt/buildhome/repo" \
--volume "$(shell pwd)/tmp/cache:/opt/buildhome/cache" \
--user buildbot:$(shell id -g) \
--publish "4567:4567" \
--publish "35729:35729" \
--env "ENV=production" \
netlify/build \
build "sh bootstrap.sh && middleman"
--workdir "/website" \
--volume "$(shell pwd):/website" \
--volume "/website/node_modules" \
--publish "3000:3000" \
hashicorp-vault-website-local \
npm start
.PHONY: configure-cache build website
.DEFAULT_GOAL := website
.PHONY: build build-image website website-local
# Vault Website
This subdirectory contains the entire source for the [Vault Website][vault].
This is a [Middleman][middleman] project, which builds a static site from these
source files.
[![Netlify Status](https://img.shields.io/netlify/f7fa8963-0022-4a0e-9ccf-f5385355906b?style=flat-square)](https://app.netlify.com/sites/vault-docs-platform/deploys)
## Updating Navigation
This subdirectory contains the entire source for the [Vault Website](https://vaultproject.io/). This is a [NextJS](https://nextjs.org/) project, which builds a static site from these source files.
There are a couple different places on the website that present navigation interfaces with differing levels of detail.
## Contributions Welcome!
On the homepage, docs index page, and api docs index page, there are grids of major categories [that look like this](https://cl.ly/73df9722848d/Screen%20Shot%202018-11-09%20at%2011.40.56%20AM.png). These major category grids can be updated through [`data/docs_basic_categories.yml`](data/docs_basic_categories.yml) and [`data/api_basic_categories.yml`](data/api_basic_categories.yml).
If you find a typo or you feel like you can improve the HTML, CSS, or JavaScript, we welcome contributions. Feel free to open issues or pull requests like any normal GitHub project, and we'll merge it in 🚀
On the docs and api index pages, there are more detailed breakdowns of top-level documentation pages within each category [that look like this](https://cl.ly/b05cf42402eb/Screen%20Shot%202018-11-09%20at%2011.43.25%20AM.png). These more detailed category listings can be updated through [`data/docs_detailed_categories.yml`](data/docs_detailed_categories.yml) and [`data/api_detailed_categories.yml`](data/api_detailed_categories.yml).
## Running the Site Locally
Finally, within a given docs page, there is a sidebar which displays a fully nested version of all docs pages. This sidebar navigation can be updated through via middleman's layouts, found at [`source/layouts/docs.erb`](source/layouts/docs.erb) and [`source/layouts/api.erb`](source/layouts/api.erb). You will see within these files that it is no longer necessary to type out full nested html list item and link tags, you can simply add the documentation page's slug, defined as `sidebar_current` within the frontmatter of any docs markdown file. The sidebar nav component will go find the page by slug and render out its human-readable title and a link for you. This component does not allow broken links or nesting mistakes, so if you make a typo on the slug or put a page in the wrong category, the build will fail.
The website can be run locally through node.js or Docker. If you choose to run through Docker, everything will be a little bit slower due to the additional overhead, so for frequent contributors it may be worth it to use node. Also if you are a vim user, it's also worth noting that vim's swapfile usage can cause issues for the live reload functionality. In order to avoid these issues, make sure you have run `:set backupcopy=yes` within vim.
## Contributions Welcome!
### With Docker
If you find a typo or you feel like you can improve the HTML, CSS, or
JavaScript, we welcome contributions. Feel free to open issues or pull requests
like any normal GitHub project, and we'll merge it in.
Running the site locally is simple. Provided you have Docker installed, clone this repo, run `make`, and then visit `http://localhost:3000`.
## Running the Site Locally
The docker image is pre-built with all the website dependencies installed, which is what makes it so quick and simple, but also means if you need to change dependencies and test the changes within Docker, you'll need a new image. If this is something you need to do, you can run `make build-image` to generate a local Docker image with updated dependencies, then `make website-local` to use that image and preview.
### With Node
If your local development environment has a supported version (v10.0.0+) of [node installed](https://nodejs.org/en/) you can run:
- `npm install`
- `npm start`
and then visit `http://localhost:3000`.
If you pull down new code from github, you should run `npm install` again. Otherwise, there's no need to re-run `npm install` each time the site is run, you can just run `npm start` to get it going.
## Editing Content
Documentation content is written in [Markdown](https://www.markdownguide.org/cheat-sheet/) and you'll find all files listed under the `/pages` directory.
To create a new page with Markdown, create a file ending in `.mdx` in the `pages/` directory. The path in the pages directory will be the URL route. For example, `pages/hello/world.mdx` will be served from the `/hello/world` URL.
This file can be standard Markdown and also supports [YAML frontmatter](https://middlemanapp.com/basics/frontmatter/). YAML frontmatter is optional, there are defaults for all keys.
```yaml
---
title: 'My Title'
description: "A thorough, yet succinct description of the page's contents"
---
```
The significant keys in the YAML frontmatter are:
- `title` `(string)` - This is the title of the page that will be set in the HTML title.
- `description` `(string)` - This is a description of the page that will be set in the HTML description.
> ⚠️Since `api` is a reserved directory within NextJS, all `/api/**` pages are listed under the `/pages/api-docs` path.
When running the site locally, you can choose between running it directly on your machine, or running it through Docker. Docker has the advantage of requiring only Docker to be installed - no other dependencies are needed on your machine. However, Docker's overhead makes the site's compilation perform much slower than running it directly on your machine. If you are a frequent contributor, are bothered by the performance in Docker, or have no issues with installing ruby and node / already have them installed, it might be an advantage to try running the site directly on your machine. Instructions for both approaches are included below.
### Editing Sidebars
### Running the Site with Docker
The structure of the sidebars are controlled by files in the [`/data` directory](data).
First, make sure that [docker](docker) is installed. It can be installed in many ways, [the desktop app](docker-desktop) is the simplest. To run the site, clone this repo down, `cd` into the `website` directory, and run `make website`. If it is your first time running the site, the build will take a little longer as it needs to download a docker image and a bunch of dependencies, so maybe go grab a coffee. On subsequent runs, it will be faster as dependencies are cached.
- Edit [this file](data/docs-navigation.js) to change the **docs** sidebar
- Edit [this file](data/docs-navigation.js) to change the **api docs** sidebar
### Running the Site Directly
To nest sidebar items, you'll want to add a new `category` key/value accompanied by the appropriate embedded `content` values.
This site requires a recent version of ruby as well as nodejs to be installed in order to run. There are [many ways to install ruby](https://www.ruby-lang.org/en/documentation/installation/), we recommend [rbenv](rbenv), which has very clear installation instructions in its readme, linked here, and installing ruby version `2.4.3`. Once ruby has been installed, you will need to install `bundler` as well, using `gem install bundler`. Node is quite easy to install [via universal binary](node) or [homebrew](homebrew) if you are a mac user.
- `category` values will be **directory names** within the `pages` directory
- `content` values will be **file names** within their appropriately nested directory.
Once ruby and node have been installed, within this directory, you can run `sh bootstrap.sh` to install all the dependencies needed to run the site, then run `middleman` to start the dev server.
### Creating New Pages
### Browsing the Site Locally
There is currently a small bug with new page creation - if you create a new page and link it up via subnav data while the server is running, it will report an error saying the page was not found. This can be resolved by restarting the server.
Once you have the local dev server running, head to `http://localhost:4567` in your browser. Note that for some URLs, you may need to append
".html" to make them work (in the navigation).
### Deployment
[middleman]: https://www.middlemanapp.com
[vault]: https://www.vaultproject.io
[docker]: https://www.docker.com/
[docker-desktop]: https://www.docker.com/products/docker-desktop
[rbenv]: https://github.com/rbenv/rbenv#installation
[node]: https://nodejs.org/en/
[homebrew]: https://brew.sh/
This website is hosted on Netlify and configured to automatically deploy anytime you push code to the `stable-website` branch. Any time a pull request is submitted that changes files within the `website` folder, a deployment preview will appear in the github checks which can be used to validate the way docs changes will look live. Deployments from `stable-website` will look and behave the same way as deployment previews.
# API landing
/api /api/overview
# Docs landing
/docs /docs/install/index.html
# Intro landing
/intro /intro/getting-started/index.html
/api/* /api-docs/:splat 200
/intro /intro/getting-started
/api/secret/generic/index.html /api/secret/kv
/api/system/renew.html /api/system/leases
......@@ -54,7 +48,6 @@
/guides/upgrading/upgrade-to-0.10.4.html /docs/upgrading/upgrade-to-0.10.4
/guides/upgrading/upgrade-to-0.11.0.html /docs/upgrading/upgrade-to-0.11.0
/guides/upgrading/upgrade-to-0.11.2.html /docs/upgrading/upgrade-to-0.11.2
/guides/upgrading/upgrade-to-1.0.html /docs/upgrading/upgrade-to-1.0.0
/docs/http/sys-audit.html /api/system/audit
/docs/http/sys-auth.html /api/system/auth
/docs/http/sys-health.html /api/system/health
......@@ -141,7 +134,7 @@
/guides/identity/policy-templating.html https://learn.hashicorp.com/vault/identity-access-management/policy-templating
/guides/identity/authentication.html https://learn.hashicorp.com/vault/identity-access-management/iam-authentication
/guides/identity/approle-trusted-entities.html https://learn.hashicorp.com/vault/identity-access-management/iam-approle-trusted-entities
/guides/identity/lease.html https://learn.hashicorp.com/vault/secrets-management/tokens
/guides/identity/lease.html https://learn.hashicorp.com/vault/secrets-management/sm-lease
/guides/identity/identity.html https://learn.hashicorp.com/vault/identity-access-management/iam-identity
/guides/identity/sentinel.html https://learn.hashicorp.com/vault/identity-access-management/iam-sentinel
/guides/identity/control-groups.html https://learn.hashicorp.com/vault/identity-access-management/iam-control-groups
......@@ -175,4 +168,19 @@
/intro/vs/index.html /docs/vs
/intro/vs/keywhiz.html /docs/vs/keywhiz
/intro/vs/kms.html /docs/vs/kms
/intro/what-is-vault/index.html /docs/what-is-vault
\ No newline at end of file
/intro/what-is-vault/index.html /docs/what-is-vault
# Intro getting started content -> Learn
/intro/index.html https://learn.hashicorp.com/vault/#getting-started
/intro/getting-started/ https://learn.hashicorp.com/vault/getting-started/install
/intro/getting-started/index.html https://learn.hashicorp.com/vault/getting-started/install
/intro/getting-started/dev-server.html https://learn.hashicorp.com/vault/getting-started/dev-server
/intro/getting-started/first-secret.html https://learn.hashicorp.com/vault/getting-started/first-secret
/intro/getting-started/secrets-engines.html https://learn.hashicorp.com/vault/getting-started/secrets-engines
/intro/getting-started/dynamic-secrets.html https://learn.hashicorp.com/vault/getting-started/dynamic-secrets
/intro/getting-started/help.html https://learn.hashicorp.com/vault/getting-started/help
/intro/getting-started/authentication.html https://learn.hashicorp.com/vault/getting-started/authentication
/intro/getting-started/policies.html https://learn.hashicorp.com/vault/getting-started/policies
/intro/getting-started/deploy.html https://learn.hashicorp.com/vault/getting-started/deploy
/intro/getting-started/apis.html https://learn.hashicorp.com/vault/getting-started/apis
/intro/getting-started/next-steps.html https://learn.hashicorp.com/vault/getting-started/next-steps
const cssStandards = require('spike-css-standards')
const jsStandards = require('spike-js-standards')
const preactPreset = require('babel-preset-preact')
const extendRule = require('postcss-extend-rule')
const webpack = require('webpack')
/* eslint-disable-next-line */
console.log(`Building assets for environment *${process.env.NODE_ENV}*`)
const isProd =
process.env.NODE_ENV === 'production' ||
process.env.NODE_ENV === 'tmp-production'
let utilServerUrl
if (isProd) {
utilServerUrl = 'https://util.hashicorp.com'
} else {
utilServerUrl = 'https://hashicorp-web-util-staging.herokuapp.com'
}
if (process.env.UTIL_SERVER) {
utilServerUrl = process.env.UTIL_SERVER
// remove trailing slash
utilServerUrl = utilServerUrl.replace(/\/$/, '')
/* eslint-disable-next-line */
console.log(`utilServerUrl=${utilServerUrl}`)
}
let segmentWriteKey
if (isProd) {
segmentWriteKey = 'OdSFDq9PfujQpmkZf03dFpcUlywme4sC'
} else {
segmentWriteKey = '0EXTgkNx0Ydje2PGXVbRhpKKoe5wtzcE'
}
module.exports = {
ignore: ['yarn.lock', '**/_*'],
entry: {
'js/main': './js/index.js',
'js/analytics.js': './js/analytics.js',
'js/consent-manager': './js/consent-manager.js'
},
postcss: cssStandards({
appendPlugins: [extendRule()]
}),
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
utilityServerRoot: JSON.stringify(utilServerUrl),
segmentWriteKey: JSON.stringify(segmentWriteKey)
})
],
babel: jsStandards({ appendPresets: [preactPreset] }),
server: { open: false }
}
/* Logo Font (Klavika) */
@font-face {
font-family: 'klavika-web';
src: url('/fonts/klavika/500.woff2') format('woff2'),
url('/fonts/klavika/500.woff') format('woff');
font-weight: 700;
font-style: normal;
}
/* Display Font (Gilmer) */
@font-face {
font-family: 'gilmer-web';
src: url('/fonts/gilmer/gilmer-light.woff2') format('woff2'),
url('/fonts/gilmer/gilmer-light.woff') format('woff');
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: 'gilmer-web';
src: url('/fonts/gilmer/gilmer-regular.woff2') format('woff2'),
url('/fonts/gilmer/gilmer-regular.woff') format('woff');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'gilmer-web';
src: url('/fonts/gilmer/gilmer-medium.woff2') format('woff2'),
url('/fonts/gilmer/gilmer-medium.woff') format('woff');
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: 'gilmer-web';
src: url('/fonts/gilmer/gilmer-bold.woff2') format('woff2'),
url('/fonts/gilmer/gilmer-bold.woff') format('woff');
font-weight: 700;
font-style: normal;
}
/* Body Font (Metro) */
@font-face {
font-family: 'metro-web';
src: url('/fonts/metro/metro-sans-book.woff2') format('woff2'),
url('/fonts/metro/metro-sans-book.woff') format('woff');
font-weight: 300;
font-style: normal;
}
@font-face {
font-family: 'metro-web';
src: url('/fonts/metro/metro-sans-regular.woff2') format('woff2'),
url('/fonts/metro/metro-sans-regular.woff') format('woff');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'metro-web';
src: url('/fonts/metro/metro-sans-semi-bold.woff2') format('woff2'),
url('/fonts/metro/metro-sans-semi-bold.woff') format('woff');
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: 'metro-web';
src: url('/fonts/metro/metro-sans-bold.woff2') format('woff2'),
url('/fonts/metro/metro-sans-bold.woff') format('woff');
font-weight: 700;
font-style: normal;
}
/* Code Font (Deja Vu) */
@font-face {
font-family: "dejavu-sans-mono-web";
src: url("/fonts/dejavu/DejaVuSansMono.woff2") format("woff2"),
url("/fonts/dejavu/DejaVuSansMono.woff") format("woff");
font-style: normal;
font-weight: 400;
}
.content-wrap {
display: flex;
flex-direction: column;
flex-wrap: wrap;
flex: 1 0 auto;
position: relative;
width: 100%;
@media (min-width: 940px) {
flex-direction: row;
margin-top: 72px;
margin-bottom: 72px;
}
}
#inner {
margin: 64px 0;
overflow: auto;
width: 100%;
@media (min-width: 940px) {
flex: 1;
margin: 0;
}
& .g-content {
@media (max-width: 939px) {
padding-left: 0;
padding-right: 0;
}
& > h1:first-child {
margin-top: 0;
}
}
& .g-section-header {
margin-bottom: 100px;
}
}
@media print {
*,
*:before,
*:after {
background: transparent !important;
box-shadow: none !important;
text-shadow: none !important;
}
/* Hide nav elements from print */
.g-mega-nav,
.g-product-subnav,
.g-footer,
.g-docs-sidenav {
display: none;
}
/* Add border around code blocks */
div.highlight {
border: 1px solid #ddd;
page-break-inside: avoid;
& pre.highlight {
margin: 0;
}
}
/* Hide anchor links */
.anchor {
display: none !important;
}
/* Display link address in brackets */
/* Some overrides here because of the way we handle link hover on screens */
a[href]:after {
content: ' (' attr(href) ')' !important;
font-size: 90%;
position: static !important;
opacity: 1 !important;
text-decoration: none !important;
}
.g-content {
& p code {
/* Restore background grey on inline code */
background: rgba(0, 0, 0, 0.05) !important;
}
& pre code {
color: black !important;
& span {
color: black !important;
}
}
& p {
page-break-inside: avoid !important;
}
/* Let code blocks wrap if needed */
& pre > code {
white-space: normal;
}
}
a,
a:visited {
text-decoration: underline !important;
}
abbr[title]:after {
content: ' (' attr(title) ')';
}
a[href^='#']:after,
a[href^='javascript:']:after {
content: '';
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
page-break-inside: avoid;
}
h2,
h3 {
page-break-after: avoid;
}
.label {
border: 1px solid #000;
}
.table,
#inner table {
border-collapse: collapse !important;
}
.table td,
#inner table td,
.table th,
#inner table th {
background-color: #fff !important;
}
.table-bordered th,
.table-bordered td {
border: 1px solid #ddd !important;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment