Skip to content

Commit

Permalink
dashboard.jsx: Add environment REPOSITORIES
Browse files Browse the repository at this point in the history
Closes #3
  • Loading branch information
li-boxuan committed Jul 24, 2018
1 parent ac8b070 commit 892b87f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/components/dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ const SAMPLE_REPOS = [
{repoOwner: 'jquery', repoName: 'jquery'}
];

// from pre-fetch config (see webpack configuration)
if (typeof REPOSITORIES !== 'undefined') {
const repos = REPOSITORIES;
const repoOwner = repos.split(':')[0];
const repoNames = repos.substring(repos.indexOf(':') + 1).split('|');
SAMPLE_REPOS.push({
repoOwner,
repoNames,
comment: ' (from pre-fetch config)',
});
}

class ListGroupWithMore extends Component {
state = {morePressedCount: 0};
Expand Down
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ module.exports = {
},
plugins: isBuild ? [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
'process.env.NODE_ENV': JSON.stringify('production'),
REPOSITORIES: JSON.stringify(process.env['REPOSITORIES']),
}),
new ExtractTextPlugin('app.css'),
new UglifyJsPlugin()
Expand Down

0 comments on commit 892b87f

Please sign in to comment.