Initial commit

This commit is contained in:
Drew DeVault 2017-08-06 18:23:54 -04:00
commit 373e6f0699
8 changed files with 137 additions and 0 deletions

4
.babelrc Normal file
View File

@ -0,0 +1,4 @@
{
"plugins": ["transform-react-jsx"],
"presets": ["env"]
}

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
dist
node_modules
package-lock.json

10
index.html Normal file
View File

@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<title>receptor</title>
</head>
<body>
<div id="root"></div>
<script src="/dist/bundle.js"></script>
</body>
</html>

39
package.json Normal file
View File

@ -0,0 +1,39 @@
{
"name": "receptor",
"version": "1.0.0",
"description": "Web client for synapse",
"main": "index.js",
"scripts": {
"build": "webpack",
"build:production": "webpack -p",
"watch": "webpack --progress --watch",
"start": "node serve.js"
},
"repository": {
"type": "git",
"url": "https://git.sr.ht/~sircmpwn/receptor"
},
"author": "Drew DeVault <sir@cmpwn.com>",
"license": "BSD-3-Clause",
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-env": "^1.6.0",
"css-loader": "^0.28.4",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-redux": "^5.0.5",
"redux": "^3.7.2",
"style-loader": "^0.18.2",
"webpack": "^3.1.0",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.18.2"
},
"dependencies": {
"babel-plugin-transform-react-jsx": "^6.24.1",
"bootstrap": "^4.0.0-alpha.6",
"express": "^4.15.3",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.6"
}
}

1
scss/base.scss Normal file
View File

@ -0,0 +1 @@
@import "bootstrap";

30
serve.js Normal file
View File

@ -0,0 +1,30 @@
var path = require('path');
var process = require('process');
var express = require('express');
var webpack = require('webpack');
var config = require('./webpack.config');
var mime = require('mime');
var app = express();
var compiler = webpack(config);
app.use(require('webpack-dev-middleware')(compiler, {
noInfo: true,
publicPath: config.output.publicPath
}));
app.use(require('webpack-hot-middleware')(compiler));
app.get('*', function(req, res) {
res.sendFile(path.join(__dirname, req.path));
});
var port = process.env.MANAGER_PORT || 3000;
app.listen(port, 'localhost', function(err) {
if (err) {
console.log(err);
return;
}
console.log('Listening at http://localhost:' + port);
});

8
src/index.js Normal file
View File

@ -0,0 +1,8 @@
import React from 'react';
import { render } from 'react-dom';
import scss from '../scss/base.scss';
render(
<h1>Hello world!</h1>,
document.getElementById('root')
);

42
webpack.config.js Normal file
View File

@ -0,0 +1,42 @@
const path = require("path");
const webpack = require("webpack");
const defines = {
"DEFAULT_WS_URI": process.env.WEBSOCKET_URI || "ws://localhost:8412/"
};
module.exports = {
devtool: "source-map",
entry: [
"webpack-hot-middleware/client",
"./src/index.js"
],
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
publicPath: "/dist/"
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
{ test: /\.scss$/,
use: [
'style-loader',
'css-loader',
{
loader: 'sass-loader',
options: {
includePaths: [
path.resolve(__dirname, './node_modules/bootstrap/scss/')
]
}
}
],
}
]
},
plugins:[
new webpack.HotModuleReplacementPlugin(),
new webpack.EnvironmentPlugin(defines)
]
};