Skip to content

Commit

Permalink
refactor(build): flatten /config and /build
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason committed Aug 9, 2016
1 parent e1c248f commit 18ac375
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 53 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# HEADS UP!
#
# 'npm run clean' runs rm -rf on all lines in this file.
#

npm-debug.log*
node_modules/
bower_components/
Expand Down
12 changes: 6 additions & 6 deletions config/_default.js → config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const __DEV__ = env === 'development'
const __STAGING__ = env === 'staging'
const __TEST__ = env === 'test'
const __PROD__ = env === 'production'
const __BASE__ = '/'
const __BASE__ = __PROD__ ? '/stardust' : ''

let config = {
env,

// ----------------------------------
// Project Structure
// ----------------------------------
path_base: path.resolve(__dirname, '../'),
path_base: __dirname,
dir_src: 'src',
dir_dist: 'dist',
dir_docs_root: 'docs',
Expand Down Expand Up @@ -52,14 +52,14 @@ config = Object.assign({}, config, {
// ----------------------------------
// Compiler Configuration
// ----------------------------------
compiler_devtool: false,
compiler_hash_type: 'hash',
compiler_devtool: __DEV__ && 'eval-cheap-module-source-map' || __STAGING__ && 'source-map',
compiler_hash_type: __PROD__ ? 'chunkhash' : 'hash',
compiler_inline_manifest: false,
compiler_fail_on_warning: false,
compiler_fail_on_warning: __TEST__ || __PROD__,
compiler_lint: argv.lint !== false,
compiler_quiet: false,
compiler_output_path: paths.base(config.dir_docs_dist),
compiler_public_path: __BASE__,
compiler_public_path: __BASE__ || '/',
compiler_vendor: [
'bluebird',
'classnames',
Expand Down
5 changes: 0 additions & 5 deletions config/development.js

This file was deleted.

6 changes: 0 additions & 6 deletions config/index.js

This file was deleted.

11 changes: 0 additions & 11 deletions config/production.js

This file was deleted.

6 changes: 0 additions & 6 deletions config/staging.js

This file was deleted.

4 changes: 0 additions & 4 deletions config/test.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/app/Components/Sidebar/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class Sidebar extends Component {
return (
<Menu className='vertical fixed inverted' style={{ ...style }}>
<div className='item'>
<img src={(__PROD__ ? '/stardust/' : '/') + 'logo.png'} style={{ marginRight: '1em' }} />
<img src={__BASE__ + '/logo.png'} style={{ marginRight: '1em' }} />
<strong>UI-React Docs</strong>
</div>
<a className='item' href='https://github.com/TechnologyAdvice/stardust'>
Expand Down
6 changes: 4 additions & 2 deletions docs/app/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<base href='<%= htmlWebpackPlugin.options.base %>'>
<link rel="shortcut icon" type="image/x-icon" href="<%= htmlWebpackPlugin.options.base %>logo.png" />
<% if (htmlWebpackPlugin.options.baseHref) { %>
<base href="<%= htmlWebpackPlugin.options.baseHref %>" />
<% } %>
<link rel="shortcut icon" type="image/x-icon" href="<%= htmlWebpackPlugin.options.base %>/logo.png" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/styles/github-gist.min.css">
<link rel="stylesheet"
href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/<%= htmlWebpackPlugin.options.versions.sui %>/semantic.min.css">
Expand Down
2 changes: 1 addition & 1 deletion gulp/tasks/dll.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const g = loadPlugins()
const { log, PluginError } = g.util

task('dll', (cb) => {
const webpackDLLConfig = require('../../build/webpack.dll')
const webpackDLLConfig = require('../../webpack.dll')
const compiler = webpack(webpackDLLConfig)

compiler.run((err, stats) => {
Expand Down
2 changes: 1 addition & 1 deletion gulp/tasks/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ task('generate-docs-json', () => {
})

task('webpack-docs', (cb) => {
const webpackConfig = require('../../build/webpack.config')
const webpackConfig = require('../../webpack.config')
const compiler = webpack(webpackConfig)

compiler.run((err, stats) => {
Expand Down
2 changes: 1 addition & 1 deletion gulp/tasks/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const g = loadPlugins()
const { log, colors } = g.util

const serve = (cb) => {
const webpackConfig = require('../../build/webpack.config')
const webpackConfig = require('../../webpack.config')
const app = express()
const compiler = webpack(webpackConfig)

Expand Down
2 changes: 1 addition & 1 deletion build/karma.conf.babel.js → karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { argv } = require('yargs')
const config = require('../config')
const config = require('./config')
const webpack = require('webpack')
const webpackConfig = require('./webpack.config')

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"start": "npm run docs",
"start:local-modules": "npm run docs -- --local-modules",
"pretest": "gulp dll",
"test": "cross-env NODE_ENV=test karma start build/karma.conf.babel.js",
"test": "cross-env NODE_ENV=test karma start",
"test:watch": "npm run test --silent -- --watch"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion build/webpack.config.js → webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const config = require('../config')
const config = require('./config')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const _ = require('lodash')
Expand Down
2 changes: 1 addition & 1 deletion build/webpack.dll.js → webpack.dll.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const webpack = require('webpack')

const config = require('../config')
const config = require('./config')
const webpackDllConfig = { module: {} }

const { paths } = config
Expand Down

0 comments on commit 18ac375

Please sign in to comment.