chore(shared): Fix linter warnings in sites/shared
This commit is contained in:
parent
fef2edd13d
commit
c11a29e28a
16 changed files with 29 additions and 294 deletions
|
@ -18,13 +18,11 @@ import { ModalContext } from 'shared/context/modal-context.mjs'
|
||||||
// Components
|
// Components
|
||||||
import { Collapse, useCollapseButton } from 'shared/components/collapse.mjs'
|
import { Collapse, useCollapseButton } from 'shared/components/collapse.mjs'
|
||||||
import { BackToAccountButton, Choice } from './shared.mjs'
|
import { BackToAccountButton, Choice } from './shared.mjs'
|
||||||
import { WebLink } from 'shared/components/web-link.mjs'
|
|
||||||
import { PageLink } from 'shared/components/page-link.mjs'
|
import { PageLink } from 'shared/components/page-link.mjs'
|
||||||
import { ModalDesignPicker } from 'shared/components/modal/design-picker.mjs'
|
import { ModalDesignPicker } from 'shared/components/modal/design-picker.mjs'
|
||||||
import {
|
import {
|
||||||
FilterIcon,
|
FilterIcon,
|
||||||
ClearIcon,
|
ClearIcon,
|
||||||
CloseIcon,
|
|
||||||
PlusIcon,
|
PlusIcon,
|
||||||
OkIcon,
|
OkIcon,
|
||||||
NoIcon,
|
NoIcon,
|
||||||
|
@ -116,13 +114,6 @@ export const NewSet = ({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const Row = ({ title, children }) => (
|
|
||||||
<div className="flex flex-row flex-wrap items-center lg:gap-4 my-2 hover:bg-primary hover:bg-opacity-10 rounded-lg p-2">
|
|
||||||
<div className="w-24 text-left md:text-right block md:inline font-bold pr-4">{title}</div>
|
|
||||||
<div className="grow">{children}</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
|
|
||||||
const EditField = (props) => {
|
const EditField = (props) => {
|
||||||
if (props.field === 'name') return <EditName {...props} />
|
if (props.field === 'name') return <EditName {...props} />
|
||||||
if (props.field === 'notes') return <EditNotes {...props} />
|
if (props.field === 'notes') return <EditNotes {...props} />
|
||||||
|
@ -194,7 +185,6 @@ export const MeasieRow = (props) => {
|
||||||
const MeasieInput = ({ m, mset, backend, toast, refresh }) => {
|
const MeasieInput = ({ m, mset, backend, toast, refresh }) => {
|
||||||
const { t } = useTranslation(['measurements'])
|
const { t } = useTranslation(['measurements'])
|
||||||
//const title = t(`measurements:${m}`)
|
//const title = t(`measurements:${m}`)
|
||||||
const { startLoading, stopLoading } = useContext(LoadingContext)
|
|
||||||
|
|
||||||
const isDegree = isDegreeMeasurement(m)
|
const isDegree = isDegreeMeasurement(m)
|
||||||
const factor = isDegree ? 1 : mset.imperial ? 25.4 : 10
|
const factor = isDegree ? 1 : mset.imperial ? 25.4 : 10
|
||||||
|
@ -377,7 +367,7 @@ const EditImg = ({ t, mset, account, backend, toast, refresh, curated = false })
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const { getRootProps, getInputProps } = useDropzone({ onDrop })
|
const { getRootProps, getInputProps } = useDropzone({ onDrop })
|
||||||
const { loading, startLoading, stopLoading } = useContext(LoadingContext)
|
const { startLoading, stopLoading } = useContext(LoadingContext)
|
||||||
|
|
||||||
const update = async (evt) => {
|
const update = async (evt) => {
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
|
@ -386,18 +376,6 @@ const EditImg = ({ t, mset, account, backend, toast, refresh, curated = false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const save = async () => {
|
|
||||||
startLoading()
|
|
||||||
const result = curated
|
|
||||||
? await backend.updateCuratedSet(mset.id, { img })
|
|
||||||
: await backend.updateSet(mset.id, { img })
|
|
||||||
if (result.success) {
|
|
||||||
refresh()
|
|
||||||
toast.for.settingsSaved()
|
|
||||||
} else toast.for.backendError()
|
|
||||||
stopLoading()
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
|
@ -592,7 +570,7 @@ const EditUnits = ({ t, mset, account, backend, toast, refresh }) => {
|
||||||
|
|
||||||
const EditPublic = ({ t, mset, account, backend, toast, refresh }) => {
|
const EditPublic = ({ t, mset, account, backend, toast, refresh }) => {
|
||||||
const [selection, setSelection] = useState(mset.public)
|
const [selection, setSelection] = useState(mset.public)
|
||||||
const { loading, startLoading, stopLoading } = useContext(LoadingContext)
|
const { startLoading, stopLoading } = useContext(LoadingContext)
|
||||||
|
|
||||||
const update = async (val) => {
|
const update = async (val) => {
|
||||||
setSelection(val)
|
setSelection(val)
|
||||||
|
@ -770,13 +748,6 @@ const MeasurementsSet = ({ mset, t, account, backend, refresh }) => {
|
||||||
// Hooks
|
// Hooks
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
const fields = {
|
|
||||||
id: 'ID',
|
|
||||||
name: t('name'),
|
|
||||||
level: t('keyLevel'),
|
|
||||||
createdAt: t('created'),
|
|
||||||
}
|
|
||||||
|
|
||||||
const remove = async () => {
|
const remove = async () => {
|
||||||
startLoading()
|
startLoading()
|
||||||
const result = await backend.removeSet(mset.id)
|
const result = await backend.removeSet(mset.id)
|
||||||
|
|
|
@ -85,7 +85,9 @@ export const CuratedSetPicker = ({ design, language }) => {
|
||||||
<>
|
<>
|
||||||
<h3>{t('curatedSets')}</h3>
|
<h3>{t('curatedSets')}</h3>
|
||||||
{tags.map((tag) => (
|
{tags.map((tag) => (
|
||||||
<Tag onClick={() => addFilter(tag)}>{tag}</Tag>
|
<Tag onClick={() => addFilter(tag)} tag={tag}>
|
||||||
|
{tag}
|
||||||
|
</Tag>
|
||||||
))}
|
))}
|
||||||
<div className="my-2 p-2 px-4 border rounded-lg bg-secondary bg-opacity-10 max-w-xl">
|
<div className="my-2 p-2 px-4 border rounded-lg bg-secondary bg-opacity-10 max-w-xl">
|
||||||
<div className="flex flex-row items-center justify-between gap-2">
|
<div className="flex flex-row items-center justify-between gap-2">
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import Link from 'next/link'
|
//import Link from 'next/link'
|
||||||
import { useTranslation } from 'next-i18next'
|
//import { useTranslation } from 'next-i18next'
|
||||||
import { Difficulty } from 'shared/components/designs/difficulty.mjs'
|
//import { Difficulty } from 'shared/components/designs/difficulty.mjs'
|
||||||
import { designs } from 'shared/config/designs.mjs'
|
//import { designs } from 'shared/config/designs.mjs'
|
||||||
import { DesignTag } from 'shared/components/designs/tag.mjs'
|
//import { DesignTag } from 'shared/components/designs/tag.mjs'
|
||||||
|
|
||||||
export const ns = ['design', 'designs', 'tags']
|
export const ns = ['design', 'designs', 'tags']
|
||||||
|
|
||||||
export const Set = ({ name }) => {
|
export const Set = ({ name }) => {
|
||||||
const { t } = useTranslation(ns)
|
//const { t } = useTranslation(ns)
|
||||||
|
|
||||||
return <p>fixme</p>
|
return <p>fixme</p>
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -3,13 +3,9 @@ import { components as baseComponents } from 'shared/components/mdx/index.mjs'
|
||||||
// List of authors
|
// List of authors
|
||||||
import { authors as allAuthors } from 'config/authors.mjs'
|
import { authors as allAuthors } from 'config/authors.mjs'
|
||||||
import { docUpdates } from 'site/prebuild/doc-updates.mjs'
|
import { docUpdates } from 'site/prebuild/doc-updates.mjs'
|
||||||
// FreeSewing config
|
|
||||||
import { freeSewingConfig } from 'shared/config/freesewing.config.mjs'
|
|
||||||
// Components
|
// Components
|
||||||
import { PageLink } from 'shared/components/page-link.mjs'
|
import { PageLink } from 'shared/components/page-link.mjs'
|
||||||
import { WebLink } from 'shared/components/web-link.mjs'
|
|
||||||
import { DateTime, Interval } from 'luxon'
|
import { DateTime, Interval } from 'luxon'
|
||||||
import { DocsIcon } from 'shared/components/icons.mjs'
|
|
||||||
// Context
|
// Context
|
||||||
import { useContext } from 'react'
|
import { useContext } from 'react'
|
||||||
import { NavigationContext } from 'shared/context/navigation-context.mjs'
|
import { NavigationContext } from 'shared/context/navigation-context.mjs'
|
||||||
|
@ -116,8 +112,8 @@ export const MdxWrapper = ({ MDX, frontmatter = {}, components = {} }) => {
|
||||||
<div className="text-primary mdx max-w-prose text-base-content max-w-prose text-base">
|
<div className="text-primary mdx max-w-prose text-base-content max-w-prose text-base">
|
||||||
<MetaData
|
<MetaData
|
||||||
maintainers={frontmatter?.maintainers || []}
|
maintainers={frontmatter?.maintainers || []}
|
||||||
authors={updates?.authors || []}
|
authors={updates.authors || []}
|
||||||
lastUpdated={updates?.lastUpdates}
|
lastUpdated={updates.lastUpdates}
|
||||||
{...{ locale, slug, t }}
|
{...{ locale, slug, t }}
|
||||||
/>
|
/>
|
||||||
<MDX components={allComponents} />
|
<MDX components={allComponents} />
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { useState, useEffect, useContext } from 'react'
|
import { useState, useEffect, useContext } from 'react'
|
||||||
import { useSwipeable } from 'react-swipeable'
|
import { useSwipeable } from 'react-swipeable'
|
||||||
import { ModalMenu } from 'site/components/navigation/modal-menu.mjs'
|
|
||||||
import { ModalContext } from 'shared/context/modal-context.mjs'
|
import { ModalContext } from 'shared/context/modal-context.mjs'
|
||||||
|
|
||||||
const slideClasses = {
|
const slideClasses = {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import { SwipeWrapper } from 'shared/components/wrappers/swipes.mjs'
|
||||||
import { LayoutWrapper, ns as layoutNs } from 'site/components/wrappers/layout.mjs'
|
import { LayoutWrapper, ns as layoutNs } from 'site/components/wrappers/layout.mjs'
|
||||||
import { DocsLayout, ns as docsNs } from 'site/components/layouts/docs.mjs'
|
import { DocsLayout, ns as docsNs } from 'site/components/layouts/docs.mjs'
|
||||||
import { Feeds } from 'site/components/feeds.mjs'
|
import { Feeds } from 'site/components/feeds.mjs'
|
||||||
import { Spinner } from 'shared/components/spinner.mjs'
|
|
||||||
import { ModalContext } from 'shared/context/modal-context.mjs'
|
import { ModalContext } from 'shared/context/modal-context.mjs'
|
||||||
import { NavigationContext } from 'shared/context/navigation-context.mjs'
|
import { NavigationContext } from 'shared/context/navigation-context.mjs'
|
||||||
|
|
||||||
|
@ -43,7 +42,7 @@ export const PageWrapper = (props) => {
|
||||||
* Contexts
|
* Contexts
|
||||||
*/
|
*/
|
||||||
const { modalContent } = useContext(ModalContext)
|
const { modalContent } = useContext(ModalContext)
|
||||||
const { title, setNavigation } = useContext(NavigationContext)
|
const { setNavigation } = useContext(NavigationContext)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update navigation context with title and path
|
* Update navigation context with title and path
|
||||||
|
|
|
@ -2,11 +2,10 @@ import React, { useContext } from 'react'
|
||||||
import { useSwipeable } from 'react-swipeable'
|
import { useSwipeable } from 'react-swipeable'
|
||||||
import { useHotkeys } from 'react-hotkeys-hook'
|
import { useHotkeys } from 'react-hotkeys-hook'
|
||||||
import { ModalContext } from 'shared/context/modal-context.mjs'
|
import { ModalContext } from 'shared/context/modal-context.mjs'
|
||||||
import { ModalMenu } from 'site/components/navigation/modal-menu.mjs'
|
|
||||||
|
|
||||||
/* This component should wrap all swipeable content */
|
/* This component should wrap all swipeable content */
|
||||||
export const SwipeWrapper = ({ children, app }) => {
|
export const SwipeWrapper = ({ children, app }) => {
|
||||||
const { setModal, clearModal } = useContext(ModalContext) || {}
|
const { clearModal } = useContext(ModalContext) || {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Swipe handling for the entire site
|
* Swipe handling for the entire site
|
||||||
|
|
|
@ -1,198 +0,0 @@
|
||||||
import path from 'path'
|
|
||||||
import { designs, plugins } from '../../../config/software/index.mjs'
|
|
||||||
// Remark plugins we want to use
|
|
||||||
import remarkFrontmatter from 'remark-frontmatter'
|
|
||||||
import remarkGfm from 'remark-gfm'
|
|
||||||
import remarkCopyLinkedFiles from 'remark-copy-linked-files'
|
|
||||||
//import { remarkIntroPlugin } from './remark-intro-plugin.mjs'
|
|
||||||
//import mdxPluginToc from './mdx-plugin-toc.mjs'
|
|
||||||
import smartypants from 'remark-smartypants'
|
|
||||||
// Rehype plugins we want to use
|
|
||||||
import rehypeHighlight from 'rehype-highlight'
|
|
||||||
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
|
|
||||||
import rehypeSlug from 'rehype-slug'
|
|
||||||
import rehypeJargon from '../../../packages/rehype-jargon/src/index.mjs'
|
|
||||||
import rehypeHighlightLines from '../../../packages/rehype-highlight-lines/src/index.mjs'
|
|
||||||
// Webpack MDX loadder for NextJS
|
|
||||||
import mdxLoader from '@next/mdx'
|
|
||||||
|
|
||||||
const jargonTransform = (term, html) => `<details class="inline jargon-details">
|
|
||||||
<summary class="jargon-term">
|
|
||||||
${term}
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 jargon-close" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="4" d="M6 18L18 6M6 6l12 12" />
|
|
||||||
</svg>
|
|
||||||
</summary>
|
|
||||||
<div class="jargon-info">
|
|
||||||
${html}</div></details>`
|
|
||||||
|
|
||||||
const getMdxConfig = ({ site, jargon }) => ({
|
|
||||||
extension: /\.(md|mdx)$/,
|
|
||||||
options: {
|
|
||||||
providerImportSource: '@mdx-js/react',
|
|
||||||
remarkPlugins: [
|
|
||||||
remarkFrontmatter,
|
|
||||||
remarkGfm,
|
|
||||||
smartypants,
|
|
||||||
//[
|
|
||||||
// remarkCopyLinkedFiles,
|
|
||||||
// {
|
|
||||||
// destinationDir: path.resolve(`../${site}/public/mdx`),
|
|
||||||
// sourceDir: path.resolve(`../../markdown/${site}/${slug}`),
|
|
||||||
// staticPath: '/mdx/',
|
|
||||||
// },
|
|
||||||
//],
|
|
||||||
//[remarkIntroPlugin, { intro }],
|
|
||||||
],
|
|
||||||
rehypePlugins: [
|
|
||||||
[rehypeJargon, { jargon, transform: jargonTransform }],
|
|
||||||
[
|
|
||||||
rehypeHighlight,
|
|
||||||
{
|
|
||||||
plainText: ['dot', 'http'],
|
|
||||||
aliases: {
|
|
||||||
javascript: [
|
|
||||||
'design/src/index.mjs',
|
|
||||||
'design/src/part.mjs',
|
|
||||||
'design/src/bib.mjs',
|
|
||||||
'index.mjs',
|
|
||||||
'part.mjs',
|
|
||||||
'bib.mjs',
|
|
||||||
],
|
|
||||||
json: [
|
|
||||||
'200.json',
|
|
||||||
'201.json',
|
|
||||||
'204.json',
|
|
||||||
'400.json',
|
|
||||||
'401.json',
|
|
||||||
'403.json',
|
|
||||||
'404.json',
|
|
||||||
'500.json',
|
|
||||||
],
|
|
||||||
markdown: ['en.md'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
|
||||||
rehypeHighlightLines,
|
|
||||||
{
|
|
||||||
highlightClass: ['highlight-lines', 'border-l-4'],
|
|
||||||
strikeoutClass: [
|
|
||||||
'strikeout-lines',
|
|
||||||
'bg-orange-300',
|
|
||||||
'bg-opacity-5',
|
|
||||||
'border-l-4',
|
|
||||||
'opacity-80',
|
|
||||||
'line-through',
|
|
||||||
'decoration-orange-500',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
rehypeSlug,
|
|
||||||
[
|
|
||||||
rehypeAutolinkHeadings,
|
|
||||||
{
|
|
||||||
behavior: 'wrap',
|
|
||||||
properties: { className: 'heading-autolink' },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
],
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This mehthod will return the NextJS configuration
|
|
||||||
* Parameters:
|
|
||||||
*
|
|
||||||
* site: one of 'dev', 'org', or 'lab'
|
|
||||||
* remarkPlugins: Array of remark plugins to load
|
|
||||||
* srcPkgs: Array of folders in the monorepo/packages that should be aliased
|
|
||||||
* so they are loaded from source, rather than from a compiled bundle
|
|
||||||
*/
|
|
||||||
const config = (site, jargon = {}) => {
|
|
||||||
const mdxConfig = getMdxConfig({ site, jargon })
|
|
||||||
const withMdx = mdxLoader(mdxConfig)
|
|
||||||
console.log({ mdxConfig, withMdx })
|
|
||||||
|
|
||||||
return withMdx({
|
|
||||||
experimental: {
|
|
||||||
externalDir: true,
|
|
||||||
},
|
|
||||||
pageExtensions: ['mjs'],
|
|
||||||
webpack: (config, options) => {
|
|
||||||
// Fixes npm packages that depend on node modules
|
|
||||||
if (!options.isServer) {
|
|
||||||
config.resolve.fallback.fs = false
|
|
||||||
config.resolve.fallback.path = false
|
|
||||||
config.resolve.fallback.child_process = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// MDX support
|
|
||||||
//config.module.rules.push({
|
|
||||||
// test: /\.md?$/,
|
|
||||||
// use: [
|
|
||||||
// options.defaultLoaders.babel,
|
|
||||||
// {
|
|
||||||
// loader: '@mdx-js/loader',
|
|
||||||
// //providerImportSource: '@mdx-js/react',
|
|
||||||
// options: {
|
|
||||||
// remarkPlugins: [remarkGfm, ...remarkPlugins],
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
//})
|
|
||||||
|
|
||||||
// YAML support
|
|
||||||
config.module.rules.push({
|
|
||||||
test: /\.ya?ml$/,
|
|
||||||
use: 'yaml-loader',
|
|
||||||
})
|
|
||||||
|
|
||||||
// Fix for nextjs bug #17806
|
|
||||||
config.module.rules.push({
|
|
||||||
test: /index.mjs$/,
|
|
||||||
type: 'javascript/auto',
|
|
||||||
resolve: {
|
|
||||||
fullySpecified: false,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// Suppress warnings about importing version from package.json
|
|
||||||
// We'll deal with it in v3 of FreeSewing
|
|
||||||
config.ignoreWarnings = [/only default export is available soon/]
|
|
||||||
|
|
||||||
// Aliases
|
|
||||||
config.resolve.alias.shared = path.resolve('../shared/')
|
|
||||||
config.resolve.alias.site = path.resolve(`../${site}/`)
|
|
||||||
config.resolve.alias.markdown = path.resolve(`../../markdown/${site}/`)
|
|
||||||
config.resolve.alias.config = path.resolve('../../config/')
|
|
||||||
config.resolve.alias.designs = path.resolve('../../designs/')
|
|
||||||
config.resolve.alias.plugins = path.resolve('../../plugins/')
|
|
||||||
config.resolve.alias.pkgs = path.resolve('../../packages/')
|
|
||||||
config.resolve.alias.root = path.resolve('../../')
|
|
||||||
|
|
||||||
// Load designs from source, rather than compiled package
|
|
||||||
for (const design in designs) {
|
|
||||||
config.resolve.alias[`@freesewing/${design}`] = path.resolve(
|
|
||||||
`../../designs/${design}/src/index.mjs`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// Load plugins from source, rather than compiled package
|
|
||||||
for (const plugin in plugins) {
|
|
||||||
config.resolve.alias[`@freesewing/${plugin}`] = path.resolve(
|
|
||||||
`../../plugins/${plugin}/src/index.mjs`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// Load these from source, rather than compiled package
|
|
||||||
for (const pkg of ['core', 'i18n', 'models', 'snapseries']) {
|
|
||||||
config.resolve.alias[`@freesewing/${pkg}`] = path.resolve(
|
|
||||||
`../../packages/${pkg}/src/index.mjs`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
return config
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default config
|
|
|
@ -15,7 +15,7 @@ import rehypeSlug from 'rehype-slug'
|
||||||
import rehypeJargon from '../../../packages/rehype-jargon/src/index.mjs'
|
import rehypeJargon from '../../../packages/rehype-jargon/src/index.mjs'
|
||||||
import rehypeHighlightLines from '../../../packages/rehype-highlight-lines/src/index.mjs'
|
import rehypeHighlightLines from '../../../packages/rehype-highlight-lines/src/index.mjs'
|
||||||
// Webpack MDX loadder for NextJS
|
// Webpack MDX loadder for NextJS
|
||||||
import mdxLoader from '@next/mdx'
|
//import mdxLoader from '@next/mdx'
|
||||||
|
|
||||||
const jargonTransform = (term, html) => `<details class="inline jargon-details">
|
const jargonTransform = (term, html) => `<details class="inline jargon-details">
|
||||||
<summary class="jargon-term">
|
<summary class="jargon-term">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState, useContext } from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
||||||
export const ModalContext = React.createContext(null)
|
export const ModalContext = React.createContext(null)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import process from 'process'
|
|
||||||
import { freeSewingConfig } from 'shared/config/freesewing.config.mjs'
|
import { freeSewingConfig } from 'shared/config/freesewing.config.mjs'
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
import { useEffect, useContext } from 'react'
|
|
||||||
import { NavigationContext } from 'shared/context/navigation-context.mjs'
|
|
||||||
|
|
||||||
export const useNavigation = ({ page }) => {
|
|
||||||
const all = useContext(NavigationContext)
|
|
||||||
|
|
||||||
useEffect(() => {}, [page.path, page.t])
|
|
||||||
|
|
||||||
return {
|
|
||||||
title: page.t,
|
|
||||||
slug: page.s,
|
|
||||||
order: page.o,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
// We need fs and path to read from disk
|
/*// We need fs and path to read from disk
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
|
@ -20,16 +20,6 @@ import rehypeJargon from 'pkgs/rehype-jargon/src/index.mjs'
|
||||||
import rehypeHighlightLines from 'pkgs/rehype-highlight-lines/src/index.mjs'
|
import rehypeHighlightLines from 'pkgs/rehype-highlight-lines/src/index.mjs'
|
||||||
// Simple frontmatter extractor
|
// Simple frontmatter extractor
|
||||||
import frontmatter from 'front-matter'
|
import frontmatter from 'front-matter'
|
||||||
/*
|
|
||||||
* Summary: Loads markdown from disk and compiles it as MDX.
|
|
||||||
*
|
|
||||||
* @param (string) language - language to load (eg: 'en')
|
|
||||||
* @param (string) site - site to load (either 'dev' or 'org')
|
|
||||||
* @param (string) slug - slug of the page (eg: 'guides/patterns')
|
|
||||||
*
|
|
||||||
* @link https://mdxjs.com/guides/mdx-on-demand/
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const jargonTransform = (term, html) => `<details class="inline jargon-details">
|
const jargonTransform = (term, html) => `<details class="inline jargon-details">
|
||||||
<summary class="jargon-term">
|
<summary class="jargon-term">
|
||||||
|
@ -150,5 +140,5 @@ export const mdxLoader = async (language, site, slug, jargon) => {
|
||||||
)
|
)
|
||||||
|
|
||||||
return { mdx, intro, toc, frontmatter: frontmatter(md)?.attributes }
|
return { mdx, intro, toc, frontmatter: frontmatter(md)?.attributes }
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -2,7 +2,6 @@ import execa from 'execa'
|
||||||
import { gitToAuthor, authors as authorInfo } from '../../../config/authors.mjs'
|
import { gitToAuthor, authors as authorInfo } from '../../../config/authors.mjs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import rdir from 'recursive-readdir'
|
|
||||||
import { getMdxFileList, fileToSlug } from './docs.mjs'
|
import { getMdxFileList, fileToSlug } from './docs.mjs'
|
||||||
|
|
||||||
const divider = '____'
|
const divider = '____'
|
||||||
|
|
|
@ -14,7 +14,6 @@ const run = async () => {
|
||||||
if (linter) return true
|
if (linter) return true
|
||||||
const SITE = process.env.SITE || 'lab'
|
const SITE = process.env.SITE || 'lab'
|
||||||
prebuildDesigns()
|
prebuildDesigns()
|
||||||
let docPages
|
|
||||||
if (['org', 'dev'].includes(SITE)) {
|
if (['org', 'dev'].includes(SITE)) {
|
||||||
await prebuildGitData(SITE)
|
await prebuildGitData(SITE)
|
||||||
const docPages = await prebuildDocs(SITE)
|
const docPages = await prebuildDocs(SITE)
|
||||||
|
|
|
@ -1,20 +1,14 @@
|
||||||
import fs_ from 'fs'
|
import { prebuildOrg } from './org.mjs'
|
||||||
import path from 'path'
|
|
||||||
import { capitalize } from '../utils.mjs'
|
|
||||||
import { plugins, designs } from '../../../config/software/index.mjs'
|
|
||||||
import { header, prebuildOrg } from './org.mjs'
|
|
||||||
|
|
||||||
const fs = fs_.promises
|
//const copyFromOrg = [
|
||||||
|
// 'pages/account',
|
||||||
const copyFromOrg = [
|
// 'pages/confirm',
|
||||||
'pages/account',
|
// 'pages/designs',
|
||||||
'pages/confirm',
|
// 'pages/new',
|
||||||
'pages/designs',
|
// 'pages/signin',
|
||||||
'pages/new',
|
// 'pages/signup',
|
||||||
'pages/signin',
|
// 'pages/welcome',
|
||||||
'pages/signup',
|
//]
|
||||||
'pages/welcome',
|
|
||||||
]
|
|
||||||
|
|
||||||
export const prebuildLab = async () => {
|
export const prebuildLab = async () => {
|
||||||
await prebuildOrg('lab')
|
await prebuildOrg('lab')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue