Skip to content

Commit

Permalink
feat(widget-chat): initial addition of widget-chat
Browse files Browse the repository at this point in the history
  • Loading branch information
adamweeks committed Sep 15, 2016
1 parent a6f0142 commit f71a17c
Show file tree
Hide file tree
Showing 11 changed files with 307 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/widget-chat/.babelrc
@@ -0,0 +1,12 @@
{
"plugins": [
"lodash",
"transform-runtime"
],
"presets": [
"es2015",
"react",
"stage-1"
],
"sourceMaps": true
}
1 change: 1 addition & 0 deletions packages/widget-chat/.eslintrc.yml
@@ -0,0 +1 @@
extends: "../../.eslintrc-es6.yml"
56 changes: 56 additions & 0 deletions packages/widget-chat/Gruntfile.js
@@ -0,0 +1,56 @@
/**!
*
* Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.
*/

/* eslint-disable */

'use strict';

var path = require('path');

module.exports = function configGrunt(grunt) {
grunt.loadNpmTasks('grunt-webpack');
grunt.initConfig({
webpack: {
options: Object.assign({}, require('./webpack.config'), {
hot: false,
inline: false,
keepalive: false,
progress: true,
watch: false
}),
build: {
progress: false
}
},
"webpack-dev-server": {
options: {
compress: true,
historyApiFallback: true,
host: '127.0.0.1',
hot: true,
inline: true,
keepalive: true,
progress: true,
watch: true,
port: parseInt(process.env.PORT || 8000),
webpack: require('./webpack.config')
},
start: {
keepAlive: true,
webpack: {
devtool: "eval",
debug: true
}
}
}
});

grunt.registerTask('build', [
'webpack:build'
]);

grunt.registerTask("default", ["webpack-dev-server:start"]);

};
9 changes: 9 additions & 0 deletions packages/widget-chat/README.md
@@ -0,0 +1,9 @@
# filterSync

!

Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.

# filterSync

Chat Widget
55 changes: 55 additions & 0 deletions packages/widget-chat/package.json
@@ -0,0 +1,55 @@
{
"name": "@ciscospark/widget-chat",
"version": "0.7.0-alpha",
"description": "",
"main": "dist/index.js",
"devMain": "src/index.js",
"author": "Adam Weeks <adweeks@cisco.com>",
"license": "(Apache-2.0)",
"scripts": {
"start": "webpack-dev-server --history-api-fallback --hot --inline --port 8000 --colors"
},
"repository": "https://github.com/ciscospark/spark-js-sdk/tree/master/packages/widget-chat",
"dependencies": {
"ciscospark": "^0.7.0-alpha",
"babel-runtime": "^6.3.19",
"extract-text-webpack-plugin": "^1.0.1",
"lodash": "^4.5.1",
"react": "^15.0.2",
"react-bootstrap": "^0.29.5",
"react-dom": "^15.0.2",
"react-redux": "^4.4.5",
"react-router": "^2.5.1",
"react-router-bootstrap": "^0.23.0",
"react-router-redux": "^4.0.4",
"redux": "^3.5.2",
"redux-actions": "^0.10.0",
"redux-logger": "^2.6.1",
"redux-thunk": "^2.0.1"
},
"devDependencies": {
"@ciscospark/http-core": "^0.7.0-alpha",
"@ciscospark/spark-core": "^0.7.0-alpha",
"@ciscospark/test-helper-automation": "^0.7.0-alpha",
"@ciscospark/test-helper-test-users": "^0.7.0-alpha",
"@ciscospark/xunit-with-logs": "^0.7.0-alpha",
"babel-core": "^6.7.7",
"babel-eslint": "^6.0.0-beta.5",
"babel-plugin-lodash": "2.1.0",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
"babel-register": "^6.4.3",
"css-loader": "^0.23.1",
"dotenv": "^2.0.0",
"eslint": "^3.3.1",
"eslint-plugin-mocha": "^4.4.0",
"eslint-plugin-react": "^6.1.2",
"grunt-webpack": "^1.0.14",
"html-webpack-plugin": "^2.22.0",
"inline-environment-variables-webpack-plugin": "0.0.2",
"require-dir": "^0.3.0",
"style-loader": "^0.13.1"
}
}
11 changes: 11 additions & 0 deletions packages/widget-chat/src/index.html
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Chat Widget</title>
<meta charset="utf8"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css">
</head>
<body>
<main id="main"></main>
</body>
</html>
13 changes: 13 additions & 0 deletions packages/widget-chat/src/main.js
@@ -0,0 +1,13 @@
import './styles/styles.css';

