Move config build in to copy task
This commit is contained in:
@@ -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" ]
|
||||
|
||||
24
setup.js
24
setup.js
@@ -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();
|
||||
}
|
||||
});
|
||||
@@ -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/**/*',
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user