Skip to content

Commit

Permalink
feat: update deps and fix lint error, types error
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Aug 11, 2023
1 parent 7045a9e commit c72d371
Show file tree
Hide file tree
Showing 45 changed files with 2,002 additions and 1,470 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.js
Expand Up @@ -10,4 +10,7 @@ module.exports = {
'prettier/prettier': 'error',
'antfu/if-newline': 'off',
},
globals: {
process: true,
},
}
34 changes: 17 additions & 17 deletions package.json
Expand Up @@ -11,31 +11,31 @@
"prepublishOnly": "pnpm run build",
"test": "vitest",
"release": "bumpp packages/*/package.json templates/*/package.json --no-verify --commit --push --tag",
"check-type": "tsc --noEmit"
"typecheck": "tsc --noEmit"
},
"dependencies": {
"eslint-plugin-prettier": "^4.2.1"
"eslint-plugin-prettier": "^5.0.0"
},
"devDependencies": {
"@antfu/eslint-config-react": "^0.38.2",
"@antfu/eslint-config-react": "^0.40.2",
"@resumejs/components": "workspace:*",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "14.0.0",
"@types/node": "^18.15.11",
"@types/react": "^18.0.32",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^3.1.0",
"bumpp": "^9.1.0",
"eslint": "^8.37.0",
"eslint-config-prettier": "^8.8.0",
"jsdom": "^21.1.1",
"pnpm": "^8.1.0",
"prettier": "^2.8.7",
"@types/node": "^20.4.9",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"bumpp": "^9.1.1",
"eslint": "^8.46.0",
"eslint-config-prettier": "^9.0.0",
"jsdom": "^22.1.0",
"pnpm": "^8.6.12",
"prettier": "^3.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.0.3",
"vite": "^4.2.1",
"vitest": "^0.29.8"
"typescript": "^5.1.6",
"vite": "^4.4.9",
"vitest": "^0.34.1"
},
"pnpm": {
"overrides": {
Expand Down
32 changes: 16 additions & 16 deletions packages/components/package.json
Expand Up @@ -18,8 +18,8 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"import": "./dist/index.mjs"
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"main": "dist/index.js",
Expand All @@ -37,28 +37,28 @@
"dependencies": {
"@resumejs/template": "workspace:*",
"@resumejs/template-default": "workspace:*",
"@types/hast": "^2.3.4",
"clsx": "^1.2.1",
"hast-util-has-property": "^2.0.1",
"@types/hast": "^3.0.0",
"clsx": "^2.0.0",
"hast-util-has-property": "^3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^8.0.6",
"react-markdown": "^8.0.7",
"rehype-raw": "^6.1.1",
"remark-frontmatter": "^4.0.1",
"remark-gfm": "^3.0.1",
"unified": "^10.1.2",
"unist-builder": "^3.0.1",
"unist-util-is": "^5.2.1",
"unist-util-visit": "^4.1.2",
"vite-plugin-dts": "^2.1.0",
"yaml": "^2.2.1"
"unist-builder": "^4.0.0",
"unist-util-is": "^6.0.0",
"unist-util-visit": "^5.0.0",
"vite-plugin-dts": "^3.5.1",
"yaml": "^2.3.1"
},
"devDependencies": {
"@types/mdast": "^3.0.11",
"@types/react": "^18.0.32",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.2.1"
"@types/mdast": "^4.0.0",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"vite": "^4.4.9"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/Resume.tsx
Expand Up @@ -36,7 +36,7 @@ export interface ResumeProps extends Omit<ReactMarkdownOptions, 'components'> {
onDarkClass?: (className: string, action: 'add' | 'remove') => void
}

export const Resume = (props: ResumeProps) => {
export function Resume(props: ResumeProps) {
const {
children,
rehypePlugins = [],
Expand Down Expand Up @@ -91,7 +91,7 @@ export const Resume = (props: ResumeProps) => {
dark: !props.onDarkClass && dark,
},
'r-resume',
props.className
props.className,
)}
components={components}
remarkPlugins={[...remarkPlugins, remarkFrontmatter, meta, remarkGfm]}
Expand Down
38 changes: 24 additions & 14 deletions packages/components/src/plugins/_util.ts
Expand Up @@ -3,21 +3,31 @@ import { is } from 'unist-util-is'

const HeadingTag = ['h1', 'h2', 'h3']

export const isTag = (t: any, tagName: string | string[]) =>
is(t, { type: 'element' }) &&
[tagName].flat().includes((t as Element).tagName)
export const isHeading = (t: any, tagName?: string | string[]): t is Element =>
is(t, { type: 'element' }) && tagName
export function isTag(t: any, tagName: string | string[]) {
return (
is(t, { type: 'element' }) &&
[tagName].flat().includes((t as Element).tagName)
)
}
export function isHeading(t: any, tagName?: string | string[]): t is Element {
return is(t, { type: 'element' }) && tagName
? [tagName].flat().includes((t as Element)?.tagName)
: HeadingTag.includes((t as Element)?.tagName)
}
export const isParagraph = (t: any) => is(t, { type: 'element', tagName: 'p' })
export const isTable = (t: any): t is Element =>
is(t, { type: 'element', tagName: 'table' }) &&
HeadingTag.includes((t as Element).tagName)
export function isTable(t: any): t is Element {
return (
is(t, { type: 'element', tagName: 'table' }) &&
HeadingTag.includes((t as Element).tagName)
)
}
export const isText = (t: any): t is Text => is(t, { type: 'text' })
export const isUl = <T>(t: T): t is T =>
is(t, { type: 'element', tagName: 'ul' })
export const isBlockquote = (t: any) =>
is(t, { type: 'element', tagName: 'blockquote' })
export const isImage = (t: any): t is Element =>
is(t, { type: 'element', tagName: 'img' })
export function isUl<T>(t: T): t is T {
return is(t, { type: 'element', tagName: 'ul' })
}
export function isBlockquote(t: any) {
return is(t, { type: 'element', tagName: 'blockquote' })
}
export function isImage(t: any): t is Element {
return is(t, { type: 'element', tagName: 'img' })
}
7 changes: 4 additions & 3 deletions packages/components/src/plugins/card.ts
Expand Up @@ -41,6 +41,7 @@ export const card: Plugin<[], Root> = function () {
cardList.push({
type: 'element',
tagName: 'card',
properties: {},
position: table.position,
children: cardInfo.map((item, ii) => {
return u(
Expand All @@ -51,15 +52,15 @@ export const card: Plugin<[], Root> = function () {
index: ii,
},
},
[item.label, u('text', item.label ? ':' : ''), item.value!]
[item.label, u('text', item.label ? ':' : ''), item.value!],
)
}),
})
}
},
)

parent?.children.splice(index!, 1, ...cardList)
}
},
)
}
}
2 changes: 1 addition & 1 deletion packages/components/src/plugins/className.ts
Expand Up @@ -12,7 +12,7 @@ export const className: Plugin<[], Element> = function () {
(element as Element).properties,
{
className: clsx(`r-${(element as Element).tagName}`, className),
}
},
)
})
}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/plugins/description.ts
Expand Up @@ -16,7 +16,7 @@ export const description: Plugin<[], Element> = function () {

const prev = parent!.children[index! - 2]
if (isTable(prev) || isHeading(prev)) element.tagName = 'description'
}
},
)
}
}
3 changes: 2 additions & 1 deletion packages/components/src/plugins/header.ts
Expand Up @@ -58,9 +58,10 @@ export const header: Plugin<[], Element> = function () {
parent!.children.splice(index!, 1, {
type: 'element',
tagName: 'header',
properties: {},
children: headerChildren,
})
}
},
)
}
}
2 changes: 1 addition & 1 deletion packages/components/src/plugins/meta.ts
Expand Up @@ -12,7 +12,7 @@ export const meta: Plugin<[], YAML> = function () {
},
(el) => {
file.data.meta = yaml.parse(el.value)
}
},
)
}
}
6 changes: 3 additions & 3 deletions packages/components/src/plugins/task.ts
Expand Up @@ -40,11 +40,11 @@ export const task: Plugin<[], Element> = function () {
(input) => {
if (input.properties!.type === 'checkbox')
input.tagName = 'task-item-checkbox'
}
},
)
}
},
)
}
},
)
}
}
7 changes: 4 additions & 3 deletions packages/components/src/plugins/toolbox.ts
Expand Up @@ -16,12 +16,13 @@ export const toolbox: Plugin<[], Root> = function () {
u(
'element',
{
properties: {},
tagName: 'toolbox',
data: file.data.meta as any,
},
[]
)
)
[],
),
),
)
}
}
9 changes: 5 additions & 4 deletions packages/create-resumejs/index.js
Expand Up @@ -3,8 +3,9 @@

