* Push frontend to production servers at /index.html Local production builds will use local server instead of img.shields.io, to support local testing * Restore https://img.shields.io to example URIs
23 lines
869 B
JavaScript
23 lines
869 B
JavaScript
'use strict';
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const envFlag = require('node-env-flag');
|
|
const React = require('react');
|
|
const ReactDOMServer = require('react-dom/server');
|
|
const pretty = require('pretty');
|
|
const BadgeExamples = require('./badge-examples');
|
|
|
|
// const inputPath = path.join(__dirname, '..', 'all-badges.json');
|
|
// const badgeExampleData = JSON.parse(fs.readFileSync(inputPath));
|
|
const badgeExampleData = require('../lib/all-badge-examples');
|
|
|
|
const baseUri = process.env.BASE_URL;
|
|
const isProductionBuild = envFlag(process.env.PRODUCTION_BUILD, false);
|
|
|
|
const fragment = ReactDOMServer.renderToStaticMarkup(
|
|
<BadgeExamples examples={badgeExampleData} {...{baseUri, isProductionBuild}} />);
|
|
|
|
const outputPath = path.join(__dirname, '..', 'build', 'badge-examples-fragment.html');
|
|
fs.writeFileSync(outputPath, pretty(fragment));
|