1
0
Fork 0

Merge pull request #3353 from freesewing/alpha-release

Fix: Development environment - Preparation for a new alpha release
This commit is contained in:
Joost De Cock 2022-12-30 18:13:40 +01:00 committed by GitHub
commit 95ae5ffb13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 133 additions and 129 deletions

View file

@ -29,8 +29,7 @@ i18n:
models:
test: 'npx mocha tests/*.test.mjs'
new-design:
i18n-only: 'SITE="new-design/shared" node ../../sites/shared/prebuild/i18n-only.mjs'
build: '!'
18n-only: 'SITE="new-design/shared" node ../../sites/shared/prebuild/i18n-only.mjs'
wbuild: '!'
lint: "npx eslint 'lib/*.mjs'"
mbuild: '!'

View file

@ -16,14 +16,14 @@
"tips": "node scripts/help.mjs",
"lab": "cd sites/lab && yarn start",
"lab-debug": "cd sites/lab && yarn start-debug",
"kickstart": "npx lerna bootstrap && yarn buildall && yarn prepare && yarn tips",
"kickstart": "npx lerna bootstrap && yarn reconfigure && yarn buildall && yarn prepare && yarn tips",
"kickstart:windows": "npx lerna bootstrap && yarn wbuildall && yarn prepare && yarn tips",
"cleanall": "lerna run clean",
"test": "lerna run test",
"prettier": "npx prettier --write 'config/*' 'config/**/*' 'packages/**/src/*.mjs' 'packages/i18n/src/locales/**/*.*' 'packages/**/tests/*.mjs'",
"reconfigure": "all-contributors generate && node --experimental-json-modules --no-warnings scripts/reconfigure.mjs",
"prerelease": "lerna version --no-git-tag-version --no-push && yarn reconfigure && yarn buildall",
"buildall": "lerna run cibuild_step0 && lerna run cibuild_step1 && lerna run cibuild_step2 && lerna run cibuild_step3 && lerna run cibuild_step4 && lerna run cibuild_step5 && lerna run cibuild_step6 && lerna run cibuild_step7",
"buildall": "yarn reconfigure && lerna run cibuild_step0 && lerna run cibuild_step1 && lerna run cibuild_step2 && lerna run cibuild_step3 && lerna run cibuild_step4 && lerna run cibuild_step5 && lerna run cibuild_step6 && lerna run cibuild_step7",
"build": "yarn buildall",
"wbuild": "yarn wbuildall",
"testall": "node scripts/testall.js",

View file

