diff --git a/website/meta/dynamicMeta.js b/website/meta/dynamicMeta.js deleted file mode 100644 index da3031c13..000000000 --- a/website/meta/dynamicMeta.js +++ /dev/null @@ -1,11 +0,0 @@ -const site = require('./site.json') - -const domain = process.env.BRANCH || site.domain - -module.exports = { - domain, - siteUrl: `https://${domain}`, - nightly: site.nightlyBranches.includes(domain), - legacy: site.legacy || !!+process.env.SPACY_LEGACY, - binderBranch: domain, -} diff --git a/website/meta/dynamicMeta.mjs b/website/meta/dynamicMeta.mjs new file mode 100644 index 000000000..95fd3101c --- /dev/null +++ b/website/meta/dynamicMeta.mjs @@ -0,0 +1,14 @@ +import site from './site.json' assert { type: 'json' } + +export const domain = process.env.BRANCH || site.domain +export const siteUrl = `https://${domain}` +export const nightly = site.nightlyBranches.includes(domain) +export const legacy = site.legacy || !!+process.env.SPACY_LEGACY +export const binderBranch = domain +export const branch = nightly ? 'develop' : 'master' +export const replacements = { + GITHUB_SPACY: `https://github.com/explosion/spaCy/tree/${branch}`, + GITHUB_PROJECTS: `https://github.com/${site.projectsRepo}`, + SPACY_PKG_NAME: nightly ? 'spacy-nightly' : 'spacy', + SPACY_PKG_FLAGS: nightly ? ' --pre' : '', +} diff --git a/website/pages/index.tsx b/website/pages/index.tsx index ca579b75e..dba1868c3 100644 --- a/website/pages/index.tsx +++ b/website/pages/index.tsx @@ -26,7 +26,7 @@ import courseImage from '../public/images/course.jpg' import prodigyImage from '../public/images/prodigy_overview.jpg' import projectsImage from '../public/images/projects.png' import tailoredPipelinesImage from '../public/images/spacy-tailored-pipelines_wide.png' -import { nightly, legacy } from '../meta/dynamicMeta' +import { nightly, legacy } from '../meta/dynamicMeta.mjs' import Benchmarks from '../docs/usage/_benchmarks-models.mdx' diff --git a/website/src/components/code.js b/website/src/components/code.js index a1c328e85..d913295c6 100644 --- a/website/src/components/code.js +++ b/website/src/components/code.js @@ -20,7 +20,7 @@ import Link, { OptionalLink } from './link' import GitHubCode from './github' import classes from '../styles/code.module.sass' import siteMetadata from '../../meta/site.json' -import { binderBranch } from '../../meta/dynamicMeta' +import { binderBranch } from '../../meta/dynamicMeta.mjs' const WRAP_THRESHOLD = 30 const CLI_GROUPS = ['init', 'debug', 'project', 'ray', 'huggingface-hub'] diff --git a/website/src/components/util.js b/website/src/components/util.js index 9640477b8..17f33f86d 100644 --- a/website/src/components/util.js +++ b/website/src/components/util.js @@ -1,7 +1,7 @@ import React, { Fragment, useEffect, useState } from 'react' import { Parser as HtmlToReactParser } from 'html-to-react' import siteMetadata from '../../meta/site.json' -import { domain } from '../../meta/dynamicMeta' +import { domain } from '../../meta/dynamicMeta.mjs' import remarkPlugins from '../../plugins/index.mjs' import { serialize } from 'next-mdx-remote/serialize' import { MDXRemote } from 'next-mdx-remote' diff --git a/website/src/templates/docs.js b/website/src/templates/docs.js index 5d6819d99..01e75950e 100644 --- a/website/src/templates/docs.js +++ b/website/src/templates/docs.js @@ -15,7 +15,7 @@ import { getCurrentSource, github } from '../components/util' import siteMetadata from '../../meta/site.json' import sidebars from '../../meta/sidebars.json' import models from '../../meta/languages.json' -import { nightly, legacy } from '../../meta/dynamicMeta' +import { nightly, legacy } from '../../meta/dynamicMeta.mjs' const Docs = ({ pageContext, children }) => { const { diff --git a/website/src/templates/index.js b/website/src/templates/index.js index 982e8e5c1..0b04f3cb5 100644 --- a/website/src/templates/index.js +++ b/website/src/templates/index.js @@ -18,7 +18,7 @@ import Alert from '../components/alert' import Search from '../components/search' import siteMetadata from '../../meta/site.json' -import { nightly, legacy } from '../../meta/dynamicMeta' +import { nightly, legacy } from '../../meta/dynamicMeta.mjs' import { remarkComponents } from '../remark' const AlertSpace = ({ nightly, legacy }) => { diff --git a/website/src/templates/universe.js b/website/src/templates/universe.js index 0f3db4df7..719928dba 100644 --- a/website/src/templates/universe.js +++ b/website/src/templates/universe.js @@ -18,7 +18,7 @@ import { H3, H5, Label, InlineList } from '../components/typography' import { YouTube, SoundCloud, Iframe } from '../components/embed' import { github, MarkdownToReact } from '../components/util' -import { nightly, legacy } from '../../meta/dynamicMeta' +import { nightly, legacy } from '../../meta/dynamicMeta.mjs' import universe from '../../meta/universe.json' function filterResources(resources, data) {