latus/app/.neutrinorc.js

94 lines
2.4 KiB
JavaScript
Raw Normal View History

2020-11-30 06:28:29 -06:00
require('dotenv/config');
2020-12-20 03:51:38 -06:00
const airbnb = require('@neutrinojs/airbnb');
2020-11-30 06:28:29 -06:00
const clean = require('@neutrinojs/clean');
2020-12-20 06:54:49 -06:00
const copy = require('@neutrinojs/copy');
2020-11-30 06:28:29 -06:00
const mocha = require('@neutrinojs/mocha');
const node = require('@neutrinojs/node');
const {EnvironmentPlugin} = require('webpack');
const nodeExternals = require('webpack-node-externals');
module.exports = {
options: {
root: __dirname,
},
use: [
2020-12-20 03:51:38 -06:00
airbnb({
2020-11-30 06:28:29 -06:00
eslint: {
cache: false,
baseConfig: require('./.eslint.defaults'),
},
}),
clean({
cleanOnceBeforeBuildPatterns: ['**/*.hot-update.*'],
}),
2020-12-20 06:54:49 -06:00
copy({
patterns: [{
from: 'src/assets',
to: 'http',
}],
}),
2020-12-01 15:32:49 -06:00
mocha(),
2021-01-20 09:49:47 -06:00
node({
2021-01-20 14:24:14 -06:00
hot: true,
2021-01-20 09:49:47 -06:00
}),
2020-11-30 06:28:29 -06:00
(neutrino) => {
2020-12-20 03:51:38 -06:00
[
'components',
'context',
'fonts',
'hooks',
'images',
'scss',
].forEach((path) => {
neutrino.config.resolve.alias
.set(path, `${neutrino.options.source}/react/${path}`);
});
if (process.env.LATUS_LINTING) {
return;
}
neutrino.config.module
.rule('compile')
.use('babel')
.get('options').plugins.push(
[
'babel-plugin-webpack-alias',
{
config: `${__dirname}/webpack.config.js`,
},
],
);
2020-11-30 06:28:29 -06:00
neutrino.config
.plugin('environment')
.use(EnvironmentPlugin, [{
SIDE: 'server',
}]);
2020-12-01 03:20:44 -06:00
neutrino.config
.entry('index')
2021-01-20 14:24:14 -06:00
.add('@latus/core/start');
2020-11-30 06:28:29 -06:00
if ('production' !== neutrino.config.get('mode')) {
neutrino.config
.entry('index')
.prepend('dotenv/config');
neutrino.config
.plugin('start-server')
.tap((args) => {
const options = args[0];
2021-01-20 14:24:14 -06:00
options.signal = true;
2020-11-30 06:28:29 -06:00
const inspectArg = process.argv.find((arg) => -1 !== arg.indexOf('--inspect'));
if (inspectArg) {
options.nodeArgs.push(inspectArg);
}
const profArg = process.argv.find((arg) => -1 !== arg.indexOf('--prof'));
if (profArg) {
options.nodeArgs.push(profArg);
}
2020-12-20 03:51:38 -06:00
options.nodeArgs.push('--experimental-repl-await');
2020-11-30 06:28:29 -06:00
return args;
});
}
2020-12-24 19:56:09 -06:00
neutrino.config.externals(nodeExternals());
2020-11-30 06:28:29 -06:00
},
],
};