-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows env specific kyt.configs for build command (#70)
* saving for now. not working * turning kytconfig into function. still not working yet * works now * moving kytConfig to utils * saving for now. not working * turning kytconfig into function. still not working yet * works now * moving kytConfig to utils * updating everything except test. * cleanup * Adding path info * moving loadConfigAndDo inline * removing program param
- Loading branch information
1 parent
51d3b99
commit 13c84b4
Showing
15 changed files
with
99 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
// Merges base and user kyt config | ||
|
||
const path = require('path'); | ||
const shell = require('shelljs'); | ||
const baseConfig = require('./../config/kyt.base.config'); | ||
const merge = require('ramda').merge; | ||
|
||
module.exports = (optionalConfig) => { | ||
if (global.config) return; | ||
|
||
const userConfigPath = optionalConfig ? | ||
path.join(process.env.USER_ROOT, optionalConfig) : | ||
path.join(process.env.USER_ROOT, './kyt.config.js'); | ||
let config; | ||
const logger = console; | ||
|
||
// Add base config option for productionPublicPath | ||
baseConfig.productionPublicPath = '/assets/'; | ||
// Find user config | ||
if (shell.test('-f', userConfigPath)) { | ||
try { | ||
logger.info(`Using kyt config at ${userConfigPath}`); | ||
config = require(userConfigPath); // eslint-disable-line global-require | ||
} catch (error) { | ||
logger.error('Error loading your kyt.config.js:', error); | ||
process.exit(); | ||
} | ||
} | ||
|
||
config = merge(baseConfig, config); | ||
// add userRootPath to Config | ||
config.userRootPath = process.env.USER_ROOT; | ||
|
||
// Create default modify function | ||
if (typeof config.modifyWebpackConfig !== 'function') { | ||
config.modifyWebpackConfig = (webpackConfig) => webpackConfig; | ||
} | ||
|
||
// In case `reactHotLoader` is undefined, make it a boolean | ||
config.reactHotLoader = !!config.reactHotLoader; | ||
global.config = Object.freeze(config); | ||
}; |