mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add Git revision to build version
This commit is contained in:
@@ -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',
|
||||
}
|
||||
);
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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 };
|
||||
Reference in New Issue
Block a user