Skip to content

Commit

Permalink
Lockfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
bcomnes committed Feb 16, 2024
1 parent 600fc6b commit ba8cab4
Show file tree
Hide file tree
Showing 15 changed files with 299 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/blog/2023/reintroducing-top-bun/README.md
Expand Up @@ -215,7 +215,7 @@ export default async function * feedsTemplate ({
pages
}) {
const blogPosts = pages
.filter(page => ['article', 'book-review'].includes(page.vars.layout))
.filter(page => ['article', 'book-review'].includes(page.vars.layout) && page.vars.published !== false)
.sort((a, b) => new Date(b.vars.publishDate) - new Date(a.vars.publishDate))
.slice(0, 10)

Expand Down
269 changes: 269 additions & 0 deletions src/blog/2024/stupid-lockfile-tricks/README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/blog/2024/stupid-lockfile-tricks/img/artifact.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/blog/2024/stupid-lockfile-tricks/img/npm-5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/blog/2024/stupid-lockfile-tricks/img/og.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/blog/2024/stupid-lockfile-tricks/img/sindre.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/blog/2024/stupid-lockfile-tricks/img/updates.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/blog/2024/stupid-lockfile-tricks/img/yarn-intro.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/blog/page.js
Expand Up @@ -23,14 +23,15 @@ export const vars = {
* layout: string,
* publishDate: string
* title: string
* published?: boolean
* }>}
*/
export default async function blogIndex2023 ({
pages,
page
}) {
const blogPosts = pages
.filter(page => ['article', 'book-review'].includes(page.vars.layout))
.filter(page => ['article', 'book-review'].includes(page.vars.layout) && page.vars.published !== false)
// @ts-ignore
.sort((a, b) => new Date(b.vars.publishDate) - new Date(a.vars.publishDate))
.slice(0, 100)
Expand Down
5 changes: 3 additions & 2 deletions src/feeds.template.js
Expand Up @@ -14,7 +14,8 @@ import jsonfeedToAtom from 'jsonfeed-to-atom'
* authorUrl: string,
* authorImgUrl: string
* layout: string,
* publishDate: string
* publishDate: string,
* published?: boolean,
* title: string
* }>} */
export default async function * feedsTemplate ({
Expand All @@ -29,7 +30,7 @@ export default async function * feedsTemplate ({
pages
}) {
const blogPosts = pages
.filter(page => ['article', 'book-review'].includes(page.vars.layout))
.filter(page => ['article', 'book-review'].includes(page.vars.layout) && page.vars.published !== false)
.sort((a, b) => new Date(b.vars.publishDate) - new Date(a.vars.publishDate))
.slice(0, 10)

Expand Down
1 change: 1 addition & 0 deletions src/layouts/article.layout.js
Expand Up @@ -11,6 +11,7 @@ export default function articleLayout (args) {
const wrappedChildren = html`
${breadcrumb({ pathSegments })}
<article class="article-layout h-entry" itemscope itemtype="${vars.articleType ?? 'http://schema.org/BlogPosting'}">
${vars.published === false ? html`<div><br><strong>DRAFT POST</strong><br></div>` : null}
<header class="article-header">
<h1 class="p-name article-title" itemprop="headline">${vars.title}</h1>
<div class="metadata">
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/blog-auto-index.layout.js
Expand Up @@ -23,7 +23,7 @@ export default function blogAutoIndexLayout (args) {
const folderPages = args.pages.filter(folderPage => {
const dir = dirname(folderPage.pageInfo.path)
const path = args.page.path
return dir === path
return dir === path && folderPage.vars.published !== false
}).sort((a, b) => new Date(b.vars.publishDate) - new Date(a.vars.publishDate))

const wrappedChildren = html`
Expand Down
1 change: 1 addition & 0 deletions src/layouts/blog-index.layout.js
Expand Up @@ -15,6 +15,7 @@ import { breadcrumb } from '../components/breadcrumb/index.js'
* @typedef {RootLayoutVars & {
* title: string,
* publishDate: string,
* published?: boolean,
* [key: string]: any
* }} BlogIndexVars
*/
Expand Down
2 changes: 1 addition & 1 deletion src/page.vars.js
Expand Up @@ -8,7 +8,7 @@ export async function postVars ({
pages
}) {
const blogPosts = pages
.filter(page => ['article', 'book-review'].includes(page.vars.layout))
.filter(page => ['article', 'book-review'].includes(page.vars.layout) && page.vars.published !== false)
.sort((a, b) => new Date(b.vars.publishDate) - new Date(a.vars.publishDate))
.slice(0, 5)

Expand Down
3 changes: 2 additions & 1 deletion src/sitemap.xml.template.js
Expand Up @@ -14,6 +14,7 @@ import builder from 'xmlbuilder'
* authorImgUrl: string
* layout: string,
* publishDate: string
* published?: boolean,
* title: string,
* noindex?: boolean
* }>} */
Expand All @@ -26,7 +27,7 @@ export default async ({
const sitemapObj = {
urlset: {
'@xmlns': 'http://www.sitemaps.org/schemas/sitemap/0.9',
url: pages.filter(page => !page.vars.noindex).map(page => ({
url: pages.filter(page => !page.vars.noindex && page.vars.published !== false).map(page => ({
loc: `${siteUrl}/${page.pageInfo.path}${page.pageInfo.path && !page.pageInfo.path.endsWith('.html') ? '/' : ''}`
}))
}
Expand Down

0 comments on commit ba8cab4

Please sign in to comment.