feat: auto mains

This commit is contained in:
cha0s 2020-12-02 02:20:53 -06:00
parent 01353edc19
commit 903f6ebe05
8 changed files with 67 additions and 22 deletions

View File

@ -1,5 +1,15 @@
const copy = require('@neutrinojs/copy');
const config = require('../../config/.neutrinorc');
const pkg = require('./package.json');
const mains = pkg.files
.filter((file) => file.match(/\.js$/))
.map((file) => file.slice(0, -3))
.reduce((r, file) => ({...r, [file]: file}), {});
config.options = {
mains,
};
module.exports = config;

View File

@ -1,11 +1,15 @@
const copy = require('@neutrinojs/copy');
const config = require('../../config/.neutrinorc');
const pkg = require('./package.json');
const mains = pkg.files
.filter((file) => file.match(/\.js$/))
.map((file) => file.slice(0, -3))
.reduce((r, file) => ({...r, [file]: file}), {});
config.options = {
mains: {
index: 'index',
start: 'start',
},
mains,
};
module.exports = config;

View File

@ -1,5 +1,15 @@
const copy = require('@neutrinojs/copy');
const config = require('../../config/.neutrinorc');
const pkg = require('./package.json');
const mains = pkg.files
.filter((file) => file.match(/\.js$/))
.map((file) => file.slice(0, -3))
.reduce((r, file) => ({...r, [file]: file}), {});
config.options = {
mains,
};
module.exports = config;

View File

@ -1,13 +1,15 @@
const copy = require('@neutrinojs/copy');
const config = require('../../config/.neutrinorc');
const pkg = require('./package.json');
const mains = pkg.files
.filter((file) => file.match(/\.js$/))
.map((file) => file.slice(0, -3))
.reduce((r, file) => ({...r, [file]: file}), {});
config.options = {
mains: {
index: 'index',
passport: 'passport',
session: 'session',
},
mains,
};
config.use.push(copy({

View File

@ -1,11 +1,15 @@
const copy = require('@neutrinojs/copy');
const config = require('../../config/.neutrinorc');
const pkg = require('./package.json');
const mains = pkg.files
.filter((file) => file.match(/\.js$/))
.map((file) => file.slice(0, -3))
.reduce((r, file) => ({...r, [file]: file}), {});
config.options = {
mains: {
index: 'index',
entry: 'entry',
},
mains,
};
module.exports = config;

View File

@ -1,12 +1,15 @@
const copy = require('@neutrinojs/copy');
const config = require('../../config/.neutrinorc');
const pkg = require('./package.json');
const mains = pkg.files
.filter((file) => file.match(/\.js$/))
.map((file) => file.slice(0, -3))
.reduce((r, file) => ({...r, [file]: file}), {});
config.options = {
mains: {
index: 'index',
session: 'session',
},
mains,
};
module.exports = config;

View File

@ -1,5 +1,15 @@
const copy = require('@neutrinojs/copy');
const config = require('../../config/.neutrinorc');
const pkg = require('./package.json');
const mains = pkg.files
.filter((file) => file.match(/\.js$/))
.map((file) => file.slice(0, -3))
.reduce((r, file) => ({...r, [file]: file}), {});
config.options = {
mains,
};
module.exports = config;

View File

@ -1,13 +1,15 @@
const copy = require('@neutrinojs/copy');
const config = require('../../config/.neutrinorc');
const pkg = require('./package.json');
const mains = pkg.files
.filter((file) => file.match(/\.js$/))
.map((file) => file.slice(0, -3))
.reduce((r, file) => ({...r, [file]: file}), {});
config.options = {
mains: {
index: 'index',
passport: 'passport',
session: 'session',
},
mains,
};
module.exports = config;