import React from 'react';
import ReactDOM from 'react-dom';

ReactDOM.render(
<h1>Chat Widget!</h1>,
document.getElementById(`main`)
);

if (module.hot) {
module.hot.accept();
}
3 changes: 3 additions & 0 deletions packages/widget-chat/src/styles/styles.css
@@ -0,0 +1,3 @@
h1 {
text-decoration: underline
}
1 change: 1 addition & 0 deletions packages/widget-chat/test/.eslintrc.yml
@@ -0,0 +1 @@
extends: "../../../.eslintrc-mocha.yml"
28 changes: 28 additions & 0 deletions packages/widget-chat/test/index.js
@@ -0,0 +1,28 @@
/**!
*
* Copyright (c) 2015-2016 Cisco Systems, Inc. See LICENSE file.
* @private
*/

/* eslint-disable */

'use strict';

/* istanbul ignore else */
if (!global._babelPolyfill) {
require('babel-polyfill');
}

// helper file for code coverage
if (process.env.COVERAGE && (new RegExp(process.env.PACKAGE + '$')).test(require('../package').name)) {
if (typeof window === 'undefined') {
var covered = '../.coverage/src';
module.exports = require(covered);
}
else {
module.exports = require('../src');
}
}
else {
module.exports = require('..');
}
118 changes: 118 additions & 0 deletions packages/widget-chat/webpack.config.js
@@ -0,0 +1,118 @@
/* eslint quotes: [2, "single"] */
/* eslint no-var: [0] */
/* eslint camelcase: [0] */

var dotenv = require('dotenv');
var path = require('path');
var webpack = require('webpack');
// Note that webpack is intended to be invoked via grunt, plugins
// need to be installed in the example-phone package, but loaders need to be
// installed in the root package.
var InlineEnviromentVariablesPlugin = require('inline-environment-variables-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');

// Need to use dotenv because grunt env runs after this file has been loaded
try {
dotenv.config({
path: path.join(__dirname, '..', '..', '.env')
});
}
catch (reason) {
// do nothing; this'll happen on jenkins, but we'll get the values from the
// environment, so it's ok
}

process.env.NODE_ENV = process.env.NODE_ENV || 'development';

module.exports = {
context: __dirname,
entry: [
'./src/main.js'
],
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
sourceMapFilename: '[file].map'
},
debug: process.env.NODE_ENV !== 'production',
devtool: 'sourcemap',
plugins: [
new InlineEnviromentVariablesPlugin(process.env),
new webpack.optimize.UglifyJsPlugin({
compress: {
sequences: false,
properties: false,
dead_code: true,
drop_debugger: false,
unsafe: false,
unsafe_comps: false,
conditionals: false,
comparisons: false,
evaluate: false,
booleans: false,
loops: false,
unused: false,
hoist_funs: false,
hoist_vars: false,
if_return: false,
join_vars: false,
cascade: false,
warnings: true,
negate_iife: false,
pure_getters: false,
pure_funcs: null,
drop_console: false,
keep_fargs: true,
keep_fnames: true,
passes: 1
},
beautify: false,
mangle: false
}),
new ExtractTextPlugin('[name].css'),
new HtmlWebpackPlugin({
hash: true,
// inject: 'head',
minify: {
collapseWhitespace: true,
removeComments: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
sortAttributes: true,
sortClassName: true
},
template: path.resolve(__dirname, './src/index.html')
})
],
resolve: {
// Add "devMain" to the packageMains defaults so we can load src instead of
// dist (so far, haven't found a better way)
packageMains: ['devMain', 'webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'],
// Make sure we use browser overrides (why doesn't webpack do this by
// default?)
packageAlias: ['browser']
},
resolveLoader: {
// Make sure the local node_modules directory is always available to provide
// loader plugins (again, why doesn't babel do this by default?)
root: path.resolve(__dirname, 'node_modules')
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules|dist/,
include: path.resolve(__dirname, '..'),
query: {
cacheDirectory: true
}
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
}
]
}
};

0 comments on commit f71a17c

Please sign in to comment.