Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Releases: typed-sh/legacy-blog

v1.0.2 - Maintenance release

12 Mar 02:17
Compare
Choose a tag to compare

This release is optional and for applying latest patches of the project.

Design fix of post thumbnails

Image height of mobile devices were improved slightly.

image

Design fix of scrollbar

Added better scrollbar to the project.

image

Limitation for main page posts

At this release, we also added the page index indicator.

image

v1.0.0-2 - Hotfix for attachment caching

05 Mar 10:13
1605bfe
Compare
Choose a tag to compare

This release is for hotfix that adding support of caching of post attachments with ETag header.

Problem

As the path problem fixed in last hotfix but the whole request didn't cache in browser due to leak of caching header support.

Fix

Added ETag generator logic in memory based serverless api which generate ETags by reading only 128 bytes from the file.

const readBytes = (location, bytes) => {
  return new Promise((resolve, reject) => {
    fs.open(location, 'r', (status, fd) => {
      if (status) {
        reject(new Error('file is busy or unavailable:', status.message))
      }

      const buffer = Buffer.alloc(bytes)

      fs.read(fd, buffer, 0, bytes, 0, (error, x) => {
        if (error) {
          reject(new Error('cannot read bytes from file:', error))
        }

        resolve(buffer.toString('utf8', 0, x))
      })
    })
  })
}

v1.0.0-1 - Hotfix for Linux platforms

05 Mar 09:08
Compare
Choose a tag to compare

This release is for hotfix of static image path correction.

Problem

As the URL rewrite rule set on next.config.js, parameters were sent with querystring variables and this made path like: /var/task/contents/posts/Release Note v1/update-post-list.png?filename=update-post-list.png&slug=release-note-v1
This caused ENOENT: no such file or directory error.

Fix

The fix was easily implemented.

  const [slug, filename] = req.url
    .split('?')[0]
    .split('/')
    .slice(-2)

Full error message

[GET] /post/release-note-v1/update-post-list.png
17:53:06:31
2021-03-05T08:53:06.683Z	bcfd99eb-6732-42c9-aabb-f5fe0d75a936	ERROR	Uncaught Exception 	{"errorType":"Error","errorMessage":"ENOENT: no such file or directory, open '/var/task/contents/posts/Release Note v1/update-post-list.png?filename=update-post-list.png&slug=release-note-v1'","code":"ENOENT","errno":-2,"syscall":"open","path":"/var/task/contents/posts/Release Note v1/update-post-list.png?filename=update-post-list.png&slug=release-note-v1","stack":["Error: ENOENT: no such file or directory, open '/var/task/contents/posts/Release Note v1/update-post-list.png?filename=update-post-list.png&slug=release-note-v1'"]}
Unknown application error occurred

v1.0.0 - First release

05 Mar 02:35
Compare
Choose a tag to compare

In this release, Typed.sh team is announcing new design with enhanced features.

Relative image import

Now you can import images with relative path from MDX file. Why this wasn't available until this release was because I cannot ensure that the function can work both serverless and static environment.

+ contents
  + posts
    + hello world
      - index.mdx
      - image.jpg
![image](./image.jpg)

Avatar with post list

Now you can see avatars on main page which post list located.

image

Design corrections

Also, now code blocks are shown without overflowing the whole website wrapper on Chromium based mobile resolutions.

image

Favicon support

Also, favicon is now supported with shortcut icon.

image

Seamless experience with static exports

Everything which implemented with serverless functions are also available with static exports

yarn mkstatic

This command makes static assets available on static HTML site by copying assets. You need to run this command after exporting site with static HTML.

yarn sitemap

This command makes static sitemap.xml file to out folder where static site generated.

Serverless functions

In serverless environment, functions in /api folder will be used instead of static exports.

rewrites: async () => {
  return [
    {
      source: '/sitemap.xml',
      destination: '/api/sitemap'
    },
    {
      source: '/post/:slug/:filename',
      destination: '/api/assets/:slug/:filename'
    }
  ]
}

Automatic CD support with GitHub Actions

Every time pushed to this repository will be deployed into Vercel CDN.

name: Deploy to production

on: [
  push
]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: amondnet/vercel-action@v20
        with:
          vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
          github-token: ${{ secrets.GITHUB_TOKEN }} # Optional
          vercel-args: '--prod' # Optional
          vercel-org-id: ${{ secrets.ORG_ID }}  # Required
          vercel-project-id: ${{ secrets.PROJECT_ID }} # Required
          working-directory: ./