Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of nwb build tool #128

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
coverage/
demo/dist/

# Generated build files
es/
lib/
umd/
dist/
demo/dist/

# Node
node_modules/
npm-debug.log*
package-lock.json

# Editors
.DS_Store
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@

## Demo Development Server

- `npm start` will run a development server with the component's demo app at [http://localhost:3000](http://localhost:3000) with hot module reloading.
- `npm start` will run a development server with the component's demo app at [http://localhost:8080](http://localhost:8080) with hot module reloading.

## Building

- `npm run build` will build the component for publishing to npm and also bundle the demo app.
- `npm run build` will build the component for publishing to npm.

- `npm run build-demo` will build the demo for publishing to github-pages.

- `npm run clean` will delete built resources.

Expand Down
10 changes: 10 additions & 0 deletions demo/assets/index-template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>react-chat-window</title>
</head>
<body>
<div id="demo"></div>
</body>
</html>
2 changes: 0 additions & 2 deletions demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import Footer from './Footer';
import monsterImgUrl from './../assets/monster.png';
import './../assets/styles';



class Demo extends Component {

constructor() {
Expand Down
69 changes: 40 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,59 @@
"name": "react-chat-window",
"version": "1.2.0",
"description": "react-chat-window React component",
"main": "lib/index.js",
"module": "es/index.js",
"files": [
"css",
"es",
"lib",
"umd"
],
"main": "dist/index.js",
"scripts": {
"build": "nwb build-react-component --copy-files",
"clean": "nwb clean-module && nwb clean-demo",
"build": "webpack",
"build-demo": "npm run build && webpack --config webpack.config.dev.js",
"lint": "eslint src demo/src",
"start": "nwb serve-react-demo",
"gh:publish": "nwb build-demo && gh-pages -d demo/dist"
"start": "npm run build && webpack-dev-server --config webpack.config.dev.js",
"prepublish": "npm run build",
"gh:publish": "npm run build-demo && gh-pages -d demo/dist",
"clean": "rm -rf demo/dist ; rm -rf dist"
},
"author": "kingofthestack",
"homepage": "https://kingofthestack.github.io/react-chat-window/",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/kingofthestack/react-chat-window.git"
},
"keywords": [
"react-component",
"react",
"messenger",
"chat"
],
"dependencies": {
"emoji-js": "3.2.2",
"gh-pages": "^1.2.0",
"prop-types": "15.5.10",
"react-highlight.js": "1.0.5",
"react-linkify": "^0.2.1",
"socket.io-client": "2.0.3"
},
"peerDependencies": {
"react": "15.x"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.4",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"eslint": "^5.13.0",
"eslint-plugin-react": "^7.12.4",
"nwb": "^0.23.0",
"react": "15.6.1",
"react-dom": "15.6.1"
},
"author": "kingofthestack",
"homepage": "https://kingofthestack.github.io/react-chat-window/",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/kingofthestack/react-chat-window.git"
},
"keywords": [
"react-component"
]
"css-loader": "^2.1.1",
"file-loader": "^3.0.1",
"gh-pages": "^1.2.0",
"html-webpack-plugin": "^3.2.0",
"prop-types": "^15.5.10",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"style-loader": "^0.23.1",
"webpack": "^4.36.1",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.7.2"
}
}
40 changes: 40 additions & 0 deletions webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
entry: './demo/src/index.js',
mode: 'development',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'demo/dist')
},
module: {
rules: [{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ["@babel/plugin-proposal-class-properties"]
}
}
}, {
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
}, {
test: /\.(png|svg|jpg|gif|mp3)$/,
use: [
'file-loader'
]
}]
},
plugins: [
new HtmlWebpackPlugin({
template: 'demo/assets/index-template.html'
})
]
}
34 changes: 34 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const path = require('path');

module.exports = {
entry: './src/index.js',
mode: 'production',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ["@babel/plugin-proposal-class-properties"]
}
}
}, {
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
}, {
test: /\.(png|svg|jpg|gif|mp3)$/,
use: [
'file-loader'
]
}]
}
}