diff --git a/sites/lab/available-versions.json b/sites/lab/available-versions.json deleted file mode 100644 index 4c01caeaa78..00000000000 --- a/sites/lab/available-versions.json +++ /dev/null @@ -1,531 +0,0 @@ -{ - "2.20.8": [ - "aaron", - "albert", - "bee", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "lunetius", - "paco", - "penelope", - "plugintest", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "tiberius", - "titan", - "trayvon", - "tutorial", - "ursula", - "wahid", - "walburga", - "waralee", - "yuri" - ], - "2.20.7": [ - "aaron", - "albert", - "bee", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "lunetius", - "paco", - "penelope", - "plugintest", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "tiberius", - "titan", - "trayvon", - "tutorial", - "ursula", - "wahid", - "walburga", - "waralee", - "yuri" - ], - "2.20.0": [ - "aaron", - "albert", - "bee", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "lunetius", - "paco", - "penelope", - "plugintest", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "tiberius", - "titan", - "trayvon", - "tutorial", - "ursula", - "wahid", - "walburga", - "waralee", - "yuri" - ], - "2.19.9": [ - "aaron", - "albert", - "bee", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "lunetius", - "paco", - "penelope", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "tiberius", - "titan", - "trayvon", - "tutorial", - "ursula", - "wahid", - "walburga", - "waralee", - "yuri" - ], - "2.19.0": [ - "aaron", - "albert", - "bee", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "lunetius", - "paco", - "penelope", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "tiberius", - "titan", - "trayvon", - "tutorial", - "ursula", - "wahid", - "walburga", - "waralee", - "yuri" - ], - "2.18.0": [ - "aaron", - "albert", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "paco", - "penelope", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "titan", - "trayvon", - "tutorial", - "ursula", - "wahid", - "waralee", - "yuri" - ], - "2.17.1": [ - "aaron", - "albert", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "paco", - "penelope", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "titan", - "trayvon", - "tutorial", - "ursula", - "wahid", - "waralee" - ], - "2.17.0": [ - "aaron", - "albert", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "paco", - "penelope", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "titan", - "trayvon", - "tutorial", - "ursula", - "wahid", - "waralee" - ], - "2.16.2": [ - "aaron", - "albert", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "paco", - "penelope", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "titan", - "trayvon", - "tutorial", - "wahid", - "waralee" - ], - "2.16.0": [ - "aaron", - "albert", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "paco", - "penelope", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "titan", - "trayvon", - "tutorial", - "wahid", - "waralee" - ], - "2.15.4": [ - "aaron", - "albert", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "paco", - "penelope", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "titan", - "trayvon", - "tutorial", - "wahid", - "waralee" - ], - "2.15.0": [ - "aaron", - "albert", - "bella", - "benjamin", - "bent", - "breanna", - "brian", - "bruce", - "carlita", - "carlton", - "cathrin", - "charlie", - "cornelius", - "diana", - "examples", - "florence", - "florent", - "holmes", - "hortensia", - "huey", - "hugo", - "jaeger", - "legend", - "paco", - "penelope", - "rendertest", - "sandy", - "shin", - "simon", - "simone", - "sven", - "tamiko", - "teagan", - "theo", - "titan", - "trayvon", - "tutorial", - "wahid", - "waralee" - ] -} \ No newline at end of file diff --git a/sites/lab/next.config.mjs b/sites/lab/next.config.mjs index 5458708a3b3..0c4b7670ba4 100644 --- a/sites/lab/next.config.mjs +++ b/sites/lab/next.config.mjs @@ -13,6 +13,13 @@ const config = { pageExtensions: [ 'js', 'mjs' ], webpack: (config, options) => { + // JSON support + config.module.rules.push({ + test: /\.json$/, + type: 'json', + use: 'json-loader' + }) + // YAML support config.module.rules.push({ test: /\.ya?ml$/, @@ -37,18 +44,16 @@ const config = { // Load designs from source, rather than compiled package for (const design in designs) { - config.resolve.alias[`@freesewing/${design}$`] = path.resolve(`../../designs/${design}/src/index.js`) + 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.js`) + 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', 'config-helpers', 'i18n', 'models']) { - config.resolve.alias[`@freesewing/${pkg}$`] = path.resolve(`../../packages/${pkg}/src/index.js`) + for (const pkg of ['core', 'i18n', 'models']) { + config.resolve.alias[`@freesewing/${pkg}$`] = path.resolve(`../../packages/${pkg}/src/index.mjs`) } - // @freesewing/snapseries is replaced by @freesewing/config-helpers - config.resolve.alias[`@freesewing/snapseries`] = path.resolve(`../../packages/config-helpers/src/index.js`) if (!greeting) { greeting = true diff --git a/sites/lab/page-templates/workbench.js b/sites/lab/page-templates/workbench.mjs similarity index 100% rename from sites/lab/page-templates/workbench.js rename to sites/lab/page-templates/workbench.mjs diff --git a/sites/lab/pages/v/.gitkeep b/sites/lab/pages/v/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/sites/lab/pages/v/index.js b/sites/lab/pages/v/index.js deleted file mode 100644 index d99dffe9d56..00000000000 --- a/sites/lab/pages/v/index.js +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react' -import Page from 'site/components/wrappers/page.js' -import useApp from 'site/hooks/useApp.js' -import Link from 'next/link' -import { formatVersionTitle } from 'site/components/version-picker.js' -import Layout from 'site/components/layouts/bare' -import { PageTitle } from 'shared/components/layouts/default' -import availableVersions from 'site/available-versions.json' - -const DesignLinks = ({ list, prefix='', version=false }) => ( - -) - -const VersionLinks = ({ list, prefix='', version=false, currentDesigns=[] }) => ( - -) - -const VersionListPage = ({ section=false, version=false }) => { - const app = useApp() - - const currentDesigns = [] - for (const section in app.designs) currentDesigns.push(...app.designs[section]) - - return ( - -
-
- - -
-
-
- ) -} - -export default VersionListPage - - diff --git a/sites/lab/pages/v/next/.gitkeep b/sites/lab/pages/v/next/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/sites/lab/versions.json b/sites/lab/versions.json deleted file mode 100644 index 626b02245fd..00000000000 --- a/sites/lab/versions.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - "2.20.8", - "2.20.7", - "2.20.0", - "2.19.9", - "2.19.0", - "2.18.0", - "2.17.1", - "2.17.0", - "2.16.2", - "2.16.0", - "2.15.4", - "2.15.0" -] - diff --git a/sites/shared/components/workbench/exporting/export-handler.js b/sites/shared/components/workbench/exporting/export-handler.js index 4ee220d0f33..15a0f394eb5 100644 --- a/sites/shared/components/workbench/exporting/export-handler.js +++ b/sites/shared/components/workbench/exporting/export-handler.js @@ -1,7 +1,7 @@ import Worker from 'web-worker'; import fileSaver from 'file-saver' -import theme from '@freesewing/plugin-theme' -import {pagesPlugin} from '../layout/print/plugin' +import { themePlugin } from '@freesewing/plugin-theme' +import { pagesPlugin } from '../layout/print/plugin' import {utils} from '@freesewing/core' export const exportTypes = { @@ -75,7 +75,7 @@ export const handleExport = async(format, gist, design, t, app, onComplete, onEr let pattern = new design({...gist, layout}) // add the theme and translation to the pattern - pattern.use(theme, {stripped: format !== 'svg'}) + pattern.use(themePlugin, {stripped: format !== 'svg'}) pattern.use({ hooks: { insertText: (locale, text, {t}) => t(text) diff --git a/sites/shared/prebuild/lab.mjs b/sites/shared/prebuild/lab.mjs index e55a803d485..c3b72ae44c2 100644 --- a/sites/shared/prebuild/lab.mjs +++ b/sites/shared/prebuild/lab.mjs @@ -1,6 +1,6 @@ import fs_ from 'fs' import path from 'path' -import axios from 'axios' +import { capitalize } from '../utils.mjs' import { designsByType } from '../../../config/software/index.mjs' const fs = fs_.promises @@ -14,28 +14,14 @@ const header = `/* * * sites/shared/prebuild/lab.mjs * - */ -` -const loadFromUnpkg = (design, version) => { - const start = Date.now() - return axios - .get(`https://unpkg.com/@freesewing/${design}@${version}/dist/index.mjs`) - .then(res => { - if (res.data) { - console.log(`Downloaded @freesewing/${design}@${version} in ${Date.now() - start}ms`) - return res.data - } - return false - }) - .catch(err => false) -} + */` const pageTemplate = design => `${header} -import design from 'designs/${design}/src/index.js' +import { ${capitalize(design)} } from 'designs/${design}/src/index.mjs' import { serverSideTranslations } from 'next-i18next/serverSideTranslations' -import PageTemplate from 'site/page-templates/workbench.js' +import PageTemplate from 'site/page-templates/workbench.mjs' -const Page = (props) => +const Page = (props) => export default Page export async function getStaticProps({ locale }) { @@ -47,54 +33,12 @@ export async function getStaticProps({ locale }) { } ` -const versionedPageTemplate = (design, version) => `${header} -import design from 'lib/${version}/${design}.mjs' -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' -import PageTemplate from 'site/page-templates/workbench.js' - -const Page = (props) => -export default Page - -export async function getStaticProps({ locale }) { - return { - props: { - ...(await serverSideTranslations(locale)), - } - } -} -` - -const versionOverviewPage = (version) => `${header} -import { serverSideTranslations } from 'next-i18next/serverSideTranslations' -import Template from 'site/page-templates/design-list.js' - -const Page = props =>