// Avoids autoconversion to number of the project name by defining that the args
// non associated with an option ( _ ) needs to be parsed as a string. See #4606
const fs = require('fs')
const path = require('path')
const fs = require('node:fs')
const path = require('node:path')
const process = require('node:process')
const argv = require('minimist')(process.argv.slice(2), { string: ['_'] })
const prompts = require('prompts')
const { yellow, red, reset } = require('kolorist')
Expand Down Expand Up @@ -91,7 +92,7 @@ async function init() {
onCancel: () => {
throw new Error(`${red('✖')} Operation cancelled`)
},
}
},
)
} catch (cancelled) {
console.log(cancelled.message)
Expand Down Expand Up @@ -157,7 +158,7 @@ function copy(src, dest) {

function isValidPackageName(projectName) {
return /^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(
projectName
projectName,
)
}

Expand Down
2 changes: 1 addition & 1 deletion packages/create-resumejs/package.json
Expand Up @@ -24,7 +24,7 @@
"create-resumejsjs": "index.js"
},
"dependencies": {
"kolorist": "^1.7.0",
"kolorist": "^1.8.0",
"minimist": "^1.2.8",
"prompts": "^2.4.2"
},
Expand Down
18 changes: 9 additions & 9 deletions packages/create-resumejs/template-react-ts/package.json
Expand Up @@ -8,19 +8,19 @@
"preview": "vite preview"
},
"dependencies": {
"@iconify-json/carbon": "^1.1.16",
"@iconify-json/carbon": "^1.1.19",
"@resumejs/components": "latest",
"@unocss/preset-icons": "^0.50.6",
"@unocss/preset-wind": "^0.50.6",
"@unocss/reset": "^0.50.6",
"@unocss/preset-icons": "^0.55.0",
"@unocss/preset-wind": "^0.55.0",
"@unocss/reset": "^0.55.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"unocss": "^0.50.6"
"unocss": "^0.55.0"
},
"devDependencies": {
"@types/react": "^18.0.32",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^3.1.0",
"vite": "^4.2.1"
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"vite": "^4.4.9"
}
}
2 changes: 1 addition & 1 deletion packages/create-resumejs/template-react-ts/src/Show.tsx
@@ -1,7 +1,7 @@
import { Resume } from '@resumejs/components'
import md from '../../README.md?raw'

