1
0
Fork 0
freesewing/sites/freesewing.dev/pages/blog/index.js
Joost De Cock e4035b2509 chore: Re-structure workspaces, enforce build order
These are some changes in the way the monorepo is structured,
that are aimed at making it easier to get started.

There are two important changes:

**Multiple workspaces**

We had a yarn workspaces setup at `packages/*`. But our monorepo has
grown to 92 packages which can be overwhelming for people not familiar
with the package names.

To remedy this, I've split it into 4 different workspaces:

- `designs/*`: Holds FreeSewing designs (think patterns)
- `plugins/*`: Holds FreeSewing plugins
- `packages/*`: Holds other packages published on NPM
- `sites/*`: Holds software that is not published as an NPM package,
  such as our various websites and backend API

This should make it easier to find things, and to answer questions like
*where do I find the code for the plugins*.

**Updated reconfigure script to handle build order**

One problem when bootstrapping the repo is inter-dependencies between
packages. For example, building a pattern will only work once
`plugin-bundle` is built. Which will only work once all plugins in the
bundle or built. And that will only work when `core` is built, and so
on.

This can be frustrating for new users as `yarn buildall` will fail.
And it gets overlooked by seasoned devs because they're likely to have
every package built in their repo so this issue doesn't concern them.

To remedy this, we now have a `config/build-order.mjs` file and the
updated `/scripts/reconfigure.mjs` script will enforce the build order
so that things *just work*.
2022-06-16 17:11:31 +02:00

88 lines
3.1 KiB
JavaScript

import Page from 'shared/components/wrappers/page.js'
import useApp from 'site/hooks/useApp.js'
import Link from 'next/link'
import { posts } from 'site/prebuild/strapi.blog.en.js'
import orderBy from 'lodash.orderby'
import TimeAgo from 'react-timeago'
import Head from 'next/head'
import HelpUs from 'site/components/help-us.js'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
const strapi = "https://posts.freesewing.org"
const Preview = ({ app, post }) => (
<div className="theme-gradient p-1 hover:p-0 hover:mb-1 hover:pointer transition-all">
<Link href={`/blog/${post.slug}`}>
<a title={post.title} className="hover:underline">
<div className="bg-base-100 w-full aspect-video shadow flex flex-column items-end" style={{
backgroundImage: `url(${strapi}${post.img})`,
backgroundSize: 'cover',
}}>
<div className="grow"></div>
<div className="text-right">
<div className={`
bg-neutral text-neutral-content
bg-opacity-80
px-4 text-right
`}>
<h5 className={`
text-neutral-content
text-xl font-normal
md:text-2xl md:font-light
`}>
{post.title}
</h5>
<p className={`
m-0 p-1 -mt-2
text-neutral-content
opacity-50
leading-normal text-sm font-normal
`}>
<TimeAgo date={post.date} /> by {post.author}
</p>
</div>
</div>
</div>
</a>
</Link>
</div>
)
const BlogIndexPage = (props) => {
const app = useApp()
return (
<Page app={app} title='FreeSewing Development Blog' slug='blog'>
<Head>
<meta property="og:title" content="FreeSewing Developers Blog" key="title" />
<meta property="og:type" content="article" key='type' />
<meta property="og:description" content="Content for developers and contributors alike. Strictly no sewing stuff" key='type' />
<meta property="og:article:author" content='Joost De Cock' key='author' />
<meta property="og:image" content="https://canary.backend.freesewing.org/og-img/en/dev/blog" key='image' />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:url" content="https://freesewing.dev/blog" key='url' />
<meta property="og:locale" content="en_US" key='locale' />
<meta property="og:site_name" content="freesewing.dev" key='site' />
</Head>
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
{Object.values(orderBy(posts, ['date'], ['desc']))
.map(post => <Preview app={app} post={post} key={post.slug}/>)
}
</div>
<HelpUs slug='/blog' />
</Page>
)
}
export default BlogIndexPage
export async function getStaticProps({ locale }) {
return {
props: {
...(await serverSideTranslations('en')),
}
}
}