Build and deploy demo

- Ignore public page
- Add netlify.toml
- Add build:demo script
This commit is contained in:
Rafael Bardini 2020-07-05 18:21:09 +02:00
parent e260c5b53d
commit f35450130a
7 changed files with 19 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.nyc_output .nyc_output
coverage coverage
node_modules node_modules
public
npm-debug.log npm-debug.log

View File

@ -1,3 +1,4 @@
.nyc_output .nyc_output
coverage coverage
public
tap-snapshots tap-snapshots

12
bin/build-demo Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const { render } = require('..')
const resume = require('../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)

3
netlify.toml Normal file
View File

@ -0,0 +1,3 @@
[build]
command = "npm run build:example"
publish = "public"

View File

@ -18,6 +18,7 @@
"style.css" "style.css"
], ],
"scripts": { "scripts": {
"build:demo": "./bin/build-demo",
"format": "prettier --write .", "format": "prettier --write .",
"lint": "eslint .", "lint": "eslint .",
"test": "tap" "test": "tap"

View File

@ -1,7 +1,7 @@
const { test } = require('tap') const { test } = require('tap')
const { render } = require('..') const { render } = require('..')
const resume = require('./resume.json') const resume = require('../resume.json')
test('renders a resume', t => { test('renders a resume', t => {
t.matchSnapshot(render(resume)) t.matchSnapshot(render(resume))