diff --git a/Dockerfile b/Dockerfile index 5ce6670..7d4dcb7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,8 +32,6 @@ RUN curl https://api.rollbar.com/api/1/deploy/ \ -F revision=$(git log -n 1 --pretty=format:"%H") \ -F local_username="$(git log -n 1 --pretty=format:"%an")" -RUN node setup.js - WORKDIR /usr/src/app/build CMD [ "node", "server.js" ] diff --git a/setup.js b/setup.js deleted file mode 100644 index c3cecb9..0000000 --- a/setup.js +++ /dev/null @@ -1,24 +0,0 @@ -/* eslint-disable no-console */ -const exec = require('child_process').exec; -const fs = require('fs'); - -const config = { - build: {}, -}; - -function writeConfigFile() { - fs.writeFile('build/public/config.json', JSON.stringify(config), (err) => { - if (err) { - return console.error(err); - } - return console.log('Config file saved'); - }); -} - -exec('git log -n 1 --pretty=format:"%H"', (err, stdout) => { - if (stdout) { - config.build.hash = stdout; - config.build.time = new Date(); - writeConfigFile(); - } -}); diff --git a/tools/copy.js b/tools/copy.js index 454779b..4968fce 100644 --- a/tools/copy.js +++ b/tools/copy.js @@ -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/**/*', diff --git a/tools/lib/fs.js b/tools/lib/fs.js index 2104dc5..390c4f4 100644 --- a/tools/lib/fs.js +++ b/tools/lib/fs.js @@ -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'; diff --git a/tools/lib/markdown-loader.js b/tools/lib/markdown-loader.js index 7659249..cca8e7a 100644 --- a/tools/lib/markdown-loader.js +++ b/tools/lib/markdown-loader.js @@ -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');