feat(cli): add standalone CLI
This commit is contained in:
parent
c703065447
commit
807acf6473
|
@ -1,12 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const { render } = require('..')
|
||||
const resume = require('resume-schema/sample.resume.json')
|
||||
|
||||
const dest = path.resolve(__dirname, '../public');
|
||||
const html = render(resume)
|
||||
|
||||
fs.mkdirSync(dest, { recursive: true })
|
||||
fs.writeFileSync(path.resolve(dest, 'index.html'), html)
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env node
|
||||
const fs = require('fs')
|
||||
const { render } = require('..')
|
||||
|
||||
const resume = JSON.parse(fs.readFileSync(process.stdin.fd, 'utf-8'))
|
||||
const html = render(resume)
|
||||
|
||||
process.stdout.write(html)
|
|
@ -12,14 +12,16 @@
|
|||
},
|
||||
"license": "MIT",
|
||||
"author": "Rafael Bardini",
|
||||
"bin": "bin/cli.js",
|
||||
"files": [
|
||||
"bin",
|
||||
"index.js",
|
||||
"resume.hbs",
|
||||
"partials/*.hbs",
|
||||
"style.css"
|
||||
],
|
||||
"scripts": {
|
||||
"build:demo": "./bin/build-demo",
|
||||
"build:demo": "mkdir public && cat node_modules/resume-schema/sample.resume.json | ./bin/cli.js > public/index.html",
|
||||
"format": "prettier --write .",
|
||||
"lint": "eslint .",
|
||||
"postinstall": "husky install",
|
||||
|
|
Loading…
Reference in New Issue