Skip to content

Commit 566102f

Browse files
committed
0.0.1
1 parent c390789 commit 566102f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+11825
-2023
lines changed

.babelrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"presets": [
3+
[
4+
"next/babel",
5+
{
6+
"preset-react": {
7+
"runtime": "automatic",
8+
"importSource": "@emotion/react"
9+
}
10+
}
11+
]
12+
],
13+
"plugins": ["@emotion/babel-plugin"]
14+
}

.github/workflows/publish.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: GitHub Actions Build and Deploy Demo
2+
on:
3+
push:
4+
branches:
5+
- master
6+
permissions:
7+
contents: write
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout 🛎️
13+
uses: actions/checkout@v3
14+
- name: Cache
15+
uses: actions/setup-node@v3
16+
with:
17+
cache: 'npm'
18+
- name: build
19+
run: |
20+
yarn
21+
yarn build
22+
- name: Build and Deploy
23+
uses: JamesIves/github-pages-deploy-action@v4
24+
with:
25+
folder: out
26+
token: ${{ secrets.ACCESS_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ yarn-error.log*
3232

3333
# vercel
3434
.vercel
35+
.keystone

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.yarnpkg.com/

.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
os: linux
2+
language: node_js
3+
node_js:
4+
- 14
5+
branches:
6+
only:
7+
- master
8+
cache:
9+
directories:
10+
- node_modules
11+
- .next
12+
before_script:
13+
- yarn
14+
- yarn build
15+
script:
16+
- yarn gen
17+
deploy:
18+
provider: pages
19+
skip_cleanup: true
20+
token: $GH_TOKEN
21+
keep_history: true
22+
on:
23+
branch: master
24+
local_dir: out
25+
target_branch: gh-pages

README.md

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,11 @@
1-
# A statically generated blog example using Next.js, Markdown, and TypeScript
1+
# Marsk's Blog
2+
my blog built with react, nextjs, keystone
23

3-
This is the existing [blog-starter](https://github.com/vercel/next.js/tree/canary/examples/blog-starter) plus TypeScript.
4-
5-
This example showcases Next.js's [Static Generation](https://nextjs.org/docs/basic-features/pages) feature using Markdown files as the data source.
6-
7-
The blog posts are stored in `/_posts` as Markdown files with front matter support. Adding a new Markdown file in there will create a new blog post.
8-
9-
To create the blog posts we use [`remark`](https://github.com/remarkjs/remark) and [`remark-html`](https://github.com/remarkjs/remark-html) to convert the Markdown files into an HTML string, and then send it down as a prop to the page. The metadata of every post is handled by [`gray-matter`](https://github.com/jonschlinkert/gray-matter) and also sent in props to the page.
10-
11-
## Deploy your own
12-
13-
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/blog-starter-typescript)
14-
15-
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/blog-starter-typescript&project-name=blog-starter-typescript&repository-name=blog-starter-typescript)
16-
17-
## How to use
18-
19-
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
20-
21-
```bash
22-
npx create-next-app --example blog-starter-typescript blog-starter-typescript-app
23-
# or
24-
yarn create next-app --example blog-starter-typescript blog-starter-typescript-app
25-
# or
26-
pnpm create next-app -- --example blog-starter-typescript blog-starter-typescript-app
4+
# Dev
5+
```shell
6+
yarn keystone:dev
7+
yarn next:dev
278
```
9+
- localhost:4000
10+
- admin: localhost:3000
2811

29-
Your blog should be up and running on [http://localhost:3000](http://localhost:3000)! If it doesn't work, post on [GitHub discussions](https://github.com/vercel/next.js/discussions).
30-
31-
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
32-
33-
# Notes
34-
35-
`blog-starter-typescript` uses [Tailwind CSS](https://tailwindcss.com) [(v3.0)](https://tailwindcss.com/blog/tailwindcss-v3).

_posts/.gitkeep

Whitespace-only changes.

_posts/dynamic-routing.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

_posts/hello-world.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

_posts/preview.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

_posts_archive/.gitkeep

Whitespace-only changes.

_posts_archive/Expo 简介.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
created_date: 2021-10-15 20:12
3+
updated_date: 2023-03-07 16:39
4+
tags:
5+
- react-native
6+
7+
title: Expo 简介
8+
slug: expo-intro
9+
brief: expo 是什么?expo 集成了 React Native 生态,用于快速开发和部署 React Native 应用,开发者只需懂 React Native
10+
---
11+
12+
# Expo 简介
13+
14+
> Expo 是一个用于 React 应用的框架和平台。其 Expo SDK 提供了 React Native 和 Native 的组件或工具,帮助开发者仅使用 JavaScript/TypeScript,在 iOS、Android 和 Web 应用上开发、构建、部署和快速迭代。 -- https://docs.expo.dev/
15+
16+
## 背景
17+
18+
开发、构建、发布基于 React Native 的 App 时,可能要修改 Native 的代码或 App 配置,这就需要安装 Xcode 或 Android Studio,配置环境,以及熟悉 iOS 或 Android 开发。这对开发者来说存在相当大的成本。
19+
20+
Expo 已经帮你集成了这些,你只需专注 JavaScript/TypeScript 的代码开发,你可以从 Expo SDK 引入 React Native 或 Native 的组件,另外可以下载 Expo Go App,便于在真机上调试代码、预览效果。
21+
22+
## 开发
23+
24+
#### 初始化项目
25+
26+
```shell
27+
npm install --global expo-cli
28+
# 创建新项目
29+
expo init my-project
30+
```
31+
32+
#### 目录结构
33+
34+
```shell
35+
├── App.tsx
36+
├── app.json # app 配置如图标、名称、版本等等
37+
├── assets
38+
├── babel.config.js
39+
├── node_modules
40+
├── package.json
41+
├── tsconfig.json
42+
└── yarn.lock
43+
```
44+
45+
#### 修改默认入口
46+
47+
```json
48+
// app.json
49+
{
50+
"expo": {
51+
"description": "",
52+
"entryPoint": "./index.ts"
53+
}
54+
}
55+
```
56+
57+
```javascript
58+
// index.ts
59+
import { registerRootComponent } from 'expo';
60+
import App from '@src/App';
61+
62+
registerRootComponent(App);
63+
```
64+
65+
#### 安装功能模块
66+
67+
```shell
68+
expo install expo-camera
69+
```
70+
71+
`yarn.lock` 时,`expo install` 使用 yarn 安装
72+
73+
`package-lock.json` 时, `expo install` 使用 npm 安装
74+
75+
## 发布
76+
77+
Expo 也是个沙盒平台,可以在 Expo Go App 访问开发者发布的代码,例如 React Native 官方文档里样例 demo
78+
79+
![](https://cdn.jsdelivr.net/gh/marsk6/image-center@master/expo-intro-1.png)
80+
81+
最后,Expo 的一套集成工具让前端开发者无需过多关注 Native 的配置,大大降低了开发成本,使 App 可以快速迭代。
82+
83+
> 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!

0 commit comments

Comments
 (0)