2020-05-29 17:12:05 -04:00
|
|
|
import VERSION from 'data/version.js'
|
2020-03-18 18:46:47 -04:00
|
|
|
import ProductDownloader from '@hashicorp/react-product-downloader'
|
|
|
|
import Head from 'next/head'
|
|
|
|
import HashiHead from '@hashicorp/react-head'
|
|
|
|
|
2020-06-12 06:08:23 -04:00
|
|
|
export default function DownloadsPage({ releaseData }) {
|
2020-03-18 18:46:47 -04:00
|
|
|
return (
|
|
|
|
<div id="p-downloads" className="g-container">
|
|
|
|
<HashiHead is={Head} title="Downloads | Packer by HashiCorp" />
|
|
|
|
<ProductDownloader
|
|
|
|
product="Packer"
|
|
|
|
version={VERSION}
|
2020-06-12 06:08:23 -04:00
|
|
|
releaseData={releaseData}
|
2020-03-18 18:46:47 -04:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function getStaticProps() {
|
|
|
|
return fetch(`https://releases.hashicorp.com/packer/${VERSION}/index.json`)
|
2020-06-12 06:08:23 -04:00
|
|
|
.then((res) => res.json())
|
|
|
|
.then((releaseData) => ({ props: { releaseData } }))
|
2020-03-18 18:46:47 -04:00
|
|
|
.catch(() => {
|
|
|
|
throw new Error(
|
|
|
|
`--------------------------------------------------------
|
|
|
|
Unable to resolve version ${VERSION} on releases.hashicorp.com from link
|
|
|
|
<https://releases.hashicorp.com/packer/${VERSION}/index.json>. Usually this
|
|
|
|
means that the specified version has not yet been released. The downloads page
|
|
|
|
version can only be updated after the new version has been released, to ensure
|
|
|
|
that it works for all users.
|
|
|
|
----------------------------------------------------------`
|
|
|
|
)
|
|
|
|
})
|
|
|
|
}
|