Speech as a package - export components #401

Merged
bones7242 merged 8 commits from speech-as-a-package-export-component-lib into speech-as-a-package 2018-03-22 06:11:03 +01:00
18 changed files with 88 additions and 54707 deletions

10
build/getFolderNames.js Normal file
View file

@ -0,0 +1,10 @@
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
const { lstatSync, readdirSync } = require('fs');
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
const { join } = require('path');
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
export const getSubDirectoryNames = (root) => {
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
return readdirSync(root)
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
.filter(name => {
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
const fullPath = join(root, name);
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
return lstatSync(fullPath).isDirectory();
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
});
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice
};
neb-b commented 2018-03-22 06:00:36 +01:00 (Migrated from github.com)
Review

I would use const if you aren't changing anything

I would use `const` if you aren't changing anything
bones7242 commented 2018-03-22 06:04:53 +01:00 (Migrated from github.com)
Review

nice

nice

View file

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

View file

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

12
client/pages/index.js Normal file
View file

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

8919
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

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
const db = require('../models/index');
const db = require('../models');
const logger = require('winston');
module.exports = {

View file

@ -1,11 +1,11 @@
import React from 'react';
import { renderToString } from 'react-dom/server';
import { createStore } from 'redux';
import Reducer from '../../client/reducers/index';
import Reducer from 'client/reducers';
import { Provider } from 'react-redux';
import { StaticRouter } from 'react-router-dom';
import GAListener from '../../client/components/GAListener/index';
import App from '../../client/app';
import GAListener from 'client/components/GAListener/';
import App from 'client/app';
import renderFullPage from './renderFullPage.js';
import Helmet from 'react-helmet';

View file

@ -1,7 +1,7 @@
const PassportLocalStrategy = require('passport-local').Strategy;
const lbryApi = require('../helpers/lbryApi.js');
const logger = require('winston');
const db = require('../models/index');
const db = require('../models');
module.exports = new PassportLocalStrategy(
{

View file

@ -11,13 +11,12 @@ const http = require('http');
// logging dependencies
const logger = require('winston');
function SpeechServer () {
function Server () {
this.configureMysql = (mysqlConfig) => {
require('../config/mysqlConfig.js').configure(mysqlConfig);
};
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;
};
@ -96,4 +95,4 @@ function SpeechServer () {
};
};
module.exports = SpeechServer;
module.exports = Server;

View file

@ -1,6 +1,6 @@
// load dependencies
const logger = require('winston');
const db = require('../models/index'); // require our models for syncing
const db = require('../models'); // require our models for syncing
// configure logging
require('../helpers/configureLogger.js')(logger);

13
speech.js Normal file
View file

@ -0,0 +1,13 @@
const Server = require('./server/server.js');
const Components = require('./client/components');
const Containers = require('./client/containers');
const Pages = require('./client/pages');
const exports = {
Server,
Components,
Containers,
Pages,
};
module.exports = exports;

View file

@ -1,7 +1,7 @@
const serverBaseConfig = require('./webpack.server.common.js');
const packageBaseConfig = require('./webpack.package.common.js');
const clientBaseConfig = require('./webpack.client.common.js');
module.exports = [
serverBaseConfig,
packageBaseConfig,
clientBaseConfig,
];

View file

@ -1,4 +1,4 @@
const serverBaseConfig = require('./webpack.server.common.js');
const packageBaseConfig = require('./webpack.package.common.js');
const clientBaseConfig = require('./webpack.client.common.js');
const merge = require('webpack-merge');
@ -8,6 +8,6 @@ const devBuildConfig = {
};
module.exports = [
merge(serverBaseConfig, devBuildConfig),
merge(packageBaseConfig, devBuildConfig),
merge(clientBaseConfig, devBuildConfig),
];

View file

@ -1,6 +1,7 @@
const Path = require('path');
const nodeExternals = require('webpack-node-externals');
const REACT_ROOT = Path.resolve(__dirname, 'client/');
const CLIENT_ROOT = Path.resolve(__dirname, 'client/');
const SERVER_ROOT = Path.resolve(__dirname, 'server/');
module.exports = {
target: 'node',
@ -8,7 +9,7 @@ module.exports = {
__dirname: false,
},
externals: [nodeExternals()],
entry : ['babel-polyfill', 'whatwg-fetch', './server/server.js'],
entry : ['babel-polyfill', 'whatwg-fetch', './speech.js'],
output : {
path : Path.join(__dirname, '/'),
publicPath : '/',
@ -34,7 +35,8 @@ module.exports = {
},
resolve: {
modules: [
REACT_ROOT,
CLIENT_ROOT,
SERVER_ROOT,
'node_modules',
__dirname,
],

View file

@ -1,7 +1,7 @@
const webpack = require('webpack');
const merge = require('webpack-merge');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const serverBaseConfig = require('./webpack.server.common.js');
const packageBaseConfig = require('./webpack.package.common.js');
const clientBaseConfig = require('./webpack.client.common.js');
const productionBuildConfig = {
@ -17,6 +17,6 @@ const productionBuildConfig = {
};
module.exports = [
merge(serverBaseConfig, productionBuildConfig),
merge(packageBaseConfig, productionBuildConfig),
merge(clientBaseConfig, productionBuildConfig),
];