Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build new website for documentation #156

Merged
merged 10 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions website/.dir-locals.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((auto-mode-alist . (("\\.mdx\\'" . markdown-mode))))
18 changes: 0 additions & 18 deletions website/.editorconfig

This file was deleted.

3 changes: 0 additions & 3 deletions website/.env

This file was deleted.

1 change: 0 additions & 1 deletion website/.env.production

This file was deleted.

10 changes: 0 additions & 10 deletions website/.eslintrc.js

This file was deleted.

27 changes: 18 additions & 9 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
node_modules
.DS_Store
.next
out
.mdx-data
# Dependencies
/node_modules

# Production
/build

# As per Next.js conventions (https://nextjs.org/docs/basic-features/environment-variables#default-environment-variables)
.env*.local
!.env*
# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

website-preview
npm-debug.log*
yarn-debug.log*
yarn-error.log*
1 change: 0 additions & 1 deletion website/.nvmrc

This file was deleted.

9 changes: 0 additions & 9 deletions website/.stylelintrc.js

This file was deleted.

11 changes: 0 additions & 11 deletions website/Dockerfile

This file was deleted.

79 changes: 22 additions & 57 deletions website/Makefile
Original file line number Diff line number Diff line change
@@ -1,58 +1,23 @@
######################################################
# NOTE: This file is managed by the Digital Team's #
JanMa marked this conversation as resolved.
Show resolved Hide resolved
# Terraform configuration @ hashicorp/mktg-terraform #
######################################################

.DEFAULT_GOAL := website

# Set the preview mode for the website shell to "developer" or "io"
PREVIEW_MODE ?= developer
REPO ?= vault

# Enable setting alternate docker tool, e.g. 'make DOCKER_CMD=podman'
DOCKER_CMD ?= docker

CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD)
LOCAL_CONTENT_DIR=
PWD=$$(pwd)

DOCKER_IMAGE="hashicorp/dev-portal"
DOCKER_IMAGE_LOCAL="dev-portal-local"
DOCKER_RUN_FLAGS=-it \
--publish "3000:3000" \
--rm \
--tty \
--volume "$(PWD)/content:/app/content" \
--volume "$(PWD)/public:/app/public" \
--volume "$(PWD)/data:/app/data" \
--volume "$(PWD)/redirects.js:/app/redirects.js" \
--volume "next-dir:/app/website-preview/.next" \
--volume "$(PWD)/.env:/app/.env" \
-e "REPO=$(REPO)" \
-e "PREVIEW_FROM_REPO=$(REPO)" \
-e "IS_CONTENT_PREVIEW=true" \
-e "LOCAL_CONTENT_DIR=$(LOCAL_CONTENT_DIR)" \
-e "CURRENT_GIT_BRANCH=$(CURRENT_GIT_BRANCH)" \
-e "PREVIEW_MODE=$(PREVIEW_MODE)"

# Default: run this if working on the website locally to run in watch mode.
.PHONY: website
website:
@echo "==> Downloading latest Docker image..."
@$(DOCKER_CMD) pull $(DOCKER_IMAGE)
@echo "==> Starting website..."
@$(DOCKER_CMD) run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE)

# Use this if you have run `website/build-local` to use the locally built image.
.PHONY: website/local
website/local:
@echo "==> Starting website from local image..."
@$(DOCKER_CMD) run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE_LOCAL)

# Run this to generate a new local Docker image.
.PHONY: website/build-local
website/build-local:
@echo "==> Building local Docker image"
@$(DOCKER_CMD) build https://github.com/hashicorp/dev-portal.git\#main \
-t $(DOCKER_IMAGE_LOCAL)
NPM := $(shell which npm)

.PHONY: start, clean, deploy, serve, install

start: node_modules
@$(NPM) run start

build: node_modules $(wildcard content/**/*.mdx) sidebars.ts sidebarsApi.ts
@$(NPM) run build

serve: build
@$(NPM) run serve

deploy: node_modules
@$(NPM) run deploy

clean: node_modules
@$(NPM) run clear

node_modules: package.json
@$(NPM) install

install: node_modules