feat: config environment
This commit is contained in:
parent
253358d0c1
commit
3bc199c649
|
@ -23,12 +23,16 @@ const localConfig = (filename) => {
|
||||||
|
|
||||||
const build = async (args = []) => {
|
const build = async (args = []) => {
|
||||||
const {production} = program.opts();
|
const {production} = program.opts();
|
||||||
const configFile = localConfig('webpack.config.js');
|
const eslintConfigFile = localConfig('.eslintrc.js');
|
||||||
|
const eslintDefaultsFile = localConfig('.eslint.defaults.js');
|
||||||
|
const neutrinoConfigFile = localConfig('.neutrinorc.js');
|
||||||
|
const postcssConfigFile = localConfig('postcss.config.js');
|
||||||
|
const webpackConfigFile = localConfig('webpack.config.js');
|
||||||
const child = spawn(
|
const child = spawn(
|
||||||
'webpack',
|
'webpack',
|
||||||
[
|
[
|
||||||
'--config',
|
'--config',
|
||||||
configFile,
|
webpackConfigFile,
|
||||||
'--mode',
|
'--mode',
|
||||||
production ? 'production' : 'development',
|
production ? 'production' : 'development',
|
||||||
]
|
]
|
||||||
|
@ -37,6 +41,11 @@ const build = async (args = []) => {
|
||||||
{
|
{
|
||||||
env: {
|
env: {
|
||||||
NODE_PATH: './node_modules',
|
NODE_PATH: './node_modules',
|
||||||
|
LATUS_ESLINT_CONFIG: eslintConfigFile,
|
||||||
|
LATUS_ESLINT_DEFAULTS: eslintDefaultsFile,
|
||||||
|
LATUS_NEUTRINO_CONFIG: neutrinoConfigFile,
|
||||||
|
LATUS_POSTCSS_CONFIG: postcssConfigFile,
|
||||||
|
LATUS_WEBPACK_CONFIG: webpackConfigFile,
|
||||||
...process.env,
|
...process.env,
|
||||||
},
|
},
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
|
|
@ -6,6 +6,10 @@ const mocha = require('@neutrinojs/mocha');
|
||||||
const react = require('@neutrinojs/react');
|
const react = require('@neutrinojs/react');
|
||||||
const nodeExternals = require('webpack-node-externals');
|
const nodeExternals = require('webpack-node-externals');
|
||||||
|
|
||||||
|
const {
|
||||||
|
LATUS_POSTCSS_CONFIG = require.resolve('@latus/build/build/postcss.config.js'),
|
||||||
|
} = process.env;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
options: {},
|
options: {},
|
||||||
use: [
|
use: [
|
||||||
|
@ -66,7 +70,7 @@ module.exports = {
|
||||||
useId: 'postcss',
|
useId: 'postcss',
|
||||||
options: {
|
options: {
|
||||||
config: {
|
config: {
|
||||||
path: process.cwd(),
|
path: dirname(LATUS_POSTCSS_CONFIG),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
const neutrino = require('neutrino');
|
const neutrino = require('neutrino');
|
||||||
|
|
||||||
module.exports = neutrino(require(`${__dirname}/.neutrinorc`)).webpack();
|
const {
|
||||||
|
LATUS_NEUTRINO_CONFIG = require.resolve('@latus/build/build/.neutrinorc.js'),
|
||||||
|
} = process.env;
|
||||||
|
|
||||||
|
module.exports = neutrino(require(LATUS_NEUTRINO_CONFIG)).webpack();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user