All Projects → shfshanyue → shici

shfshanyue / shici

Licence: other
使用 next.js 与 graphql 做一个诗词小站

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to shici

Next Routes
Universal dynamic routes for Next.js
Stars: ✭ 2,354 (+2879.75%)
Mutual labels:  ssr, nextjs
Next Blog Firestore
Example of blog built with React, Next.js, Firebase Firestore, Styled-Component, Mobx State Tree and other cool technologies
Stars: ✭ 219 (+177.22%)
Mutual labels:  ssr, nextjs
Mordred
[Experimental] Source data from anywhere, for Next.js, Nuxt.js, Eleventy and many more.
Stars: ✭ 208 (+163.29%)
Mutual labels:  ssr, nextjs
Next I18next
The easiest way to translate your NextJs apps.
Stars: ✭ 2,818 (+3467.09%)
Mutual labels:  ssr, nextjs
gbkel-portfolio
💎 My personal website that's mainly powered by Next.js, my own style guide and a lot of other technologies.
Stars: ✭ 12 (-84.81%)
Mutual labels:  ssr, nextjs
React Ssr
react16 next.js4 antd-mobile2 redux
Stars: ✭ 171 (+116.46%)
Mutual labels:  ssr, nextjs
Firebase Functions Next Example
Host a Next.js SSR React app on Cloud Functions for Firebase with Firebase Hosting
Stars: ✭ 215 (+172.15%)
Mutual labels:  ssr, nextjs
Wild Next
Our next.js boilerplate with sane base configuration.
Stars: ✭ 101 (+27.85%)
Mutual labels:  ssr, nextjs
apollo-local-query
Simpler server rendering with apollo-client 1.x, using a local GraphQL networkInterface
Stars: ✭ 66 (-16.46%)
Mutual labels:  ssr, apollo-client
Next Go
Production ready blog + boilerplate for Next.js 3.X
Stars: ✭ 254 (+221.52%)
Mutual labels:  ssr, nextjs
Reactql
Universal React+GraphQL starter kit: React 16, Apollo 2, MobX, Emotion, Webpack 4, GraphQL Code Generator, React Router 4, PostCSS, SSR
Stars: ✭ 1,833 (+2220.25%)
Mutual labels:  ssr, apollo-client
react16-seed-with-apollo-graphql-scss-router4-ssr-tests-eslint-prettier-docker-webpack3-hot
Seed to create your own project using React with Apollo GraphQL client
Stars: ✭ 19 (-75.95%)
Mutual labels:  ssr, apollo-client
Egg React Ssr
最小而美的Egg + React + SSR 服务端渲染应用骨架,同时支持JS和TS
Stars: ✭ 1,837 (+2225.32%)
Mutual labels:  ssr, nextjs
Next Firebase Ssr
An Next.js example repo for building authenticated pages with Firebase Authentication, cookies, and getServerSideProps
Stars: ✭ 192 (+143.04%)
Mutual labels:  ssr, nextjs
Gank
🦅 Gank api base △ next.js (react&ssr)
Stars: ✭ 122 (+54.43%)
Mutual labels:  ssr, nextjs
Next Blog
基于react(ssr)服务端框架next.js和antd-design搭建的个人博客
Stars: ✭ 214 (+170.89%)
Mutual labels:  ssr, nextjs
Serverless With Next5 Boilerplate
Serverless.js with Next.js 5 on AWS, powered by the Serverless Framework
Stars: ✭ 100 (+26.58%)
Mutual labels:  ssr, nextjs
Next Express Bootstrap Boilerplate
⚡️ JavaScript boilerplate for a full stack app built using React.js, Next.js, Express.js, react-bootstrap, SCSS and full SSR with eslint.
Stars: ✭ 102 (+29.11%)
Mutual labels:  ssr, nextjs
Next Boost
Add a cache layer for server-side-rendered pages with stale-while-revalidate. Can be considered as an implementation of next.js's Incremental Static Regeneration which works with getServerSideProps.
Stars: ✭ 239 (+202.53%)
Mutual labels:  ssr, nextjs
now-course
Proyecto para el curso de Now.sh en Platzi
Stars: ✭ 19 (-75.95%)
Mutual labels:  apollo-client, nextjs

