refactor: latus
This commit is contained in:
parent
f141b6a81b
commit
4ae5307ae1
|
@ -2,9 +2,7 @@ require('source-map-support/register');
|
||||||
// Whilst the configuration object can be modified here, the recommended way of making
|
// Whilst the configuration object can be modified here, the recommended way of making
|
||||||
// changes is via the presets' options or Neutrino's API in `.neutrinorc.js` instead.
|
// changes is via the presets' options or Neutrino's API in `.neutrinorc.js` instead.
|
||||||
// Neutrino's inspect feature can be used to view/export the generated configuration.
|
// Neutrino's inspect feature can be used to view/export the generated configuration.
|
||||||
const {join} = require('path');
|
const {Latus} = require('@latus/core');
|
||||||
|
|
||||||
const {readConfig, Latus} = require('@latus/core');
|
|
||||||
const neutrino = require('neutrino');
|
const neutrino = require('neutrino');
|
||||||
|
|
||||||
if (process.env.LATUS_LINTING) {
|
if (process.env.LATUS_LINTING) {
|
||||||
|
@ -14,22 +12,7 @@ if (process.env.LATUS_LINTING) {
|
||||||
else {
|
else {
|
||||||
module.exports = new Promise((resolve, reject) => {
|
module.exports = new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const config = readConfig();
|
const latus = Latus.create();
|
||||||
const paths = Object.entries(config).map(([plugin]) => {
|
|
||||||
try {
|
|
||||||
const local = join(process.cwd(), 'src', plugin);
|
|
||||||
require.resolve(local);
|
|
||||||
return local;
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
return plugin;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const latus = new Latus({
|
|
||||||
config,
|
|
||||||
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
||||||
modules: paths.map((path) => require(path)),
|
|
||||||
});
|
|
||||||
const configs = {
|
const configs = {
|
||||||
// eslint-disable-next-line global-require
|
// eslint-disable-next-line global-require
|
||||||
app: require('./.neutrinorc'),
|
app: require('./.neutrinorc'),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user