Issue #654
Use shelljs
to execute shell commands, and fs
to read and write. In public/index.html
specify some placeholder and we will replace those in our script
const fs = require('fs');
const shell = require('shelljs')
let indexHtml = fs.readFileSync(publicIndexHtmlPath, 'utf8')
indexHtml = indexHtml
.replace('CONSTANT_HTML_TITLE', `${app.name} - ${app.headline.title}`)
.replace('CONSTANT_HTML_META_DESCRIPTION', app.headline.text)
fs.writeFileSync(publicIndexHtmlPath, indexHtml)
// build
shell.cd('projects/my_react_app')
shell.exec('npm run build')
// copy
shell.exec(`cp -a projects/my_react_app web_server/public`)