Speech as a package #416

Merged
bones7242 merged 89 commits from speech-as-a-package into master 2018-04-18 21:47:34 +02:00
9 changed files with 49 additions and 54837 deletions
Showing only changes of commit 4a3ec31bc7 - Show all commits

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 Path = require('path');
const importSubModules = require('build/utils/importSubModules'); const { getSubDirectoryNames } = require('build/getFolderNames.js');
const thisFolder = Path.resolve(__dirname, 'client/components/'); 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 Path = require('path');
const importSubModules = require('build/utils/importSubModules'); const { getSubDirectoryNames } = require('build/getFolderNames.js');
const thisFolder = Path.resolve(__dirname, 'client/containers/'); 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 Path = require('path');
const importSubModules = require('build/utils/importSubModules'); const { getSubDirectoryNames } = require('build/getFolderNames.js');
const thisFolder = Path.resolve(__dirname, 'client/pages/'); 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) => { this.configureSite = (siteConfig) => {
require('../config/siteConfig.js').configure(siteConfig); require('../config/siteConfig.js').configure(siteConfig);
console.log(require('../config/siteConfig.js'));
this.sessionKey = siteConfig.auth.sessionKey; this.sessionKey = siteConfig.auth.sessionKey;
this.PORT = siteConfig.details.port; this.PORT = siteConfig.details.port;
}; };