诗词弦歌

出于个人兴趣做的一个网站作为自己技术上的试验田

诗词
https://shici.xiange.tech

诗词
https://graphql.xiange.tech

考虑使用 Prerender 的方式重写项目

技术栈

目录结构

$ tree -L 2 -I node_modules --dirsfirst -aF
.
├── .next/                        # 打包后文件
├── components/                   # 基本组件
├── config/
│   └── index.js                  # 配置文件
├── lib/                          # 工具包
│   ├── init-apollo.js            # apollo config
│   ├── utils.js                  # 工具函数
│   └── with-apollo-client.js
├── pages/                        # 页面组件
│   ├── profile/                  # 个人信息
│   ├── _app.js                   # 页面入口
│   ├── _error.js                 # 错误页
│   └── index.js                  # 首页
├── .babelrc
├── .gitignore
├── .gitlab-ci.yml                # CI 配置
├── static                        # 静态文件
├── Dockerfile
├── README.md
├── docker-compose.yml
├── next.config.js                # next 配置,包括 webpack
├── package-lock.json
├── package.json
├── query.gql                     # GraphQL Query/Mutation
├── routes.js                     # 路由
├── server.js                     # 应用程序入口
└── theme.json

运行

$ npm install

# 开发
$ npm run dev

# 运行
$ npm start

# 部署/需要配置 CI
$ git push origin master

# 分析包大小
$ npm run stat

TODO

  • CI 自动部署
  • 自写工具函数替代 lodash,减小打包体积
  • 自写组件替代 antd,减小打包体积
  • robots/sitemap
  • 点击喜欢与会背时的 Optimistic UI
  • typescript 支持
  • 添加经史子集
  • 在诗词的赏析中为其所引用到的古籍添加链接
  • eslint 支持
  • Sentry 支持
  • 图片优化
  • 添加错误提示组件
  • 更好的 dockerfile,更快的构建速度
  • 更好的 CI pipeline
  • 当出现 404 页面时,返回真正的 404 状态码,优化 SEO
  • 状态优化: 在我的喜欢列表页面取消喜欢时,切回标签页不需要重新发送请求便能展示最新数据 (List Optimistic UI)

打包体积优化记录

今天(2019/07/22)觉得很有必要把优化打包体积的过程给记录一下,至于以前的优化记录,如 antdlodash 依赖的移除,就不大详细记录了。

记录时使用 webpack-bundle-analyzer 这个包分析打包体积,并且把每次的报告页面放在 /static 下,报告的命名为 ${date}-${commit}

大致记录每次打包后服务端和客户端 js 总体积,以及首屏各项参数以及各种关键事件 (关键事件与机器,网络等也有很大相关性,仅做参考)。

00: ~350KB

刚开始写了两个页面,并且加上 lodashantd 后的初始大小

01: 191.64KB/242.74KB

去除 lodashantd 依赖,使打包体积大幅减小。这一步其实在半年前就已经做了,紧接着随后又写了很多页面与组件,所以在去除两者依赖后,真实的打包体积比现在还有缩减。

02: 176.51KB/245.02KB

集中 gql 管理后,在浏览器模式下可以把所有的 query 都是用 loader 打到 common.js 中,而这些零散的 query 在以前被按需加载时重复打包多次。

  • commit 01-02 diff
  • Server Stat
  • Client Stat
  • NetWwork statusBar: 18 requests | 223 KB transferred | 715 KB resources | Finish: 734 ms
  • Event: DCL 156.6 ms | FP 183.1 ms | FCP 183.1 ms | FMP 183.1 ms | Load 691.7 ms

03: 176.51KB/245.02KB

与 02 数据大致一致,但是与 04 只差了一个 commit,但打包体积变化巨大。为了聚焦问题,所以记了下来。

04: 176.52KB/193.25KB

当去除了 less 后,发现服务端的包体积竟然下降了 50+ KB,在分析图中发现原因在多个页面少打了 next 包进去。至于为什么会减少这么多体积,以后再做分析,先把 Stat 图记录下来

关注我

我一个关于前后端以及运维分享的公众号:记录我的学习与成长

我一个关于诗词分享的公众号:每天分享一篇古诗文

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].