Move config build in to copy task

This commit is contained in:
2017-02-17 15:55:29 +00:00
parent 92ff615f4c
commit 1ce3673896
5 changed files with 11 additions and 45 deletions

View File

@@ -1,5 +1,6 @@
import path from 'path';
import chokidar from 'chokidar';
import { exec } from 'child_process';
import { writeFile, copyFile, makeDir, copyDir, cleanDir } from './lib/fs';
import pkg from '../package.json';
import { format } from './run';
@@ -23,7 +24,16 @@ async function copy() {
copyDir('src/content', 'build/content'),
copyDir('public', 'build/public'),
]);
await exec('git log -n 1 --pretty=format:"%H"', (err, stdout) => {
if (stdout) {
writeFile('build/public/config.json', JSON.stringify({
build: {
hash: stdout,
time: new Date(),
},
}, null, 2));
}
});
if (process.argv.includes('--watch')) {
const watcher = chokidar.watch([
'src/content/**/*',

View File

@@ -1,12 +1,3 @@
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import fs from 'fs';
import path from 'path';
import glob from 'glob';

View File

@@ -1,12 +1,3 @@
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
const MarkdownIt = require('markdown-it');
const fm = require('front-matter');