Convert file to .mjs to be used by Node process

This commit is contained in:
Marcus Blättermann 2022-12-05 22:27:33 +01:00
parent 1ed59fd680
commit 9b17299bd6
No known key found for this signature in database
GPG Key ID: A1E1F04008AC450D
8 changed files with 20 additions and 17 deletions

View File

@ -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,
}

View File

@ -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' : '',
}

View File

@ -26,7 +26,7 @@ import courseImage from '../public/images/course.jpg'
import prodigyImage from '../public/images/prodigy_overview.jpg' import prodigyImage from '../public/images/prodigy_overview.jpg'
import projectsImage from '../public/images/projects.png' import projectsImage from '../public/images/projects.png'
import tailoredPipelinesImage from '../public/images/spacy-tailored-pipelines_wide.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' import Benchmarks from '../docs/usage/_benchmarks-models.mdx'

View File

@ -20,7 +20,7 @@ import Link, { OptionalLink } from './link'
import GitHubCode from './github' import GitHubCode from './github'
import classes from '../styles/code.module.sass' import classes from '../styles/code.module.sass'
import siteMetadata from '../../meta/site.json' import siteMetadata from '../../meta/site.json'
import { binderBranch } from '../../meta/dynamicMeta' import { binderBranch } from '../../meta/dynamicMeta.mjs'
const WRAP_THRESHOLD = 30 const WRAP_THRESHOLD = 30
const CLI_GROUPS = ['init', 'debug', 'project', 'ray', 'huggingface-hub'] const CLI_GROUPS = ['init', 'debug', 'project', 'ray', 'huggingface-hub']

View File

@ -1,7 +1,7 @@
import React, { Fragment, useEffect, useState } from 'react' import React, { Fragment, useEffect, useState } from 'react'
import { Parser as HtmlToReactParser } from 'html-to-react' import { Parser as HtmlToReactParser } from 'html-to-react'
import siteMetadata from '../../meta/site.json' import siteMetadata from '../../meta/site.json'
import { domain } from '../../meta/dynamicMeta' import { domain } from '../../meta/dynamicMeta.mjs'
import remarkPlugins from '../../plugins/index.mjs' import remarkPlugins from '../../plugins/index.mjs'
import { serialize } from 'next-mdx-remote/serialize' import { serialize } from 'next-mdx-remote/serialize'
import { MDXRemote } from 'next-mdx-remote' import { MDXRemote } from 'next-mdx-remote'

View File

@ -15,7 +15,7 @@ import { getCurrentSource, github } from '../components/util'
import siteMetadata from '../../meta/site.json' import siteMetadata from '../../meta/site.json'
import sidebars from '../../meta/sidebars.json' import sidebars from '../../meta/sidebars.json'
import models from '../../meta/languages.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 Docs = ({ pageContext, children }) => {
const { const {

View File

@ -18,7 +18,7 @@ import Alert from '../components/alert'
import Search from '../components/search' import Search from '../components/search'
import siteMetadata from '../../meta/site.json' import siteMetadata from '../../meta/site.json'
import { nightly, legacy } from '../../meta/dynamicMeta' import { nightly, legacy } from '../../meta/dynamicMeta.mjs'
import { remarkComponents } from '../remark' import { remarkComponents } from '../remark'
const AlertSpace = ({ nightly, legacy }) => { const AlertSpace = ({ nightly, legacy }) => {

View File

@ -18,7 +18,7 @@ import { H3, H5, Label, InlineList } from '../components/typography'
import { YouTube, SoundCloud, Iframe } from '../components/embed' import { YouTube, SoundCloud, Iframe } from '../components/embed'
import { github, MarkdownToReact } from '../components/util' 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' import universe from '../../meta/universe.json'
function filterResources(resources, data) { function filterResources(resources, data) {