Add Git revision to build version

This commit is contained in:
Brian Vaughn
2019-04-11 18:44:44 -07:00
parent 3ea5fac959
commit 9a0cf68a4d
5 changed files with 42 additions and 40 deletions
+6 -2
View File
@@ -32,7 +32,9 @@ const build = async (tempPath, manifestPath) => {
`${webpackPath} --config webpack.config.js --output-path ${binPath}`,
{
cwd: __dirname,
env: Object.assign({}, process.env, { NODE_ENV: 'production' }),
env: Object.assign({}, process.env, {
NODE_ENV: 'production',
}),
stdio: 'inherit',
}
);
@@ -40,7 +42,9 @@ const build = async (tempPath, manifestPath) => {
`${webpackPath} --config webpack.backend.js --output-path ${binPath}`,
{
cwd: __dirname,
env: Object.assign({}, process.env, { NODE_ENV: 'production' }),
env: Object.assign({}, process.env, {
NODE_ENV: 'production',
}),
stdio: 'inherit',
}
);
+3 -12
View File
@@ -1,21 +1,12 @@
const { execSync } = require('child_process');
const { readFileSync } = require('fs');
const { resolve } = require('path');
const { DefinePlugin } = require('webpack');
const { getGitHubURL, getVersionString } = require('../../utils');
const __DEV__ = process.env.NODE_ENV !== 'production';
// TODO potentially replac this with an fb.me URL (if it can forward the query params)
const GITHUB_URL = execSync('git remote get-url origin')
.toString()
.trim()
.replace(':', '/')
.replace('git@', 'https://')
.replace('.git', '');
const DEVTOOLS_VERSION = JSON.parse(
readFileSync(resolve(__dirname, '../../../package.json'))
).version;
const GITHUB_URL = getGitHubURL();
const DEVTOOLS_VERSION = getVersionString();
module.exports = {
mode: __DEV__ ? 'development' : 'production',
+3 -12
View File
@@ -1,22 +1,13 @@
const { execSync } = require('child_process');
const { readFileSync } = require('fs');
const { resolve } = require('path');
const { DefinePlugin } = require('webpack');
const { getGitHubURL, getVersionString } = require('../../utils');
const NODE_ENV = process.env.NODE_ENV;
const __DEV__ = NODE_ENV !== 'production';
// TODO potentially replac this with an fb.me URL (if it can forward the query params)
const GITHUB_URL = execSync('git remote get-url origin')
.toString()
.trim()
.replace(':', '/')
.replace('git@', 'https://')
.replace('.git', '');
const DEVTOOLS_VERSION = JSON.parse(
readFileSync(resolve(__dirname, '../../../package.json'))
).version;
const GITHUB_URL = getGitHubURL();
const DEVTOOLS_VERSION = getVersionString();
module.exports = {
mode: __DEV__ ? 'development' : 'production',
+3 -14
View File
@@ -1,23 +1,12 @@
const { execSync } = require('child_process');
const { readFileSync } = require('fs');
const { resolve } = require('path');
const { DefinePlugin } = require('webpack');
const { getGitHubURL, getVersionString } = require('../utils');
const __DEV__ = process.env.NODE_ENV !== 'production';
// TODO potentially replac this with an fb.me URL (if it can forward the query params)
const GITHUB_URL = execSync('git remote get-url origin')
.toString()
.trim()
.replace(':', '/')
.replace('git@', 'https://')
.replace('.git', '');
const DEVTOOLS_VERSION = JSON.parse(
readFileSync(resolve(__dirname, '../../package.json'))
).version;
// TODO Share Webpack configs like alias
const GITHUB_URL = getGitHubURL();
const DEVTOOLS_VERSION = getVersionString();
module.exports = {
mode: 'development',
+27
View File
@@ -0,0 +1,27 @@
const { execSync } = require('child_process');
const { readFileSync } = require('fs');
const { resolve } = require('path');
function getGitHubURL() {
// TODO potentially replac this with an fb.me URL (if it can forward the query params)
return execSync('git remote get-url origin')
.toString()
.trim()
.replace(':', '/')
.replace('git@', 'https://')
.replace('.git', '');
}
function getVersionString() {
const packageVersion = JSON.parse(
readFileSync(resolve(__dirname, '../package.json'))
).version;
const commit = execSync('git show -s --format=%h')
.toString()
.trim();
return `${packageVersion}-${commit}`;
}
module.exports = { getGitHubURL, getVersionString };