@ -12,23 +12,34 @@ const banner = `/**
// Let esbuild generate the build
let result
(async () => {
result = await esbuild.build({
banner: { js: banner },
bundle: true,
entryPoints: ['index.mjs'],
format: 'esm',
outfile: 'dist/index.mjs',
external: [],
metafile: process.env.VERBOSE ? true : false,
minify: process.env.NO_MINIFY ? false : true,
sourcemap: true,
platform: "node",
}).catch(() => process.exit(1))
;(async () => {
result = await esbuild
.build({
banner: {
js:
banner +
'\n' +
`import { createRequire } from 'module';` +
'\n' +
`const require = createRequire(import.meta.url);`,
},
bundle: true,
entryPoints: ['index.mjs'],
format: 'esm',
outfile: 'dist/index.mjs',
external: ['fs'],
metafile: process.env.VERBOSE ? true : false,
minify: process.env.NO_MINIFY ? false : true,
sourcemap: true,
platform: 'node',
})
.catch((err) => {
console.log(err)
process.exit(1)
})
if (process.env.VERBOSE) {
const info = await esbuild.analyzeMetafile(result.metafile)
console.log(info)
}
})()

View file

@ -1,9 +1,9 @@
// import { banner } from './banner.mjs'
import { banner } from './banner.mjs'
import { checkNodeVersion, getChoices, createEnvironment } from './utils.mjs'
export const cli = async () => {
// Make it pretty
// console.log(banner+"\n")
console.log(banner + '\n')
// Make sure we have a valid NodeJS version
checkNodeVersion()

View file

@ -8,7 +8,7 @@ export const config = {
// Repository to download from
repo: process.env.FS_REPO || 'freesewing/freesewing',
// Branch to download from
branch: process.env.FS_BRANCH || 'develop',
branch: process.env.FS_BRANCH || 'alpha-release',
i18n: [
'account',
'common',
@ -62,46 +62,49 @@ yarn-error.log*
sites: [
'shared/utils.mjs',
'shared/designs/index.js',
'shared/config/i18n.config.mjs',
'shared/config/freesewing.mjs',
'shared/config/next.mjs',
'shared/config/tailwind-force.html',
'shared/config/postcss.config.js',
'shared/config/tailwind.config.js',
'shared/hooks/useGist.js',
'shared/hooks/useLocalStorage.js',
'shared/hooks/useTheme.js',
'shared/mdx/compiler.js',
'shared/mdx/loader.js',
'shared/mdx/mdx-plugin-toc.mjs',
'shared/mdx/loader.js',
'shared/mdx/remark-intro-plugin.mjs',
'shared/config/freesewing.mjs',
'shared/config/i18n.config.mjs',
'shared/config/next.mjs',
'shared/config/postcss.config.js',
'shared/config/tailwind-force.html',
'shared/config/tailwind.config.js',
'shared/prebuild/contributors.mjs',
'shared/prebuild/feed.mjs',
'shared/prebuild/i18n-only.mjs',
'shared/prebuild/i18n.mjs',
'shared/prebuild/index.mjs',
'shared/prebuild/lab.mjs',
'shared/prebuild/mdx.mjs',
'shared/prebuild/navigation.mjs',
'shared/prebuild/patrons.mjs',
'shared/prebuild/strapi.mjs',
'shared/styles/code.css',
'shared/styles/globals.css',
'shared/styles/svg-freesewing-draft.css',
'shared/strapi/loader.js',
'shared/strapi/qa.mjs',
'shared/themes/dark.js',
'shared/themes/hax0r.js',
'shared/themes/index.js',
'shared/themes/lgbtq.js',
'shared/themes/light.js',
'shared/themes/index.js',
'shared/themes/runtime.js',
'shared/styles/code.css',
'shared/styles/globals.css',
'shared/styles/svg-freesewing-draft.css',
'shared/prebuild/feed.mjs',
'shared/prebuild/i18n-only.mjs',
'shared/prebuild/i18n.mjs',
'shared/prebuild/contributors.mjs',
'shared/prebuild/index.mjs',
'shared/prebuild/lab.mjs',
'shared/prebuild/md-intro.mjs',
'shared/prebuild/mdx.mjs',
'shared/prebuild/navigation.mjs',
'shared/prebuild/patrons.mjs',
'shared/prebuild/strapi.mjs',
'shared/prebuild/og/index.mjs',
'shared/components/breadcrumbs.js',
'shared/components/code.js',
'shared/components/copy-to-clipboard.js',
'shared/components/docs-link.js',
'shared/components/json-highlight.js',
'shared/components/lightbox.js',
'shared/components/loader.js',
'shared/components/locale-picker.js',
'shared/components/modal.js',
'shared/components/page-link.js',
@ -109,6 +112,7 @@ yarn-error.log*
'shared/components/popout.js',
'shared/components/raw-span.js',
'shared/components/ribbon.js',
'shared/components/spinner.js',
'shared/components/theme-picker.js',
'shared/components/web-link.js',
'shared/components/wordmark.js',
@ -117,7 +121,6 @@ yarn-error.log*
'shared/components/error/error-boundary.js',
'shared/components/error/reset-buttons.js',
'shared/components/error/view.js',
'shared/components/layouts/default.js',
'shared/components/logos/cc-by.js',
'shared/components/logos/cc.js',
'shared/components/logos/freesewing.js',
@ -126,12 +129,14 @@ yarn-error.log*
'shared/components/mdx/examples.js',
'shared/components/mdx/figure.js',
'shared/components/mdx/highlight.js',
'shared/components/mdx/http-method.js',
'shared/components/mdx/index.js',
'shared/components/mdx/prev-next.js',
'shared/components/mdx/read-more.js',
'shared/components/mdx/status-code.js',
'shared/components/mdx/tabs.js',
'shared/components/mdx/youtube.js',
'shared/components/layouts/default.js',
'shared/components/navigation/aside.js',
'shared/components/navigation/primary.js',
'shared/components/icons/box.js',
@ -152,9 +157,10 @@ yarn-error.log*
'shared/components/icons/flip.js',
'shared/components/icons/freesewing.js',
'shared/components/icons/github.js',
'shared/components/icons/google.js',
'shared/components/icons/guide.js',
'shared/components/icons/google.js',
'shared/components/icons/heart.js',
'shared/components/icons/home.js',
'shared/components/icons/help.js',
'shared/components/icons/i18n.js',
'shared/components/icons/instagram.js',
@ -183,48 +189,58 @@ yarn-error.log*
'shared/components/icons/versions.js',
'shared/components/icons/womenswear.js',
'shared/components/icons/xray.js',
'shared/components/robot/index.js',
'shared/components/robot/poses.js',
'shared/components/wrappers/img.js',
'shared/components/wrappers/mdx.js',
'shared/components/wrappers/page.js',
'shared/components/wrappers/toc.js',
'shared/components/wrappers/workbench.js',
'shared/components/robot/index.js',
'shared/components/robot/poses.js',
'shared/components/workbench/default-settings.js',
'shared/components/workbench/gist-as-json.js',
'shared/components/workbench/logs.js',
'shared/components/workbench/preload.js',
'shared/components/workbench/sample.js',
'shared/components/workbench/preload.js',
'shared/components/workbench/yaml.js',
'shared/components/workbench/inputs/design-option-count.js',
'shared/components/workbench/inputs/design-option-list.js',
'shared/components/workbench/inputs/design-option-pct-deg.js',
'shared/components/workbench/inputs/measurement.js',
'shared/components/workbench/exporting/export-handler.js',
'shared/components/workbench/exporting/export-worker.js',
'shared/components/workbench/exporting/index.js',
'shared/components/workbench/exporting/pdf-maker.js',
'shared/components/workbench/inputs/design-option-count.js',
'shared/components/workbench/inputs/design-option-list.js',
'shared/components/workbench/inputs/design-option-pct-deg.js',
'shared/components/workbench/inputs/measurement.js',
'shared/components/workbench/measurements/index.js',
'shared/components/workbench/measurements/non-human.js',
'shared/components/workbench/layout/cut/index.js',
'shared/components/workbench/layout/cut/settings.js',
'shared/components/workbench/layout/print/index.js',
'shared/components/workbench/layout/print/orientation-picker.js',
'shared/components/workbench/layout/print/pagesize-picker.js',
'shared/components/workbench/layout/print/plugin.js',
'shared/components/workbench/layout/print/settings.js',
'shared/components/workbench/layout/draft/index.js',
'shared/components/workbench/layout/draft/stack.js',
'shared/components/workbench/layout/draft/buttons.js',
'shared/components/workbench/draft/error.js',
'shared/components/workbench/draft/index.js',
'shared/components/workbench/draft/stack.js',
'shared/components/workbench/draft/svg-wrapper.js',
'shared/components/workbench/draft/utils.js',
'shared/components/workbench/draft/circle/index.js',
'shared/components/workbench/draft/path/index.js',
'shared/components/workbench/draft/defs/index.js',
'shared/components/workbench/draft/part/index.js',
'shared/components/workbench/draft/path/index.js',
'shared/components/workbench/draft/point/index.js',
'shared/components/workbench/draft/snippet/index.js',
'shared/components/workbench/draft/svg/index.js',
'shared/components/workbench/draft/point/index.js',
'shared/components/workbench/draft/text/index.js',
'shared/components/workbench/draft/svg/index.js',
'shared/components/workbench/draft/text-on-path/index.js',
'shared/components/workbench/layout/cut/index.js',
'shared/components/workbench/layout/cut/settings.js',
'shared/components/workbench/layout/draft/buttons.js',
'shared/components/workbench/layout/draft/index.js',
'shared/components/workbench/layout/draft/part.js',
'shared/components/workbench/layout/draft/stack.js',
'shared/components/workbench/layout/print/index.js',
'shared/components/workbench/layout/print/orientation-picker.js',
'shared/components/workbench/layout/print/pagesize-picker.js',
@ -237,32 +253,32 @@ yarn-error.log*
'shared/components/workbench/menu/core-settings/core-setting-mm.js',
'shared/components/workbench/menu/core-settings/core-setting-nr.js',
'shared/components/workbench/menu/core-settings/core-setting-only.js',
'shared/components/workbench/menu/core-settings/core-setting-sa-bool.js',
'shared/components/workbench/menu/core-settings/core-setting-sa-mm.js',
'shared/components/workbench/menu/core-settings/index.js',
'shared/components/workbench/menu/core-settings/setting.js',
'shared/components/workbench/menu/design-options/index.js',
'shared/components/workbench/menu/core-settings/core-setting-sa-bool.js',
'shared/components/workbench/menu/design-options/option-group.js',
'shared/components/workbench/menu/design-options/option-input.js',
'shared/components/workbench/menu/design-options/index.js',
'shared/components/workbench/menu/design-options/option-value.js',
'shared/components/workbench/menu/design-options/option.js',
'shared/components/workbench/menu/test-design-options/index.js',
'shared/components/workbench/menu/test-design-options/option.js',
'shared/components/workbench/menu/design-options/option-input.js',
'shared/components/workbench/menu/xray/attributes.js',
'shared/components/workbench/menu/xray/disable.js',
'shared/components/workbench/menu/xray/index.js',
'shared/components/workbench/menu/xray/list.js',
'shared/components/workbench/menu/xray/log.js',
'shared/components/workbench/menu/xray/path-ops.js',
'shared/components/workbench/menu/xray/path.js',
'shared/components/workbench/menu/xray/point.js',
'shared/components/workbench/menu/xray/reset.js',
'shared/components/workbench/menu/xray/path-ops.js',
'shared/components/workbench/menu/xray/path.js',
'shared/components/workbench/menu/test-design-options/option.js',
'shared/components/workbench/menu/test-design-options/index.js',
'lab/components/about.js',
'lab/components/design-picker.js',
'lab/components/layouts/bare.js',
'lab/components/layouts/lab.js',
'lab/components/wrappers/layout.js',
'lab/components/wrappers/page.js',
'lab/components/layouts/bare.js',
'lab/components/layouts/lab.js',
],
},
}

View file

@ -19,12 +19,16 @@
],
"type": "module",
"scripts": {
"build": "node build.mjs",
"clean": "rimraf dist",
"symlink": "mkdir -p ./node_modules/@freesewing && cd ./node_modules/@freesewing && ln -s -f ../../../* . && cd -",
"lab": "cd ../../sites/lab && yarn start",
"tips": "node ../../scripts/help.mjs",
"lint": "npx eslint 'lib/*.mjs'",
"i18n-only": "SITE=\"new-design/shared\" node ../../sites/shared/prebuild/i18n-only.mjs"
"18n-only": "SITE=\"new-design/shared\" node ../../sites/shared/prebuild/i18n-only.mjs",
"cibuild_step6": "node build.mjs",
"wbuild": "node build.mjs",
"wcibuild_step6": "node build.mjs"
},
"peerDependencies": {},
"dependencies": {

View file

@ -1,7 +1,4 @@
import Logo from 'shared/components/logos/freesewing.js'
import OsiLogo from 'shared/components/logos/osi.js'
import CreativeCommonsLogo from 'shared/components/logos/cc.js'
import CcByLogo from 'shared/components/logos/cc-by.js'
import { useTranslation } from 'next-i18next'
import Ribbon from 'shared/components/ribbon.js'
import Link from 'next/link'
@ -14,41 +11,6 @@ import InstagramIcon from 'shared/components/icons/instagram.js'
import RedditIcon from 'shared/components/icons/reddit.js'
import TwitterIcon from 'shared/components/icons/twitter.js'
// Classes
const link = 'text-secondary font-bold hover:pointer hover:underline px-1'
const accent = 'text-accent font-bold text-lg px-1 block sm:inline'
const freesewing = 'px-1 text-lg font-bold block sm:inline'
// Keep these translations in the component because they're only used here
const translations = {
cc: (
<span>
Content on FreeSewing.org is available under{' '}
<a className={link} href="https://creativecommons.org/licenses/by/4.0/">
a Creative Commons license
</a>
</span>
),
mit: (
<span>
The FreeSewing source code is{' '}
<a href="https://github.com/freesewing/freesewing" className={link}>
available on Github
</a>{' '}
under{' '}
<a href="https://opensource.org/licenses/MIT" className={link}>
the MIT license
</a>
</span>
),
sponsors: (
<>
<span className={freesewing}>FreeSewing</span> is sponsored by these{' '}
<span className={accent}>awesome companies</span>
</>
),
}
const icon = { className: 'w-8 lg:w-12 h-8 lg:h-12' }
const social = {
Discord: {
@ -103,10 +65,13 @@ const Footer = ({ app }) => {
{/* Social icons */}
<div className="w-full sm:w-auto flex flex-row flex-wrap gap-4 lg:gap-8 items-center justify-center">
{Object.keys(social).map((item) => (
<Link key={item} href={social[item].href}>
<a className="hover:text-secondary hover:-mt-2 transition-all" title={item}>
{social[item].icon}
</a>
<Link
key={item}
href={social[item].href}
className="hover:text-secondary hover:-mt-2 transition-all"
title={item}
>
{social[item].icon}
</Link>
))}
</div>

View file

@ -2,7 +2,6 @@ import { useState, useEffect } from 'react'
import Link from 'next/link'
import ThemePicker from 'shared/components/theme-picker.js'
import LocalePicker from 'shared/components/locale-picker.js'
import DesignPicker from 'site/components/design-picker.js'
import CloseIcon from 'shared/components/icons/close.js'
import MenuIcon from 'shared/components/icons/menu.js'
import HelpIcon from 'shared/components/icons/help.js'
@ -66,11 +65,9 @@ const Header = ({ app }) => {
<DocsIcon />
<span className="ml-2">{t('docs')}</span>
</a>
<Link href="/support">
<a role="button" className={btnClasses}>
<HelpIcon />
<span className="ml-2">{t('support')}</span>
</a>
<Link href="/support" role="button" className={btnClasses}>
<HelpIcon />
<span className="ml-2">{t('support')}</span>
</Link>
</div>
</div>

View file

@ -21,7 +21,7 @@ const translations = {
tips: {
en: (
<Popout tip compact>
Edit the files in the <strong>design</strong> folder, and we'll auto-update your design
Edit the files in the <strong>design</strong> folder, and we&apos;ll auto-update your design
</Popout>
),
nl: (
@ -33,7 +33,7 @@ const translations = {
},
}
const HomePage = (props) => {
const HomePage = () => {
const app = useApp()
const router = useRouter()
const { t } = useTranslation(['common', 'patrons', 'locales', 'themes'])
@ -44,25 +44,26 @@ const HomePage = (props) => {
<FsIcon className="w-96 m-auto" />
<h1>FreeSewing</h1>
<h4>{translations.sade[app.locale]}</h4>
<Link href="/design">
<a className="btn btn-primary btn-lg h-20 my-8 mb-12">
<span role="image" className="text-4xl px-6">
👉
</span>
<span className="text-xl px-2">{translations.load[app.locale]}</span>
<span role="image" className="text-4xl px-6">
👈
</span>
</a>
<Link href="/design" className="btn btn-primary btn-lg h-20 my-8 mb-12">
<span role="image" className="text-4xl px-6">
👉
</span>
<span className="text-xl px-2">{translations.load[app.locale]}</span>
<span role="image" className="text-4xl px-6">
👈
</span>
</Link>
{translations.tips[app.locale]}
</div>
<div className="flex flex-row flex-wrap gap-4 w-full max-w-4xl m-auto justify-center">
{router.locales.map((locale) => (
<Link href={router.asPath} locale={locale} key={locale}>
<a className="btn btn-ghost text-base-content hover:bg-base-200">
<span className="text-base-content">{t(`locales:${locale}`)}</span>
</a>
<Link
href={router.asPath}
locale={locale}
key={locale}
className="btn btn-ghost text-base-content hover:bg-base-200"
>
<span className="text-base-content">{t(`locales:${locale}`)}</span>
</Link>
))}
</div>

View file

@ -51,6 +51,17 @@ const repo = {
*/
const log = process.stdout
// Step 0: Avoid symlink so Windows users don't complain
const copyThese = [
{
from: ['scripts', 'banner.mjs'],
to: ['packages', 'new-design', 'lib', 'banner.mjs'],
},
]
for (const cp of copyThese) {
fs.copyFile(path.join(repo.path, ...cp.from), path.join(repo.path, ...cp.to), () => null)
}
// Step 1: Generate main README file from template
log.write(chalk.blueBright('Generating out main README file...'))
fs.writeFileSync(