-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
659 additions
and
738 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# TEST | ||
|
||
- 123 | ||
- 456 | ||
> | ||
- 678 | ||
- 8910 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link | ||
rel="icon" | ||
type="image/svg+xml" | ||
href="/src/favicon.svg" | ||
/> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0" | ||
/> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "resume-example", | ||
"private": true, | ||
"dependencies": { | ||
"@resumejs/core": "workspace:*", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
}, | ||
"scripts": { | ||
"dev": "resume" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
{ | ||
"name": "playground", | ||
"name": "@resumejs/core", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"build": "unbuild", | ||
"dev": "unbuild --stub" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-react": "^1.0.7", | ||
"vite": "^2.9.0", | ||
"unbuild": "^0.7.4", | ||
"@types/react": "^17.0.33", | ||
"@types/react-dom": "^17.0.10", | ||
"@unocss/preset-wind": "^0.33.2", | ||
"unocss": "^0.33.2" | ||
"bin": { | ||
"resume": "./dist/index.ts.mjs" | ||
}, | ||
"dependencies": { | ||
"@resumejs/components": "workspace:*", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"@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", | ||
"unbuild": "^0.7.4", | ||
"unocss": "^0.33.2", | ||
"vite": "^2.9.0" | ||
} | ||
} |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
packages/core/public/src/main.tsx → packages/core/public/main.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,53 @@ | ||
import path from 'path' | ||
import { createServer } from 'vite' | ||
import path, { isAbsolute } from 'path' | ||
import type { InlineConfig } from 'vite' | ||
import { build, createServer } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
import unocssVite from 'unocss/vite' | ||
import presetWind from '@unocss/preset-wind' | ||
import minimist from 'minimist' | ||
import { loadResume } from './plugins/loadResume' | ||
import { entry } from './plugins/entry' | ||
|
||
const cwd = process.cwd() | ||
|
||
createServer({ | ||
root: path.resolve(__dirname, '../public'), | ||
logLevel: 'info', | ||
// configFile: path.join(cwd, 'vite.config.js'), | ||
plugins: [ | ||
unocssVite({ | ||
presets: [presetWind()], | ||
}), | ||
react(), | ||
loadResume(cwd), | ||
], | ||
}).then((res) => { | ||
res.listen(3001).then(() => { | ||
res.printUrls() | ||
interface ArgvOptions extends minimist.ParsedArgs { | ||
template?: string | ||
config?: string | ||
} | ||
|
||
const { _, config } = minimist(process.argv.slice(2), { | ||
string: '-', | ||
}) as ArgvOptions | ||
|
||
const getViteConfig = () => { | ||
const configFile = config | ||
? isAbsolute(config) | ||
? config | ||
: path.join(cwd, config) | ||
: undefined | ||
|
||
const _config: InlineConfig = { | ||
logLevel: 'info', | ||
configFile, | ||
plugins: [ | ||
entry(__dirname), | ||
unocssVite({ | ||
presets: [presetWind()], | ||
}), | ||
react(), | ||
loadResume(), | ||
], | ||
} | ||
|
||
return _config | ||
} | ||
|
||
if (_.includes('build')) { | ||
build(getViteConfig()) | ||
} else { | ||
createServer(getViteConfig()).then((res) => { | ||
res.listen(3000).then(() => { | ||
res.printUrls() | ||
}) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import path from 'path' | ||
import type { Plugin } from 'vite' | ||
|
||
export const entry = (cwd: string): Plugin => { | ||
console.log(path.resolve(cwd, '../public/main.tsx')) | ||
return { | ||
name: 'resume:entry', | ||
enforce: 'pre', | ||
transformIndexHtml: { | ||
enforce: 'pre', | ||
transform() { | ||
return [ | ||
{ | ||
tag: 'script', | ||
attrs: { | ||
type: 'module', | ||
src: `/${path.resolve(cwd, '../public/main.tsx')}`, | ||
}, | ||
}, | ||
] | ||
}, | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
}, | ||
"include": [ | ||
"src", | ||
"publick" | ||
"client.d.ts", | ||
"public" | ||
] | ||
} |
Oops, something went wrong.