feat: build profiling
This commit is contained in:
parent
a7150c1d92
commit
78b4d3a828
|
@ -1,9 +1,15 @@
|
||||||
|
import {join} from 'path';
|
||||||
|
|
||||||
import airbnb from '@neutrinojs/airbnb';
|
import airbnb from '@neutrinojs/airbnb';
|
||||||
|
|
||||||
import {Hooks} from '../flecks';
|
import {Hooks} from '../flecks';
|
||||||
import commands from './commands';
|
import commands from './commands';
|
||||||
import R from '../bootstrap/require';
|
import R from '../bootstrap/require';
|
||||||
|
|
||||||
|
const {
|
||||||
|
FLECKS_CORE_ROOT = process.cwd(),
|
||||||
|
} = process.env;
|
||||||
|
|
||||||
export {dump as dumpYml, load as loadYml} from 'js-yaml';
|
export {dump as dumpYml, load as loadYml} from 'js-yaml';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -21,23 +27,35 @@ export {JsonStream, transform} from './stream';
|
||||||
export default {
|
export default {
|
||||||
[Hooks]: {
|
[Hooks]: {
|
||||||
'@flecks/core.build': (target, config, flecks) => {
|
'@flecks/core.build': (target, config, flecks) => {
|
||||||
const {'eslint.exclude': exclude} = flecks.get('@flecks/core/server');
|
const {
|
||||||
if (-1 !== exclude.indexOf(target)) {
|
'eslint.exclude': exclude,
|
||||||
return;
|
profile,
|
||||||
|
} = flecks.get('@flecks/core/server');
|
||||||
|
if (-1 !== profile.indexOf(target)) {
|
||||||
|
config.use.push(({config}) => {
|
||||||
|
config
|
||||||
|
.plugin('profiler')
|
||||||
|
.use(
|
||||||
|
R.resolve('webpack/lib/debug/ProfilingPlugin'),
|
||||||
|
[{outputPath: join(FLECKS_CORE_ROOT, `profile.build-${target}.json`)}],
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const baseConfig = R(flecks.buildConfig('.eslint.defaults.js', target));
|
if (-1 === exclude.indexOf(target)) {
|
||||||
config.use.unshift(
|
const baseConfig = R(flecks.buildConfig('.eslint.defaults.js', target));
|
||||||
airbnb({
|
config.use.unshift(
|
||||||
eslint: {
|
airbnb({
|
||||||
baseConfig: {
|
eslint: {
|
||||||
...baseConfig,
|
baseConfig: {
|
||||||
env: {
|
...baseConfig,
|
||||||
mocha: true,
|
env: {
|
||||||
|
mocha: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
}),
|
);
|
||||||
);
|
}
|
||||||
},
|
},
|
||||||
'@flecks/core.build.config': () => [
|
'@flecks/core.build.config': () => [
|
||||||
/**
|
/**
|
||||||
|
@ -68,6 +86,10 @@ export default {
|
||||||
* Build targets to exclude from ESLint.
|
* Build targets to exclude from ESLint.
|
||||||
*/
|
*/
|
||||||
'eslint.exclude': [],
|
'eslint.exclude': [],
|
||||||
|
/**
|
||||||
|
* Build targets to profile with `webpack.debug.ProfilingPlugin`.
|
||||||
|
*/
|
||||||
|
profile: [],
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user