1
0
Fork 0

chore: Fixed linter warnings

This commit is contained in:
Joost De Cock 2022-01-20 09:07:38 +01:00
parent 56df5d5287
commit 2234155052
70 changed files with 103 additions and 309 deletions

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -15,7 +15,6 @@ export default function (part) {
utils, utils,
units, units,
measurements, measurements,
scale,
} = part.shorthand() } = part.shorthand()
// Lower back neck a bit // Lower back neck a bit

View file

@ -55,8 +55,6 @@
"@freesewing/i18n": "latest", "@freesewing/i18n": "latest",
"axios": "0.18.0", "axios": "0.18.0",
"body-parser": "1.18.3", "body-parser": "1.18.3",
"buffer-to-stream": "^1.0.0",
"buffer-to-uint8array": "^1.1.0",
"chai": "^4.3.4", "chai": "^4.3.4",
"chai-http": "^4.3.0", "chai-http": "^4.3.0",
"chalk": "2.4.1", "chalk": "2.4.1",

View file

@ -1,5 +1,5 @@
import config from "../config"; import config from "../config";
import { capitalize, log } from "../utils"; import { capitalize } from "../utils";
import sharp from 'sharp'; import sharp from 'sharp';
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
@ -72,7 +72,7 @@ const loadMarkdownFile = async (page, site, lang) => fs.promises.readFile(
'utf-8' 'utf-8'
).then(async (md) => md ).then(async (md) => md
? { ? {
...((await titleAndIntroFromLocalMarkdown(md, page))), ...(await titleAndIntroFromLocalMarkdown(md, page)),
sub: [ sub: [
'freesewing.dev/', 'freesewing.dev/',
page page
@ -122,7 +122,6 @@ const introAsLines = intro => {
// Get title and intro // Get title and intro
const getMetaData = { const getMetaData = {
dev: async (page) => { dev: async (page) => {
const data = {}
const chunks = page.split('/') const chunks = page.split('/')
// Home page // Home page
if (chunks.length === 1 && chunks[0] === '') return { if (chunks.length === 1 && chunks[0] === '') return {

View file

@ -3,14 +3,6 @@ import config from '../config'
import asBuffer from 'data-uri-to-buffer' import asBuffer from 'data-uri-to-buffer'
import FormData from 'form-data' import FormData from 'form-data'
import fs from 'fs' import fs from 'fs'
import toFile from 'data-uri-to-file'
import toStream from 'buffer-to-stream'
import tou8 from 'buffer-to-uint8array'
const auth = {
identifier: config.strapi.username,
password: config.strapi.password,
}
const getToken = async () => { const getToken = async () => {
let result let result
@ -66,7 +58,6 @@ const uploadPicture = async (img, name, token) => {
// I hate you strapi, because this hack is the only way I can get your shitty upload to work // I hate you strapi, because this hack is the only way I can get your shitty upload to work
const filename = `${config.strapi.tmp}/viaBackend.${extention}` const filename = `${config.strapi.tmp}/viaBackend.${extention}`
const onDisk = await fs.promises.writeFile(filename, asBuffer(img))
const file = fs.createReadStream(filename) const file = fs.createReadStream(filename)
form.append('files', file) form.append('files', file)
form.append('fileInfo', JSON.stringify({ form.append('fileInfo', JSON.stringify({

View file

@ -22,7 +22,7 @@ const loadTemplate = (type, format, language='en') => {
} }
const replace = (text, from, to) => { const replace = (text, from, to) => {
for (let id in from) text = text.split(from[id]).join(to[id] || from[id]) for (const id in from) text = text.split(from[id]).join(to[id] || from[id])
return text return text
} }

View file

@ -61,7 +61,6 @@ export default function Pattern(config = { options: {} }) {
scale: 1, scale: 1,
layout: true, layout: true,
debug: true, debug: true,
scale: 1,
options: {}, options: {},
absoluteOptions: {}, absoluteOptions: {},
} }

View file

@ -1,5 +1,5 @@
const draftPluginBanner = (part) => { const draftPluginBanner = (part) => {
const { points, Point, paths, Path, macro, options } = part.shorthand() const { points, Point, paths, Path, macro } = part.shorthand()
points.from = new Point(0, 0) points.from = new Point(0, 0)
points.to = new Point(320, 0) points.to = new Point(320, 0)

View file

@ -22,21 +22,20 @@ const Header = ({ app, setSearch }) => {
const [prevScrollPos, setPrevScrollPos] = useState(0) const [prevScrollPos, setPrevScrollPos] = useState(0)
const [show, setShow] = useState(true) const [show, setShow] = useState(true)
const handleScroll = () => {
const curScrollPos = (typeof window !== 'undefined') ? window.pageYOffset : 0
if (curScrollPos >= prevScrollPos) {
if (show && curScrollPos > 20) setShow(false)
}
else setShow(true)
setPrevScrollPos(curScrollPos)
}
useEffect(() => { useEffect(() => {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
const handleScroll = () => {
const curScrollPos = (typeof window !== 'undefined') ? window.pageYOffset : 0
if (curScrollPos >= prevScrollPos) {
if (show && curScrollPos > 20) setShow(false)
}
else setShow(true)
setPrevScrollPos(curScrollPos)
}
window.addEventListener('scroll', handleScroll) window.addEventListener('scroll', handleScroll)
return () => window.removeEventListener('scroll', handleScroll) return () => window.removeEventListener('scroll', handleScroll)
} }
}, [prevScrollPos, show, handleScroll]) }, [prevScrollPos, show])
return ( return (

View file

@ -1,4 +1,4 @@
import { useState, useRef, useEffect } from 'react' import { useState, useRef } from 'react'
import Link from 'next/link' import Link from 'next/link'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
@ -63,7 +63,7 @@ const Hit = props => (
<Link href={props.hit.page}> <Link href={props.hit.page}>
<a href={props.hit.page} className="flex flex-row justify-between gap-2"> <a href={props.hit.page} className="flex flex-row justify-between gap-2">
<span className="text-base sm:text-xl font-bold leading-5"> <span className="text-base sm:text-xl font-bold leading-5">
{props.hit?._highlightResult?.title {props.hit._highlightResult?.title
? <CustomHighlight hit={props.hit} attribute='title' /> ? <CustomHighlight hit={props.hit} attribute='title' />
: props.hit.title : props.hit.title
} }
@ -71,7 +71,7 @@ const Hit = props => (
<span className="text-xs pt-0.5 sm:text-base sm:pt-1 font-bold uppercase">{props.hit.page.split('/')[1]}</span> <span className="text-xs pt-0.5 sm:text-base sm:pt-1 font-bold uppercase">{props.hit.page.split('/')[1]}</span>
</a> </a>
</Link> </Link>
{props.hit?._snippetResult?.body && ( {props.hit._snippetResult?.body && (
<Link href={props.hit.page}> <Link href={props.hit.page}>
<a href={props.hit.page} className="text-sm sm:text-base block py-1"> <a href={props.hit.page} className="text-sm sm:text-base block py-1">
<CustomHighlight hit={props.hit} attribute='body' snippet /> <CustomHighlight hit={props.hit} attribute='body' snippet />
@ -89,14 +89,13 @@ const Hit = props => (
) )
// We use this for trapping ctrl-c // We use this for trapping ctrl-c
let prev
const handleInputKeydown = (evt, setSearch, setActive, active, router) => { const handleInputKeydown = (evt, setSearch, setActive, active, router) => {
if (evt.key === 'Escape') setSearch(false) if (evt.key === 'Escape') setSearch(false)
if (evt.key === 'ArrowDown') setActive(act => act + 1) if (evt.key === 'ArrowDown') setActive(act => act + 1)
if (evt.key === 'ArrowUp') setActive(act => act - 1) if (evt.key === 'ArrowUp') setActive(act => act - 1)
if (evt.key === 'Enter') { if (evt.key === 'Enter') {
// Trigger navigation // Trigger navigation
if (evt?.target?.dataset?.links) { if (evt.target?.dataset?.links) {
router.push(JSON.parse(evt.target.dataset.links)[active]) router.push(JSON.parse(evt.target.dataset.links)[active])
setSearch(false) setSearch(false)
} }
@ -112,7 +111,7 @@ const SearchBox = props => {
}) })
if (input.current && props.active < 0) input.current.focus() if (input.current && props.active < 0) input.current.focus()
const { currentRefinement, isSearchStalled, refine, setSearch, setActive } = props const { currentRefinement, refine, setSearch, setActive } = props
return ( return (
<div className="py-8"> <div className="py-8">

View file

@ -27,14 +27,11 @@ function useApp(full = true) {
// State methods // State methods
const togglePrimaryMenu = () => setPrimaryMenu(!primaryMenu) const togglePrimaryMenu = () => setPrimaryMenu(!primaryMenu)
const openPrimaryMenu = () => setPrimaryMenu(true)
const closePrimaryMenu = () => setPrimaryMenu(false)
/* /*
* Hot-update navigation method * Hot-update navigation method
*/ */
const updateNavigation = (path, content) => { const updateNavigation = (path, content) => {
const newNavigation = {...navigation}
if (typeof path === 'string') { if (typeof path === 'string') {
path = (path.slice(0,1) === '/') path = (path.slice(0,1) === '/')
? path.slice(1).split('/') ? path.slice(1).split('/')
@ -43,28 +40,6 @@ function useApp(full = true) {
setNavigation(set(navigation, path, content)) setNavigation(set(navigation, path, content))
} }
/*
* Translation method
*
* Note that freesewing.dev is only available in English
* however we use certain shared code/components between
* freesewing.dev and freesewing.org, so we still need
* a translation method
*/
const t = (key=false, vals=false) => {
if (!key) return ''
if (!en.strings[key]) return key
let val = en.strings[key]
if (vals) {
for (const [search, replace] of Object.entries(vals)) {
val = val.replace(/search/g, replace)
}
}
return val
}
return { return {
// Static vars // Static vars
site: 'dev', site: 'dev',
@ -90,9 +65,7 @@ function useApp(full = true) {
// State handlers // State handlers
togglePrimaryMenu, togglePrimaryMenu,
} }
} }
export default useApp export default useApp

View file

@ -1,10 +0,0 @@
import path from 'path'
const useMdx = (slug=false) => {
if (!slug) null
const file = ['markdown', 'dev', ...slug.split('/'), 'en.md'].join('/')
const mdx = require(file)
return <p>{file}</p>
}
export default useMdx

View file

@ -74,7 +74,7 @@ const PostPage = ({ post, author }) => {
href="#author" href="#author"
className="text-secondary hover:text-secondary-focus" className="text-secondary hover:text-secondary-focus"
> >
{author?.displayname || 'FIXME: No displayname'} {author.displayname || 'FIXME: No displayname'}
</a> </a>
</span> </span>
</div> </div>
@ -99,17 +99,6 @@ const PostPage = ({ post, author }) => {
</article> </article>
</Page> </Page>
) )
return (
<Page app={app} title='Blog' slug='blog'>
<article className="mb-12">
<div className="strapi prose lg:prose-lg mb-12 m-auto">
<MdxWrapper mdx={props.post.mdx} />
</div>
</article>
<Author author={author} type={props.type} t={props.t}/>
</Page>
)
} }
export const getStaticProps = async (props) => { export const getStaticProps = async (props) => {

View file

@ -1,6 +1,5 @@
import Page from 'shared/components/wrappers/page.js' import Page from 'shared/components/wrappers/page.js'
import useApp from 'site/hooks/useApp.js' import useApp from 'site/hooks/useApp.js'
import Logo from 'shared/components/logos/freesewing.js'
import Head from 'next/head' import Head from 'next/head'
import HelpUs from 'site/components/help-us.js' import HelpUs from 'site/components/help-us.js'
import Link from 'next/link' import Link from 'next/link'

View file

@ -22,21 +22,20 @@ const Header = ({ app, setSearch }) => {
const [prevScrollPos, setPrevScrollPos] = useState(0) const [prevScrollPos, setPrevScrollPos] = useState(0)
const [show, setShow] = useState(true) const [show, setShow] = useState(true)
const handleScroll = () => {
const curScrollPos = (typeof window !== 'undefined') ? window.pageYOffset : 0
if (curScrollPos >= prevScrollPos) {
if (show && curScrollPos > 20) setShow(false)
}
else setShow(true)
setPrevScrollPos(curScrollPos)
}
useEffect(() => { useEffect(() => {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
const handleScroll = () => {
const curScrollPos = (typeof window !== 'undefined') ? window.pageYOffset : 0
if (curScrollPos >= prevScrollPos) {
if (show && curScrollPos > 20) setShow(false)
}
else setShow(true)
setPrevScrollPos(curScrollPos)
}
window.addEventListener('scroll', handleScroll) window.addEventListener('scroll', handleScroll)
return () => window.removeEventListener('scroll', handleScroll) return () => window.removeEventListener('scroll', handleScroll)
} }
}, [prevScrollPos, show, handleScroll]) }, [prevScrollPos, show])
return ( return (

View file

@ -1,4 +1,4 @@
import { useState, useRef, useEffect } from 'react' import { useState, useRef } from 'react'
import Link from 'next/link' import Link from 'next/link'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
@ -63,7 +63,7 @@ const Hit = props => (
<Link href={props.hit.page}> <Link href={props.hit.page}>
<a href={props.hit.page} className="flex flex-row justify-between gap-2"> <a href={props.hit.page} className="flex flex-row justify-between gap-2">
<span className="text-base sm:text-xl font-bold leading-5"> <span className="text-base sm:text-xl font-bold leading-5">
{props.hit?._highlightResult?.title {props.hit._highlightResult?.title
? <CustomHighlight hit={props.hit} attribute='title' /> ? <CustomHighlight hit={props.hit} attribute='title' />
: props.hit.title : props.hit.title
} }
@ -71,7 +71,7 @@ const Hit = props => (
<span className="text-xs pt-0.5 sm:text-base sm:pt-1 font-bold uppercase">{props.hit.page.split('/')[1]}</span> <span className="text-xs pt-0.5 sm:text-base sm:pt-1 font-bold uppercase">{props.hit.page.split('/')[1]}</span>
</a> </a>
</Link> </Link>
{props.hit?._snippetResult?.body && ( {props.hit._snippetResult?.body && (
<Link href={props.hit.page}> <Link href={props.hit.page}>
<a href={props.hit.page} className="text-sm sm:text-base block py-1"> <a href={props.hit.page} className="text-sm sm:text-base block py-1">
<CustomHighlight hit={props.hit} attribute='body' snippet /> <CustomHighlight hit={props.hit} attribute='body' snippet />
@ -89,14 +89,13 @@ const Hit = props => (
) )
// We use this for trapping ctrl-c // We use this for trapping ctrl-c
let prev
const handleInputKeydown = (evt, setSearch, setActive, active, router) => { const handleInputKeydown = (evt, setSearch, setActive, active, router) => {
if (evt.key === 'Escape') setSearch(false) if (evt.key === 'Escape') setSearch(false)
if (evt.key === 'ArrowDown') setActive(act => act + 1) if (evt.key === 'ArrowDown') setActive(act => act + 1)
if (evt.key === 'ArrowUp') setActive(act => act - 1) if (evt.key === 'ArrowUp') setActive(act => act - 1)
if (evt.key === 'Enter') { if (evt.key === 'Enter') {
// Trigger navigation // Trigger navigation
if (evt?.target?.dataset?.links) { if (evt.target?.dataset?.links) {
router.push(JSON.parse(evt.target.dataset.links)[active]) router.push(JSON.parse(evt.target.dataset.links)[active])
setSearch(false) setSearch(false)
} }
@ -112,7 +111,7 @@ const SearchBox = props => {
}) })
if (input.current && props.active < 0) input.current.focus() if (input.current && props.active < 0) input.current.focus()
const { currentRefinement, isSearchStalled, refine, setSearch, setActive } = props const { currentRefinement, refine, setSearch, setActive } = props
return ( return (
<div className="py-8"> <div className="py-8">

View file

@ -27,14 +27,11 @@ function useApp(full = true) {
// State methods // State methods
const togglePrimaryMenu = () => setPrimaryMenu(!primaryMenu) const togglePrimaryMenu = () => setPrimaryMenu(!primaryMenu)
const openPrimaryMenu = () => setPrimaryMenu(true)
const closePrimaryMenu = () => setPrimaryMenu(false)
/* /*
* Hot-update navigation method * Hot-update navigation method
*/ */
const updateNavigation = (path, content) => { const updateNavigation = (path, content) => {
const newNavigation = {...navigation}
if (typeof path === 'string') { if (typeof path === 'string') {
path = (path.slice(0,1) === '/') path = (path.slice(0,1) === '/')
? path.slice(1).split('/') ? path.slice(1).split('/')
@ -43,28 +40,6 @@ function useApp(full = true) {
setNavigation(set(navigation, path, content)) setNavigation(set(navigation, path, content))
} }
/*
* Translation method
*
* Note that freesewing.dev is only available in English
* however we use certain shared code/components between
* freesewing.dev and freesewing.org, so we still need
* a translation method
*/
const t = (key=false, vals=false) => {
if (!key) return ''
if (!en.strings[key]) return key
let val = en.strings[key]
if (vals) {
for (const [search, replace] of Object.entries(vals)) {
val = val.replace(/search/g, replace)
}
}
return val
}
return { return {
// Static vars // Static vars
site: 'dev', site: 'dev',
@ -90,9 +65,7 @@ function useApp(full = true) {
// State handlers // State handlers
togglePrimaryMenu, togglePrimaryMenu,
} }
} }
export default useApp export default useApp

View file

@ -1,10 +0,0 @@
import path from 'path'
const useMdx = (slug=false) => {
if (!slug) null
const file = ['markdown', 'dev', ...slug.split('/'), 'en.md'].join('/')
const mdx = require(file)
return <p>{file}</p>
}
export default useMdx

View file

@ -33,7 +33,7 @@ const MdxPage = props => {
<meta property="og:image:height" content="630" /> <meta property="og:image:height" content="630" />
<meta property="og:url" content={`https://freesewing.org/${props.page.slug}`} key='url' /> <meta property="og:url" content={`https://freesewing.org/${props.page.slug}`} key='url' />
<meta property="og:locale" content="en_US" key='locale' /> <meta property="og:locale" content="en_US" key='locale' />
<meta property="og:site_name" content="freesewing.org key='site' /> <meta property="og:site_name" content="freesewing.org" key='site' />
</Head> </Head>
<MdxWrapper mdx={props.mdx} app={app}/> <MdxWrapper mdx={props.mdx} app={app}/>
<HelpUs mdx slug={`/${props.page.slug}`} /> <HelpUs mdx slug={`/${props.page.slug}`} />

View file

@ -74,7 +74,7 @@ const PostPage = ({ post, author }) => {
href="#author" href="#author"
className="text-secondary hover:text-secondary-focus" className="text-secondary hover:text-secondary-focus"
> >
{author?.displayname || 'FIXME: No displayname'} {author.displayname || 'FIXME: No displayname'}
</a> </a>
</span> </span>
</div> </div>
@ -99,17 +99,6 @@ const PostPage = ({ post, author }) => {
</article> </article>
</Page> </Page>
) )
return (
<Page app={app} title='Blog' slug='blog'>
<article className="mb-12">
<div className="strapi prose lg:prose-lg mb-12 m-auto">
<MdxWrapper mdx={props.post.mdx} />
</div>
</article>
<Author author={author} type={props.type} t={props.t}/>
</Page>
)
} }
export const getStaticProps = async (props) => { export const getStaticProps = async (props) => {

View file

@ -1,9 +1,7 @@
import Page from 'shared/components/wrappers/page.js' import Page from 'shared/components/wrappers/page.js'
import useApp from 'site/hooks/useApp.js' import useApp from 'site/hooks/useApp.js'
import Logo from 'shared/components/logos/freesewing.js'
import Head from 'next/head' import Head from 'next/head'
import HelpUs from 'site/components/help-us.js' import HelpUs from 'site/components/help-us.js'
import Link from 'next/link'
const HomePage = (props) => { const HomePage = (props) => {
const app = useApp() const app = useApp()

View file

@ -1,5 +1,5 @@
import ReactDOMServer from 'react-dom/server' import ReactDOMServer from 'react-dom/server'
import { useState, useEffect } from 'react' import { useState } from 'react'
import CopyIcon from 'shared/components/icons/copy.js' import CopyIcon from 'shared/components/icons/copy.js'
import {CopyToClipboard} from 'react-copy-to-clipboard' import {CopyToClipboard} from 'react-copy-to-clipboard'

View file

@ -5,4 +5,4 @@ const Heart = () => (
</svg> </svg>
) )
export const Heart export default Heart

View file

@ -1,3 +1,4 @@
import React from 'react'
import { useState } from 'react' import { useState } from 'react'
import { useRouter } from 'next/router' import { useRouter } from 'next/router'
import Link from 'next/link' import Link from 'next/link'
@ -10,8 +11,6 @@ import Header from 'site/components/header'
import Footer from 'site/components/footer' import Footer from 'site/components/footer'
import Search from 'site/components/search' import Search from 'site/components/search'
const iconSize= 48
const PageTitle = ({ app, slug, title }) => { const PageTitle = ({ app, slug, title }) => {
if (title) return <h1>{title}</h1> if (title) return <h1>{title}</h1>
if (slug) return <h1>{get(app.navigation, slug.split('/')).__title}</h1> if (slug) return <h1>{get(app.navigation, slug.split('/')).__title}</h1>
@ -39,7 +38,7 @@ const Breadcrumbs = ({ app, slug=false, title }) => {
</Link> </Link>
</li> </li>
{crumbs.map(crumb => ( {crumbs.map(crumb => (
<> <React.Fragment key={crumb[1]}>
<li className="text-base-content">&raquo;</li> <li className="text-base-content">&raquo;</li>
<li> <li>
{crumb[2] {crumb[2]
@ -53,7 +52,7 @@ const Breadcrumbs = ({ app, slug=false, title }) => {
: <span className="text-base-content">{crumb[0]}</span> : <span className="text-base-content">{crumb[0]}</span>
} }
</li> </li>
</> </React.Fragment>
))} ))}
</ul> </ul>
) )
@ -71,13 +70,11 @@ const DefaultLayout = ({ app, title=false, children=[], search, setSearch}) => {
} }
const router = useRouter() const router = useRouter()
router?.events?.on('routeChangeStart', startNavigation) router.events?.on('routeChangeStart', startNavigation)
router?.events?.on('routeChangeComplete', () => app.stopLoading()) router.events?.on('routeChangeComplete', () => app.stopLoading())
const slug = router.asPath.slice(1) const slug = router.asPath.slice(1)
const [leftNav, setLeftNav] = useState(false) const [leftNav, setLeftNav] = useState(false)
const toggleLeftNav = () => setLeftNav(!leftNav)
return ( return (
<div className={` <div className={`
flex flex-col justify-between flex flex-col justify-between

View file

@ -31,11 +31,11 @@ const fill = {
hax0r: ( hax0r: (
<linearGradient id="hax0r" x1="0%" y1="0%" x2="50%" y2="100%"> <linearGradient id="hax0r" x1="0%" y1="0%" x2="50%" y2="100%">
{[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20].map( i => ( {[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20].map( i => (
<> <React.Fragment key={i}>
<stop key={i} offset={`${i*5}%`} stopColor={colors.lime[900]} stopOpacity="1.0" /> <stop key={i} offset={`${i*5}%`} stopColor={colors.lime[900]} stopOpacity="1.0" />
<stop key={i} offset={`${i*5+1}%`} stopColor={colors.lime[800]} stopOpacity="1.0" /> <stop key={i} offset={`${i*5+1}%`} stopColor={colors.lime[800]} stopOpacity="1.0" />
<stop key={i} offset={`${i*5+2}%`} stopColor={colors.lime[900]} stopOpacity="1.0" /> <stop key={i} offset={`${i*5+2}%`} stopColor={colors.lime[900]} stopOpacity="1.0" />
</> </React.Fragment>
))} ))}
</linearGradient> </linearGradient>
), ),
@ -43,10 +43,10 @@ const fill = {
<linearGradient id="lgbtq" x1="0%" y1="0%" x2="0%" y2="100%"> <linearGradient id="lgbtq" x1="0%" y1="0%" x2="0%" y2="100%">
{['red', 'orange', 'yellow', 'green', 'blue', 'violet'].map(c => { {['red', 'orange', 'yellow', 'green', 'blue', 'violet'].map(c => {
let next = step + 100/6 let next = step + 100/6
const stop = <> const stop = <React.Fragment key={c}>
<stop offset={`${step}%`} stopColor={colors[c][500]} stopOpacity="1.0" /> <stop offset={`${step}%`} stopColor={colors[c][500]} stopOpacity="1.0" />
<stop offset={`${next}%`} stopColor={colors[c][500]} stopOpacity="1.0" /> <stop offset={`${next}%`} stopColor={colors[c][500]} stopOpacity="1.0" />
</> </React.Fragment>
step = next step = next
return stop return stop
})} })}
@ -81,7 +81,7 @@ const Logo = ({ size=false, className='stroke-0', theme='light', fill=false, str
return ( return (
<svg {...svgProps}> <svg {...svgProps}>
<defs> <defs>
{fill[theme]} {fill && fill[theme]}
<path id="react-logo" d={path} /> <path id="react-logo" d={path} />
</defs> </defs>
<use xlinkHref="#react-logo" fill="none" stroke={stroke || strokes[theme]} strokeWidth="0.5"/> <use xlinkHref="#react-logo" fill="none" stroke={stroke || strokes[theme]} strokeWidth="0.5"/>

View file

@ -44,7 +44,6 @@ const Pattern = props => {
children=null, children=null,
options = {}, options = {},
measurements = { head: 390}, measurements = { head: 390},
settings,
part = '', part = '',
sample, sample,
svgOnly=false, svgOnly=false,
@ -85,10 +84,10 @@ const Pattern = props => {
} }
/* Set up settings object */ /* Set up settings object */
settings = { const settings = {
options: { ...options }, options: { ...options },
measurements: { ...measurements }, measurements: { ...measurements },
...settings ...props.settings
} }
// Support for options_ prefix // Support for options_ prefix
for (const [key, val] of Object.entries(props)) { for (const [key, val] of Object.entries(props)) {

View file

@ -8,8 +8,9 @@ const names = {
const Highlight = (props) => { const Highlight = (props) => {
const { children=[], className='language-js' } = props const language = props.children
const language = props.children.props.className.split('-').pop() ? props.children.props.className.split('-').pop()
: 'txt'
return ( return (
<div className="hljs my-4"> <div className="hljs my-4">

View file

@ -1,8 +1,6 @@
import get from 'lodash.get' import get from 'lodash.get'
import orderBy from 'lodash.orderby' import orderBy from 'lodash.orderby'
import Link from 'next/link' import Link from 'next/link'
import Right from 'shared/components/icons/right.js'
import Left from 'shared/components/icons/left.js'
// helper method to order nav entries // helper method to order nav entries
const order = obj => orderBy(obj, ['__order', '__title'], ['asc', 'asc']) const order = obj => orderBy(obj, ['__order', '__title'], ['asc', 'asc'])

View file

@ -1,10 +1,7 @@
import get from 'lodash.get'
import Link from 'next/link' import Link from 'next/link'
import orderBy from 'lodash.orderby' import orderBy from 'lodash.orderby'
import Logo from 'shared/components/logos/freesewing.js'
import ThemePicker from 'shared/components/theme-picker.js' import ThemePicker from 'shared/components/theme-picker.js'
import RssIcon from 'shared/components/icons/rss.js' import RssIcon from 'shared/components/icons/rss.js'
import ThemeIcon from 'shared/components/icons/theme.js'
import TutorialIcon from 'shared/components/icons/tutorial.js' import TutorialIcon from 'shared/components/icons/tutorial.js'
import GuideIcon from 'shared/components/icons/guide.js' import GuideIcon from 'shared/components/icons/guide.js'
import HelpIcon from 'shared/components/icons/help.js' import HelpIcon from 'shared/components/icons/help.js'
@ -102,7 +99,7 @@ const SubLevel = ({ nodes={}, active }) => (
{child.__slug === active ? <>&bull;</> : <>&deg;</>} {child.__slug === active ? <>&bull;</> : <>&deg;</>}
</span> </span>
<span className={child.__slug === active ? 'font-bold' : ''}> <span className={child.__slug === active ? 'font-bold' : ''}>
{ child?.__linktitle || child.__title } { child.__linktitle || child.__title }
</span> </span>
</a> </a>
</Link> </Link>

View file

@ -10,19 +10,19 @@ const colors = {
} }
let forceTailwind = <p className="border-accent bg-accent" /> let forceTailwind = <p className="border-accent bg-accent" />
forceTailwind = <p className="text-accent" /> forceTailwind += <p className="text-accent" />
forceTailwind = <p className="border-secondary bg-secondary" /> forceTailwind += <p className="border-secondary bg-secondary" />
forceTailwind = <p className="text-secondary" /> forceTailwind += <p className="text-secondary" />
forceTailwind = <p className="border-error bg-error" /> forceTailwind += <p className="border-error bg-error" />
forceTailwind = <p className="text-error" /> forceTailwind += <p className="text-error" />
forceTailwind = <p className="border-warning bg-warning" /> forceTailwind += <p className="border-warning bg-warning" />
forceTailwind = <p className="text-warning" /> forceTailwind += <p className="text-warning" />
forceTailwind = <p className="border-info bg-info" /> forceTailwind += <p className="border-info bg-info" />
forceTailwind = <p className="text-info" /> forceTailwind += <p className="text-info" />
forceTailwind = <p className="border-success bg-success" /> forceTailwind += <p className="border-success bg-success" />
forceTailwind = <p className="text-success" /> forceTailwind += <p className="text-success" />
forceTailwind = <p className="border-primary bg-primary" /> forceTailwind += <p className="border-primary bg-primary" />
forceTailwind = <p className="text-primary" /> forceTailwind += <p className="text-primary" />
const Popout = (props) => { const Popout = (props) => {
let type = 'none' let type = 'none'

View file

@ -22,8 +22,7 @@
"remark-extract-frontmatter": "^3.2.0", "remark-extract-frontmatter": "^3.2.0",
"remark-frontmatter": "^4.0.1", "remark-frontmatter": "^4.0.1",
"to-vfile": "^7.2.2", "to-vfile": "^7.2.2",
"unist-util-visit": "^4.1.0", "unist-util-visit": "^4.1.0"
"vfile-reporter": "^7.0.3"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^10.4.0", "autoprefixer": "^10.4.0",

View file

@ -1,14 +1,12 @@
import path from 'path' import path from 'path'
import fs from 'fs' import fs from 'fs'
import { languages, strapiHost } from '../config/freesewing.mjs' import { languages } from '../config/freesewing.mjs'
import rdir from 'recursive-readdir' import rdir from 'recursive-readdir'
import { unified } from 'unified' import { unified } from 'unified'
import remarkParser from 'remark-parse' import remarkParser from 'remark-parse'
import remarkCompiler from 'remark-stringify' import remarkCompiler from 'remark-stringify'
import remarkFrontmatter from 'remark-frontmatter' import remarkFrontmatter from 'remark-frontmatter'
import remarkFrontmatterExtractor from 'remark-extract-frontmatter' import remarkFrontmatterExtractor from 'remark-extract-frontmatter'
import remarkMdx from 'remark-mdx'
import vfileReporter from 'vfile-reporter'
import { readSync } from 'to-vfile' import { readSync } from 'to-vfile'
import yaml from 'js-yaml' import yaml from 'js-yaml'
@ -106,14 +104,11 @@ export const prebuildMdx = async(site) => {
const slug = fileToSlug(file, site, lang) const slug = fileToSlug(file, site, lang)
if (slug) { if (slug) {
const meta = await mdxMetaInfo(file) const meta = await mdxMetaInfo(file)
if (meta?.data?.title && meta?.data?.title) { if (meta.data?.title && meta.data?.title) {
pages[lang][slug] = { pages[lang][slug] = {
title: meta.data.title, title: meta.data.title,
order: meta.data.order
? meta.data.order+meta.data.title
: meta.data.title,
slug, slug,
order: meta?.data?.order order: meta.data?.order
? `${meta.data.order}${meta.data.title}` ? `${meta.data.order}${meta.data.title}`
: meta.data.title : meta.data.title
} }

View file

@ -1,7 +1,6 @@
import path from 'path' import path from 'path'
import fs from 'fs' import fs from 'fs'
import set from 'lodash.set' import set from 'lodash.set'
import get from 'lodash.get'
// Some arbitrary future time // Some arbitrary future time
const future = new Date('10-12-2026').getTime() const future = new Date('10-12-2026').getTime()
@ -51,4 +50,5 @@ export const prebuildNavigation = (mdxPages, strapiPosts, site) => {
`export default ${JSON.stringify(nav, null ,2)}` `export default ${JSON.stringify(nav, null ,2)}`
) )
return true
} }

View file

@ -91,7 +91,7 @@ export const prebuildStrapi = async(site) => {
date: post.date, date: post.date,
slug: post.slug, slug: post.slug,
author: post.author, author: post.author,
img: post?.image?.formats?.large?.url || 'https://posts.freesewing.org/uploads/logo_8401e711e4.png' img: post.image?.formats?.large?.url || 'https://posts.freesewing.org/uploads/logo_8401e711e4.png'
})), null, 2)}` })), null, 2)}`
) )
for (const [slug, post] of Object.entries(posts[lang][type])) { for (const [slug, post] of Object.entries(posts[lang][type])) {

View file

@ -8,7 +8,6 @@ import { compile } from '@mdx-js/mdx'
// Remark plugins we want to use // Remark plugins we want to use
import remarkFrontmatter from 'remark-frontmatter' import remarkFrontmatter from 'remark-frontmatter'
import remarkGfm from 'remark-gfm' import remarkGfm from 'remark-gfm'
import remarkCopyLinkedFiles from 'remark-copy-linked-files'
// Rehype plugins we want to use // Rehype plugins we want to use
import rehypeHighlight from 'rehype-highlight' import rehypeHighlight from 'rehype-highlight'

View file

@ -1,9 +1,7 @@
/* /*
* This tries to fix as many Strapi things as possible * This tries to fix as many Strapi things as possible
*/ */
import axios from 'axios' import { languages as allLanguages } from '../config/freesewing.mjs'
import { languages as allLanguages, strapiHost } from '../config/freesewing.mjs'
import {getPosts } from '../prebuild/strapi.mjs'
// What types of content to load // What types of content to load
const content = { const content = {

View file

@ -1,5 +1,4 @@
const colors = require('tailwindcss/colors') const colors = require('tailwindcss/colors')
const gray = colors.neutral
module.exports = { module.exports = {
'fontFamily': '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif', 'fontFamily': '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif',

View file

@ -74,14 +74,6 @@ module.exports = {
'--pattern-mark': colors.blue['500'], '--pattern-mark': colors.blue['500'],
'--pattern-contrast': colors.pink['500'], '--pattern-contrast': colors.pink['500'],
'--pattern-note': colors.violet['500'], '--pattern-note': colors.violet['500'],
'--pattern-fabric': colors.neutral['700'],
'--pattern-lining': colors.emerald['500'],
'--pattern-interfacing': colors.neutral['400'],
'--pattern-canvas': colors.amber['600'],
'--pattern-various': colors.red['500'],
'--pattern-mark': colors.blue['500'],
'--pattern-contrast': colors.pink['500'],
'--pattern-note': colors.violet['500'],
'--pattern-dev-0': colors.red['500'], '--pattern-dev-0': colors.red['500'],
'--pattern-dev-1': colors.green['500'], '--pattern-dev-1': colors.green['500'],

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,5 +1,4 @@
import { version, name } from '../package.json' import { version, name } from '../package.json'
import validate from './validate'
const err = 'FIXME: plugin-validate is not updated for recent core versions' const err = 'FIXME: plugin-validate is not updated for recent core versions'
export default { export default {

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,10 +1,8 @@
// This file is auto-generated. // This file is auto-generated.
// Changes you make will be overwritten. // Changes you make will be overwritten.
import freesewing from '@freesewing/core'
import chai from 'chai'
import plugin from '../dist/index.mjs' import plugin from '../dist/index.mjs'
import { sharedPluginTests } from '../../../tests/plugins/shared.mjs' import { sharedPluginTests } from '../../../tests/plugins/shared.mjs'
// Run shared tests // Run shared tests
sharedPluginTests(plugin, freesewing, chai.expect) sharedPluginTests(plugin)

View file

@ -1,5 +1,5 @@
const draftDimension = (part) => { const draftDimension = (part) => {
const { points, Point, paths, Path, snippets, Snippet, options, macro } = part.shorthand() const { points, Point, options, macro } = part.shorthand()
if (['gore', 'all'].indexOf(options.plugin) !== -1) { if (['gore', 'all'].indexOf(options.plugin) !== -1) {
points.start = new Point(10, 10) points.start = new Point(10, 10)

View file

@ -1,5 +1,5 @@
const draftI18n = (part) => { const draftI18n = (part) => {
const { points, Point, paths, Path, options, macro, settings } = part.shorthand() const { points, Point, paths, Path, options } = part.shorthand()
if (['i18n', 'all'].indexOf(options.plugin) !== -1) { if (['i18n', 'all'].indexOf(options.plugin) !== -1) {
points.a = new Point(0, 0).attr('data-text', 'cutTwoStripsToFinishTheArmholes') points.a = new Point(0, 0).attr('data-text', 'cutTwoStripsToFinishTheArmholes')

View file

@ -1,12 +1,3 @@
const addThese = [
'button',
'buttonhole',
'buttonhole-start',
'buttonhole-end',
'snap-stud',
'snap-socket',
]
const draftButtons = (part) => { const draftButtons = (part) => {
const { points, Point, paths, Path, snippets, Snippet, options } = part.shorthand() const { points, Point, paths, Path, snippets, Snippet, options } = part.shorthand()

View file

@ -1,5 +1,5 @@
const draftScalebox = (part) => { const draftScalebox = (part) => {
const { Point, points, Path, paths, macro, options } = part.shorthand() const { Point, points, macro, options } = part.shorthand()
if (['scalebox', 'all'].indexOf(options.plugin) !== -1) { if (['scalebox', 'all'].indexOf(options.plugin) !== -1) {
points.a = new Point(0, 0) points.a = new Point(0, 0)

View file

@ -1,10 +1,9 @@
export default function (part, demo = false) { export default function (part, demo = false) {
const { Point, Path, points, paths, store, options } = part.shorthand() const { Point, points, store, options } = part.shorthand()
if (options.only === 'circles' || demo) { if (options.only === 'circles' || demo) {
let y = store.get('y') let y = store.get('y')
const w = store.get('w') const w = store.get('w')
let colors = store.get('colors')
y += w / 8 + 5 y += w / 8 + 5
for (let i = 1; i < 6; i++) { for (let i = 1; i < 6; i++) {

View file

@ -8,7 +8,7 @@ import snippets from './snippets.js'
import macros from './macros.js' import macros from './macros.js'
export default function (part) { export default function (part) {
const { macro, store, options, Path, paths, Point } = part.shorthand() const { store, options, Path, paths, Point } = part.shorthand()
// Keep things in store // Keep things in store
store.set('y', 0) store.set('y', 0)

View file

@ -5,8 +5,6 @@ import chai from 'chai'
* It expects the following: * It expects the following:
* *
* @param object plugin: The plugin object * @param object plugin: The plugin object
* @param object freesewing: Imported @freesewing/core
* @param object expect: Imported chai.expect
*/ */
export const sharedPluginTests = plugin => { export const sharedPluginTests = plugin => {