const Show = () => {
function Show() {
return (
<div className="flex justify-center">
<Resume className="md:w-screen-md">{md}</Resume>
Expand Down
2 changes: 1 addition & 1 deletion packages/create-resumejs/template-react-ts/src/main.tsx
Expand Up @@ -6,5 +6,5 @@ ReactDOM.render(
<React.StrictMode>
<Show />
</React.StrictMode>,
document.getElementById('root')
document.getElementById('root'),
)
14 changes: 7 additions & 7 deletions packages/resume/package.json
Expand Up @@ -31,16 +31,16 @@
"dependencies": {
"@resumejs/components": "workspace:*",
"@types/minimist": "^1.2.2",
"@types/react": "^18.0.32",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^3.1.0",
"kolorist": "^1.7.0",
"magic-string": "^0.30.0",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"kolorist": "^1.8.0",
"magic-string": "^0.30.2",
"minimist": "^1.2.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"unbuild": "^1.2.0",
"vite": "^4.2.1"
"unbuild": "^1.2.1",
"vite": "^4.4.9"
},
"publishConfig": {
"access": "public"
Expand Down
5 changes: 3 additions & 2 deletions packages/resume/src/index.ts
@@ -1,4 +1,5 @@
import path, { isAbsolute } from 'path'
import path, { isAbsolute } from 'node:path'
import process from 'node:process'
import type { InlineConfig } from 'vite'
import { build, createServer, preview } from 'vite'
import react from '@vitejs/plugin-react'
Expand All @@ -17,7 +18,7 @@ const { _, config, template } = minimist(process.argv.slice(2), {
string: '-',
}) as ArgvOptions

const getViteConfig = () => {
function getViteConfig() {
const configFile = config
? isAbsolute(config)
? config
Expand Down

1 comment on commit c72d371

@vercel
Copy link

@vercel vercel bot commented on c72d371 Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

resume – ./

resume-git-main-dengqing.vercel.app
resume.todev.cc
resume-dengqing.vercel.app
resumejs.vercel.app

Please sign in to comment.