Skip to content

Commit fc322c9

Browse files
committed
feat(resume): support resumeFile options in cli
1 parent 74c5334 commit fc322c9

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

packages/resume/src/index.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,22 @@ import { entry } from './plugins/entry'
1010
const cwd = process.cwd()
1111

1212
interface ArgvOptions extends minimist.ParsedArgs {
13+
/**
14+
* which template what you want to use
15+
*/
1316
template?: string
17+
/**
18+
* vite config file path
19+
*/
1420
config?: string
21+
/**
22+
* resume file path, should be *.md
23+
* @default README.md
24+
*/
25+
resumeFile?: string
1526
}
1627

17-
const { _, config, template } = minimist(process.argv.slice(2), {
28+
const { _, config, template, resumeFile } = minimist(process.argv.slice(2), {
1829
string: '-',
1930
}) as ArgvOptions
2031

@@ -32,6 +43,7 @@ function getViteConfig() {
3243
react(),
3344
entry({
3445
template,
46+
resumeFile,
3547
}),
3648
VitePWA({ registerType: 'autoUpdate' }),
3749
],

packages/resume/src/plugins/entry.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ import MagicString from 'magic-string'
44

55
interface EntryPluginOptions {
66
template?: string
7+
resumeFile?: string
78
}
89

9-
export function entry({ template }: EntryPluginOptions = {}): Plugin {
10+
export function entry({
11+
template,
12+
resumeFile = 'README.md',
13+
}: EntryPluginOptions = {}): Plugin {
1014
const RESUME_ENTRY = '/RESUME_ENTRY.tsx'
1115
let resumePath = ''
1216

1317
return {
1418
name: 'resume:entry',
1519
configResolved(config) {
16-
resumePath = path.resolve(config.root, 'README.md')
20+
resumePath = path.resolve(config.root, resumeFile)
1721
},
1822
transformIndexHtml: {
1923
enforce: 'pre',

0 commit comments

Comments
 (0)