fixed component lib export

This commit is contained in:
bill bittner 2018-03-21 21:53:25 -07:00
parent 94d4626ccf
commit 4a3ec31bc7
9 changed files with 49 additions and 54837 deletions

10
build/getFolderNames.js Normal file
View file

@ -0,0 +1,10 @@
const { lstatSync, readdirSync } = require('fs');
const { join } = require('path');
export const getSubDirectoryNames = (root) => {
return readdirSync(root)
.filter(name => {
let fullPath = join(root, name);
return lstatSync(fullPath).isDirectory();
});
};

View file

@ -1,22 +0,0 @@
const { lstatSync, readdirSync } = require('fs');
const { join } = require('path');
const getSubDirectoryNames = (root) => {
console.log('getting sub directories for:', root);
return readdirSync(root)
.filter(name => {
console.log('module found:', name);
let fullPath = join(root, name);
return lstatSync(fullPath).isDirectory();
});
};
module.exports = (root) => {
let allModules = {};
getSubDirectoryNames(root)
.forEach((name) => {
console.log('importing module:', name);
allModules[name] = require(`./${name}`).default;
});
return allModules;
};

View file

@ -1,4 +1,12 @@
const Path = require('path');
const importSubModules = require('build/utils/importSubModules');
const { getSubDirectoryNames } = require('build/getFolderNames.js');
const thisFolder = Path.resolve(__dirname, 'client/components/');
module.exports = importSubModules(thisFolder);
let modules = {};
getSubDirectoryNames(thisFolder)
.forEach((name) => {
modules[name] = require(`./${name}`).default;
});
module.exports = modules;

View file

@ -1,4 +1,12 @@
const Path = require('path');
const importSubModules = require('build/utils/importSubModules');
const { getSubDirectoryNames } = require('build/getFolderNames.js');
const thisFolder = Path.resolve(__dirname, 'client/containers/');
module.exports = importSubModules(thisFolder);
let modules = {};
getSubDirectoryNames(thisFolder)
.forEach((name) => {
modules[name] = require(`./${name}`).default;
});
module.exports = modules;

View file

@ -1,4 +1,12 @@
const Path = require('path');
const importSubModules = require('build/utils/importSubModules');
const { getSubDirectoryNames } = require('build/getFolderNames.js');
const thisFolder = Path.resolve(__dirname, 'client/pages/');
module.exports = importSubModules(thisFolder);
let modules = {};
getSubDirectoryNames(thisFolder)
.forEach((name) => {
modules[name] = require(`./${name}`).default;
});
module.exports = modules;

9039
index.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -17,7 +17,6 @@ function Server () {
};
this.configureSite = (siteConfig) => {
require('../config/siteConfig.js').configure(siteConfig);
console.log(require('../config/siteConfig.js'));
this.sessionKey = siteConfig.auth.sessionKey;
this.PORT = siteConfig.details.port;
};