From 80a449cc5e16e1b48a6d6dac08627bf6a9c767b7 Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Mon, 11 Jan 2021 14:10:47 -0500 Subject: [PATCH] Website: prepare for vercel hosting move (#10402) * prepare to move to vercel hosting * add html extension handling * add back netlify files for transition --- website/.env.production | 1 + website/next.config.js | 2 + website/redirects.next.js | 197 ++++++++++++++++++++++++++++++++++++++ website/vercel.json | 7 ++ 4 files changed, 207 insertions(+) create mode 100644 website/.env.production create mode 100644 website/redirects.next.js create mode 100644 website/vercel.json diff --git a/website/.env.production b/website/.env.production new file mode 100644 index 000000000..83825a896 --- /dev/null +++ b/website/.env.production @@ -0,0 +1 @@ +HASHI_ENV=production diff --git a/website/next.config.js b/website/next.config.js index 0ebf8e806..6505b8a0a 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -1,5 +1,6 @@ const withHashicorp = require('@hashicorp/nextjs-scripts') const path = require('path') +const redirects = require('./redirects.next') module.exports = withHashicorp({ defaultLayout: true, @@ -13,6 +14,7 @@ module.exports = withHashicorp({ destination: '/api-docs/:path*', }, ], + redirects: () => redirects, // Note: These are meant to be public, it's not a mistake that they are here env: { HASHI_ENV: process.env.HASHI_ENV, diff --git a/website/redirects.next.js b/website/redirects.next.js new file mode 100644 index 000000000..c2591992e --- /dev/null +++ b/website/redirects.next.js @@ -0,0 +1,197 @@ +module.exports = [ + { + source: '/docs/installation', + destination: '/docs/install', + permanent: true, + }, + { + source: '/docs/command-line/machine-readable', + destination: '/docs/commands', + permanent: true, + }, + { + source: '/docs/command-line/introduction', + destination: '/docs/commands', + permanent: true, + }, + { + source: '/docs/templates/introduction', + destination: '/docs/templates', + permanent: true, + }, + { + source: '/docs/builders/azure-setup', + destination: '/docs/builders/azure', + permanent: true, + }, + { + source: '/docs/templates/veewee-to-packer', + destination: '/guides/veewee-to-packer', + permanent: true, + }, + { + source: '/docs/extend/developing-plugins', + destination: '/docs/extending/plugins', + permanent: true, + }, + { + source: '/docs/extending/developing-plugins', + destination: '/docs/extending/plugins', + permanent: true, + }, + { + source: '/docs/extend/builder', + destination: '/docs/extending/custom-builders', + permanent: true, + }, + { + source: '/docs/getting-started/setup', + destination: '/docs/getting-started/install', + permanent: true, + }, + { + source: '/docs/other/community', + destination: '/community-tools', + permanent: true, + }, + { + source: '/downloads-community', + destination: '/community-tools', + permanent: true, + }, + { + source: '/docs/platforms', + destination: '/docs/builders', + permanent: true, + }, + { + source: '/intro/platforms', + destination: '/docs/builders', + permanent: true, + }, + { + source: '/docs/templates/configuration-templates', + destination: '/docs/templates/engine', + permanent: true, + }, + { + source: '/docs/machine-readable/:path*', + destination: '/docs/commands', + permanent: true, + }, + { + source: '/docs/command-line/:path*', + destination: '/docs/commands/:path*', + permanent: true, + }, + { + source: '/docs/extend/:path*', + destination: '/docs/extending/:path*', + permanent: true, + }, + { + source: '/intro/getting-started', + destination: 'https://learn.hashicorp.com/packer/getting-started/install', + permanent: true, + }, + { + source: '/intro/getting-started/install', + destination: 'https://learn.hashicorp.com/packer/getting-started/install', + permanent: true, + }, + { + source: '/intro/getting-started/build-image', + destination: + 'https://learn.hashicorp.com/packer/getting-started/build-image', + permanent: true, + }, + { + source: '/intro/getting-started/provision', + destination: 'https://learn.hashicorp.com/packer/getting-started/provision', + permanent: true, + }, + { + source: '/intro/getting-started/parallel-builds', + destination: + 'https://learn.hashicorp.com/packer/getting-started/parallel-builds', + permanent: true, + }, + { + source: '/intro/getting-started/vagrant', + destination: 'https://learn.hashicorp.com/packer/getting-started/vagrant', + permanent: true, + }, + { + source: '/intro/getting-started/next', + destination: 'https://learn.hashicorp.com/packer/getting-started/next ', + permanent: true, + }, + { + source: '/docs/basics/terminology', + destination: '/docs/terminology', + permanent: true, + }, + { + source: '/docs/other/:path*', + destination: '/docs/:path*', + permanent: true, + }, + { + source: '/docs/configuration/from-1.5/:path*', + destination: '/docs/from-1.5/:path*', + permanent: true, + }, + { + source: '/docs/configuration/from-1.5/:path*/overview', + destination: '/docs/from-1.5/:path*', + permanent: true, + }, + { + source: '/docs/builders/amazon-:path*', + destination: '/docs/builders/amazon/:path*', + permanent: true, + }, + { + source: '/docs/builders/azure-:path*', + destination: '/docs/builders/azure/:path*', + permanent: true, + }, + { + source: '/docs/builders/hyperv-:path*', + destination: '/docs/builders/hyperv/:path*', + permanent: true, + }, + { + source: '/docs/builders/oracle-:path*', + destination: '/docs/builders/oracle/:path*', + permanent: true, + }, + { + source: '/docs/builders/osc-:path*', + destination: '/docs/builders/outscale/:path*', + permanent: true, + }, + { + source: '/docs/builders/parallels-:path*', + destination: '/docs/builders/parallels/:path*', + permanent: true, + }, + { + source: '/docs/builders/virtualbox-:path*', + destination: '/docs/builders/virtualbox/:path*', + permanent: true, + }, + { + source: '/docs/builders/vmware-:path*', + destination: '/docs/builders/vmware/:path*', + permanent: true, + }, + { + source: '/docs/builders/vsphere-:path*', + destination: '/docs/builders/vmware/vsphere-:path*', + permanent: true, + }, + // disallow '.html' or '/index.html' in favor of cleaner, simpler paths + { source: '/:path*/index', destination: '/:path*', permanent: true }, + { source: '/:path*.html', destination: '/:path*', permanent: true }, +] diff --git a/website/vercel.json b/website/vercel.json new file mode 100644 index 000000000..0e6117e60 --- /dev/null +++ b/website/vercel.json @@ -0,0 +1,7 @@ +{ + "version": 2, + "public": true, + "github": { + "silent": true + } +}