Skip to content

Commit

Permalink
feat: support cli build resume
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed May 11, 2022
1 parent c81113d commit 4e04723
Show file tree
Hide file tree
Showing 27 changed files with 380 additions and 220 deletions.
116 changes: 111 additions & 5 deletions examples/resume-example/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,113 @@
# TEST
---
theme: true
print: true
github: 'https://github.com/Dunqing/resume'
---

# 张三

![头像](https://notion-avatar.vercel.app/api/svg/eyJmYWNlIjo5LCJub3NlIjoxMCwibW91dGgiOjEsImV5ZXMiOjcsImV5ZWJyb3dzIjoxMSwiZ2xhc3NlcyI6MCwiaGFpciI6MTEsImFjY2Vzc29yaWVzIjoxMywiZGV0YWlscyI6MCwiYmVhcmQiOjAsImZsaXAiOjAsImNvbG9yIjoicmdiYSgyNTUsIDAsIDAsIDApIiwic2hhcGUiOiJub25lIn0=)

- [https://github.com/Dunqing](https://github.com/Dunqing/resume)

- 123
- 456
>
- 678
- 8910
- google@gmail.com
- 3 年

>
- Telegram: @luckingforme

## 个人总结

- 熟练运用 React+Typescript 开发项目
- 参与开源项目,**为 Antd,Vite,Dumi 解决过 Issues,提交过上百个 PR**[ProComponents](https://github.com/ant-design/pro-components) `Collaborator`
- 看过 React,Vite,SWR,Acorn 等多个开源项目源码
- 较强的学习能力和自控能力

## 工作经历

### 深圳某公司

| 职位 | 工作时间 | 部门 | 地址 |
| :--------: | :------------: | :----: | :--: |
| 前端工程师 | 2021.01 ~ 至今 | 研发部 | 深圳 |

- 参与项目开发和迭代
- 使用 xxx 完成了 xxx
- 使用 React+Typescript+Antd+ProComponent 开发后台
- 抽离 edraw,taro-swr 等库做为 npm 库供多项目使用
- 把控代码格式和质量,代码审查和合并 merge request

### 深圳某公司

| 职位 | 工作时间 | 地址 |
| :--------: | :---------------: | :--: |
| 前端工程师 | 2020-08 ~ 2021-01 | 深圳 |

- 主要负责新项目的开发和一些还在迭代中的项目需求开发。
- 采用 uniapp 框架开发”车主特卖“小程序,在其中负责搭建小程序这个项目,封装一些针对微信原生 api 和 promise 化。
- 负责迭代”车芝嘛“小程序,该小程序基于 wepy 开发。另外还负责小程序后台的迭代和 bug 修复。

## 专业技能

1. 熟练使用 React, Typescript, Taro, Umi 开发项目
2. 熟练使用 Vite, Rollup,Webpack 等编译工具
3. 熟练使用 jest + enzyme / React Testing Libray 做代码测试
4. 掌握 gitlab-ci + docker 自动化部署
5. 熟悉 pnpm monorepo
6. 了解 Vue2, Express, Nestjs, Eslint, Prettier, Husky

## 项目经历

### Walle 后台(项目负责人)

- 使用 Ant Design Pro 做初始项目,后经过迭代改造使用 pnpm monorepo 进行整合项目
- 使用 Authing 做登录鉴权便于和飞书人员数据进行整合
- 使用 RBAC 模型去管理整个后台的权限,权限级别到按钮
- 使用 gitlab-ci 做自动化部署对 release-test-xxx 分支自动发布到测试环境,对 tag release-vx.x.x 自动发布到正式环境但需要人为点击最后一个步骤确保无误后部署到线上

### [swr-taro](https://www.npmjs.com/package/taro-swr)

**业务背景是由于公司的小程序对需要对接口进行管理,(替换原来实现的 useRequest,api 不太友好)。考虑到内部的 H5 使用的是 SWR,统一请求管理库对维护者更加友好,所以决定把 SWR 适配到 Taro 中去**

1. 调研 SWR 具体的实现
2. 将在 Taro 中不适配的方法改成为 Taro 原生的方法
3. 新增 revalidateOnShow,revalidateOnPullDown 属性让 SWR 可在页面切换时,下拉时刷新请求,更加贴合小程序
4. 发布到 npm,供内部多小程序使用

### 公司内部 Cli 开发(独立完成)

| 担任角色 | 项目周期 |
| :------: | :---------------: |
| 负责人 | 2020.11 ~ 2021.01 |

- **publish**:针对公司内部的开发流程实现了自动化推送到 build 分支之后自动打下 tag 发给测试&运维部署,并发送消息到钉钉群。
- **create**:一键创建整个项目并 install。现在 vue 模板采用 webpack5 搭建完成。使用的技术栈有:vue2.x 全家桶、typescript4.x、axios、babel、postcss、eslint
- **deploy**:自动部署代码到服务器

## 开源项目

- [resume](https://github.com/Dunqing/resume) 用 Markdown 写简历
- [vite-ant-design-pro](https://github.com/Dunqing/vite-ant-design-pro) 基于 Vite 的 ant-design-pro
- [unplugin-moment-to-dayjs](https://github.com/Dunqing/unplugin-moment-to-dayjs) 基于 Vite 的 ant-design-pro
- [unplugin-moment-to-dayjs](https://github.com/Dunqing/unplugin-moment-to-dayjs) 使用 dayjs 替换 moment,支持在 vite, rollup, webpack 中使用

## 教育经历

### Github 开源大学

| 专业 | 时间 |
| :------: | :---------------: |
| 开源捣鼓 | 2019.01 - 2021.01 |

## 其他

<p style="
display: flex;
justify-content: center;
padding: 0.5rem 0;
">
<img src="//github-readme-stats.vercel.app/api?username=Dunqing&show_icons=true&icon_color=CE1D2D&text_color=718096&bg_color=ffffff&hide_title=true">
</p>
6 changes: 3 additions & 3 deletions examples/resume-example/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "resume-example",
"private": true,
"scripts": {
"dev": "resume"
},
"dependencies": {
"@resumejs/core": "workspace:*",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"scripts": {
"dev": "resume"
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "pnpm run --parallel --filter ./packages/* dev",
"dev": "pnpm run --parallel --filter './packages/*' dev",
"build": "pnpm run --filter './packages/*' build",
"play": "pnpm run --filter ./playground dev",
"lint": "eslint . --fix",
"check-type": "tsc --noEmit"
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/plugins/header.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { Plugin } from 'unified'
import { visit } from 'unist-util-visit'
import type { Element } from 'hast'
import { u } from 'unist-builder'
import { isBlockquote, isImage, isParagraph, isUl } from './_util'

export const header: Plugin<[], Element> = function () {
Expand Down
12 changes: 3 additions & 9 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
Expand All @@ -20,7 +16,5 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"./src",
]
}
"include": ["./src"]
}
2 changes: 2 additions & 0 deletions packages/core/build.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { defineBuildConfig } from 'unbuild'
import packageJSON from './package.json'

export default defineBuildConfig({
entries: ['src/index.ts'],
declaration: true,
clean: true,
rollup: {},
externals: Object.keys(packageJSON.devDependencies),
})
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Show from 'F:\\dengqing\\resume\\packages\\core\\public\\Show.tsx'
import Show from './Show'
import 'uno.css'
import '@resumejs/components/style'


ReactDOM.render(
<React.StrictMode>
<Show />
Expand Down
21 changes: 16 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,35 @@
"name": "@resumejs/core",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "unbuild",
"dev": "unbuild --stub"
"exports": {
"./entry": {
"require": "./entry/main.tsx",
"import": "./entry/main.tsx"
}
},
"bin": {
"resume": "./dist/index.ts.mjs"
},
"dependencies": {
"scripts": {
"build": "unbuild",
"dev": "unbuild --stub"
},
"peerDependencies": {
"@resumejs/components": "workspace:*",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@resumejs/components": "workspace:*",
"@types/minimist": "^1.2.2",
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@unocss/preset-wind": "^0.33.2",
"@vitejs/plugin-react": "^1.0.7",
"kolorist": "^1.5.1",
"minimist": "^1.2.6",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"unbuild": "^0.7.4",
"unocss": "^0.33.2",
"vite": "^2.9.0"
Expand Down
10 changes: 7 additions & 3 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path, { isAbsolute } from 'path'
import type { InlineConfig } from 'vite'
import { build, createServer } from 'vite'
import { build, createServer, preview } from 'vite'
import react from '@vitejs/plugin-react'
import unocssVite from 'unocss/vite'
import presetWind from '@unocss/preset-wind'
Expand Down Expand Up @@ -30,11 +30,11 @@ const getViteConfig = () => {
logLevel: 'info',
configFile,
plugins: [
entry(__dirname),
react(),
entry(),
unocssVite({
presets: [presetWind()],
}),
react(),
loadResume(),
],
}
Expand All @@ -44,6 +44,10 @@ const getViteConfig = () => {

if (_.includes('build')) {
build(getViteConfig())
} else if (_.includes('preview')) {
preview(getViteConfig()).then((res) => {
res.printUrls()
})
} else {
createServer(getViteConfig()).then((res) => {
res.listen(3000).then(() => {
Expand Down
19 changes: 14 additions & 5 deletions packages/core/src/plugins/entry.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import path from 'path'
import type { Plugin } from 'vite'

export const entry = (cwd: string): Plugin => {
console.log(path.resolve(cwd, '../public/main.tsx'))
export const entry = (): Plugin => {
const RESUME_ENTRY = '/RESUME_ENTRY.tsx'
return {
name: 'resume:entry',
enforce: 'pre',
transformIndexHtml: {
enforce: 'pre',
transform() {
Expand All @@ -14,11 +12,22 @@ export const entry = (cwd: string): Plugin => {
tag: 'script',
attrs: {
type: 'module',
src: `/${path.resolve(cwd, '../public/main.tsx')}`,
src: RESUME_ENTRY,
},
injectTo: 'body',
},
]
},
},
resolveId(id) {
if (id === RESUME_ENTRY) return id
},
load(id) {
if (id === RESUME_ENTRY) {
return `
import "@resumejs/core/entry"
`
}
},
}
}
5 changes: 0 additions & 5 deletions packages/core/src/plugins/loadResume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ export const loadResume = (): Plugin => {
config = _config
},
async resolveId(id) {
// const react = await this.resolve('react')
// console.log(
// '🚀 ~ file: loadResume.ts ~ line 14 ~ resolveId ~ react',
// react
// )
if (id === virtualModuleId) {
return `\0${id}`
}
Expand Down
14 changes: 3 additions & 11 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
Expand All @@ -20,9 +16,5 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src",
"client.d.ts",
"public"
]
}
"include": ["src", "client.d.ts", "entry"]
}
5 changes: 4 additions & 1 deletion packages/create-resume/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const cwd = process.cwd()
const TEMPLATES = [
{
name: 'react-ts',
display: 'Typescript',
color: yellow,
},
{
name: 'template-markdown',
color: yellow,
},
]
Expand Down
2 changes: 1 addition & 1 deletion packages/create-resume/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"type": "git",
"url": "git+https://github.com/1247748612/Dungqing/resume.git"
},
"sideEffects": false,
"bin": {
"create-resume": "index.js"
},
"sideEffects": false,
"dependencies": {
"kolorist": "^1.5.1",
"minimist": "^1.2.6",
Expand Down
9 changes: 9 additions & 0 deletions packages/create-resume/template-markdown/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
theme: true
print: true
github: 'https://github.com/Dunqing/resume'
---

# 张三

![头像](https://notion-avatar.vercel.app/api/svg/eyJmYWNlIjo5LCJub3NlIjoxMCwibW91dGgiOjEsImV5ZXMiOjcsImV5ZWJyb3dzIjoxMSwiZ2xhc3NlcyI6MCwiaGFpciI6MTEsImFjY2Vzc29yaWVzIjoxMywiZGV0YWlscyI6MCwiYmVhcmQiOjAsImZsaXAiOjAsImNvbG9yIjoicmdiYSgyNTUsIDAsIDAsIDApIiwic2hhcGUiOiJub25lIn0=)
Loading

0 comments on commit 4e04723

Please sign in to comment.