Typed.sh is just a blog, init?
- Built with latest technologies and ready to use CI and CD.
- Seamless experience both static generation and Next server.
- Beautiful next generation blog posting experience with MDX and Chakra-UI.
To deploy Typed.sh blog on local, you need to install following dependencies before install:
- Node.JS
- Yarn
- Git
- Clone repository into your local directory.
git clone https://github.com/typed-sh/blog
cd blog
- Install dependencies of your module.
yarn
- Prepare submodules for non-development related data.
yarn update:prepare
yarn update
- Deploy!
To run development server:
yarn dev
To run server locally:
yarn build && yarn start
To export as static HTML (and run server):
yarn build && yarn export && yarn serve
Before we start, preparing two repository is ideal setup for Typed.sh based blog.
- Clone original repository.
git clone https://github.com/typed-sh/blog
cd blog
- Set upstream to get future updates from original repository.
git update:prepare
- (Optional) Set
contents
folder as submodule to retain user-data effectively when receiving updates from original repository.
If you don't want to create submodule, just run rm -rf .gitmodules
to delete submodules.
rm -rf .gitmodules
git submodules add [URL to repository]
- Pull updates from upstream repository and prepare contents.
If you didn't set up submodules, you need to run yarn update:upstream
instead to avoid loading submodules.
yarn update
Pre-steps
Before starting, do adoptation or installation! I assume that you already set up the project.
To deploy Typed.sh blog, you have several options:
- Deploy to Vercel (built-in with Vercel Action)
- Deploy to Vercel (non git-based projects)
- Deploy to GitHub pages
- Deploy to static HTML
We provide seamless experience between methods, so you don't need to worry about leak of functionalities.
Warning
Only for git-based projects only! For non-git projects follow next guide.
The GitHub actions are already set to repository, and only you need to consider is the type of your Vercel account.
- Initialize Vercel on your repository.
yarn dlx vercel
- Copy project and organization identifier from
.vercel/project.json
.
{"orgId":"","projectId":""}
- Create new token from Vercel.
Go to following URL and create new token for your project.
- Set repository secrets.
After copying values, go to settings
tab of GitHub repository and click secrets
.
Then add stuffs as follows by clicking New repository secrets
.
ORG_ID
:orgId
PROJECT_ID
:projectId
You need to deploy manually if you don't set up git repository.
yarn dlx vercel
To deploy over GitHub pages with static HTML exportation, you need to set up GitHub actions for it.
Override .github/workflows/deploy.yml
with:
name: Deploy to production
on: [
push
]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: yarn
- name: Build
run: yarn build && yarn export
- name: Update submodules # Add this if you're managing contents with git repository.
run: yarn update:submodules
- uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: out
CLEAN: true
Deploying project over Nginx or static file server? Of course you can!
- Build and extract outputs.
yarn build && yarn export
- Apply sample nginx configuration.
server {
root /somewhere/your/project/out;
location {
autoindex off;
index index.html;
try_files $uri $uri/ /404.html /404/ =404;
}
}
This repository is distributed under MIT License.