From be0a3b2497f9f53ee6a687524f30e48d3b043c9d Mon Sep 17 00:00:00 2001 From: witnessmenow Date: Thu, 28 Apr 2016 10:33:09 +0100 Subject: [PATCH 1/4] Adding a wrapper class to bundle it as a non react component --- .gitignore | 1 + package.json | 13 +++++++------ src/bundle/wrapper.js | 10 ++++++++++ webpack.config.js | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 src/bundle/wrapper.js create mode 100644 webpack.config.js diff --git a/.gitignore b/.gitignore index 06b809a..f028c14 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules *.log .idea dist +builds diff --git a/package.json b/package.json index 6f1f5d7..7fc2b1b 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,9 @@ "babel-polyfill": "^6.5.0", "babel-preset-es2015": "^6.5.0", "babel-preset-react": "^6.5.0", + "babel-preset-stage-1": "^6.5.0", "babel-preset-stage-2": "^6.5.0", + "babel-runtime": "^6.5.0", "chai": "^3.5.0", "enzyme": "^2.2.0", "eslint": "^2.7.0", @@ -37,7 +39,7 @@ "eslint-plugin-jsx-a11y": "^1.0.3", "eslint-plugin-react": "^5.0.1", "git-url-parse": "^6.0.1", - "jsdom": "^8.3.1", + "jsdom": "^8.4.1", "material-ui": "0.15.0-alpha.2", "mocha": "^2.4.5", "raw-loader": "^0.5.1", @@ -45,18 +47,17 @@ "react-addons-test-utils": "^15.0.0", "react-dom": "^15.0.0", "sinon": "^1.17.3", - "style-loader": "^0.13.1" + "style-loader": "^0.13.1", + "webpack": "^1.13.0" }, "peerDependencies": { "react": "^0.14.7 || ^15.0.0" }, "dependencies": { - "@kadira/storybook": "^1.19.0", "aphrodite": "^0.3.0", - "babel-preset-stage-1": "^6.5.0", - "babel-runtime": "^6.5.0", "object-assign-deep": "0.0.4", - "react-addons-css-transition-group": "^15.0.1" + "react-addons-css-transition-group": "^15.0.1", + "react-dom": "^15.0.0" }, "main": "dist/index.js", "engines": { diff --git a/src/bundle/wrapper.js b/src/bundle/wrapper.js new file mode 100644 index 0000000..b49726d --- /dev/null +++ b/src/bundle/wrapper.js @@ -0,0 +1,10 @@ +import {Conversation} from '../index'; +import ReactDOM from 'react-dom'; +import React from 'react'; + +const ShowChatTemplate = (messages, element, delay=1, height=300) => { + ReactDOM.render(, + element); +}; + +module.exports = ShowChatTemplate; diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..840cdb6 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,18 @@ +module.exports = { + entry: './src/bundle/wrapper.js', + output: { + libraryTarget: 'var', + library: 'ShowChatTemplate', + path: 'builds', + filename: 'chatTemplate.js', + }, + module: { + loaders: [ + { + test: /\.js/, + loader: 'babel', + include: __dirname + '/src', + } + ], + }, +}; From 9c6ed1b4569e8ed9767fb6b75449a1b279f70674 Mon Sep 17 00:00:00 2001 From: witnessmenow Date: Thu, 28 Apr 2016 10:48:48 +0100 Subject: [PATCH 2/4] Fixing lint errors --- src/bundle/wrapper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bundle/wrapper.js b/src/bundle/wrapper.js index b49726d..4b172aa 100644 --- a/src/bundle/wrapper.js +++ b/src/bundle/wrapper.js @@ -1,8 +1,8 @@ -import {Conversation} from '../index'; +import { Conversation } from '../index'; import ReactDOM from 'react-dom'; import React from 'react'; -const ShowChatTemplate = (messages, element, delay=1, height=300) => { +const ShowChatTemplate = (messages, element, delay = 1, height = 300) => { ReactDOM.render(, element); }; From 0293cb47dd206f14095d288f0d0180bab23d54fb Mon Sep 17 00:00:00 2001 From: witnessmenow Date: Thu, 28 Apr 2016 12:07:02 +0100 Subject: [PATCH 3/4] bundle-js step to bundle project into a JS file --- package.json | 5 ++++- src/bundle/wrapper.js | 4 ++-- webpack.config.js | 18 ------------------ webpack.dev.config.js | 18 ++++++++++++++++++ webpack.prod.config.js | 27 +++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 21 deletions(-) delete mode 100644 webpack.config.js create mode 100644 webpack.dev.config.js create mode 100644 webpack.prod.config.js diff --git a/package.json b/package.json index 7fc2b1b..e6599e8 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,10 @@ "test": "npm run lint && npm run testonly", "test-watch": "npm run testonly -- --watch --watch-extensions js", "storybook": "start-storybook -p 9010", - "publish-storybook": "bash .scripts/publish_storybook.sh" + "publish-storybook": "bash .scripts/publish_storybook.sh", + "bundle-js-dev": "webpack --config ./webpack.dev.config.js", + "bundle-js-prod": "webpack -p --config ./webpack.prod.config.js", + "bundle-js": "npm run test && npm run bundle-js-dev && npm run bundle-js-prod" }, "devDependencies": { "@kadira/storybook": "^1.19.0", diff --git a/src/bundle/wrapper.js b/src/bundle/wrapper.js index 4b172aa..563e5fe 100644 --- a/src/bundle/wrapper.js +++ b/src/bundle/wrapper.js @@ -2,9 +2,9 @@ import { Conversation } from '../index'; import ReactDOM from 'react-dom'; import React from 'react'; -const ShowChatTemplate = (messages, element, delay = 1, height = 300) => { +const showChatTemplate = (messages, element, delay = 1, height = 300) => { ReactDOM.render(, element); }; -module.exports = ShowChatTemplate; +module.exports = showChatTemplate; diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 840cdb6..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - entry: './src/bundle/wrapper.js', - output: { - libraryTarget: 'var', - library: 'ShowChatTemplate', - path: 'builds', - filename: 'chatTemplate.js', - }, - module: { - loaders: [ - { - test: /\.js/, - loader: 'babel', - include: __dirname + '/src', - } - ], - }, -}; diff --git a/webpack.dev.config.js b/webpack.dev.config.js new file mode 100644 index 0000000..d2e18e1 --- /dev/null +++ b/webpack.dev.config.js @@ -0,0 +1,18 @@ +module.exports = { + entry: './src/bundle/wrapper.js', + output: { + libraryTarget: 'var', + library: 'showChatTemplate', + path: 'builds', + filename: 'chat-template.js', + }, + module: { + loaders: [ + { + test: /\.js/, + loader: 'babel', + include: __dirname + '/src', + } + ], + }, +}; diff --git a/webpack.prod.config.js b/webpack.prod.config.js new file mode 100644 index 0000000..d88d449 --- /dev/null +++ b/webpack.prod.config.js @@ -0,0 +1,27 @@ +const webpack = require('webpack'); + +module.exports = { + entry: './src/bundle/wrapper.js', + output: { + libraryTarget: 'var', + library: 'showChatTemplate', + path: 'builds', + filename: 'chat-template-min.js', + }, + module: { + loaders: [ + { + test: /\.js/, + loader: 'babel', + include: __dirname + '/src', + } + ], + }, + plugins: [ + new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify('production') + } + }) + ], +}; From f66c5947dd11e61e80e388e7705f06cdc2aca28d Mon Sep 17 00:00:00 2001 From: witnessmenow Date: Thu, 28 Apr 2016 12:11:57 +0100 Subject: [PATCH 4/4] Bumping version to 0.0.19 --- .travis.yml | 2 +- CHANGELOG.md | 4 ++++ package.json | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e9ee307..1495095 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: node_js before_install: if [[ `npm -v` != 3* ]]; then npm i -g npm@3; fi node_js: - - "4.4.2" - "4" - "5" - "stable" @@ -14,3 +13,4 @@ script: - npm run lint - npm run test - npm run prepublish + - npm run bundle-js diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d41d7c..87a976b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [0.0.19] - 2016-04-28 + +- No Issue: Adding a bundle-js build step to create browser compatible chat-template.js (witnessmenow) + ## [0.0.18] - 2016-04-27 - No Issue: Fixed chats not looping back around (Paul.O'Flaherty) diff --git a/package.json b/package.json index e6599e8..3bcce7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chat-template", - "version": "0.0.18", + "version": "0.0.19", "description": "Chat-Template is a React component that enables quick prototyping of bot conversations.", "repository": { "type": "git",