make production build

This commit is contained in:
Eric Hulburd
2016-02-08 18:23:40 -06:00
parent 3cb2320300
commit 109ad432bb
31 changed files with 330 additions and 1387 deletions

View File

@@ -24,7 +24,6 @@ class Database {
// add associations
for (var model of Database.models){
console.log(`setting ${model.name}`);
model.set();
}

View File

@@ -1,19 +0,0 @@
import {
fromGlobalId,
nodeDefinitions,
} from 'graphql-relay';
import DB from './../database'
var {nodeInterface, nodeField} = nodeDefinitions(
(globalId) => {
var {graphql_type_name, id} = fromGlobalId(globalId),
model = DB[graphql_type_name];
return model.findOne({where: {id: id}});
},
(instance) => {
return instance.Model().graphql_type;
}
);
export {nodeInterface, nodeField};

View File

@@ -1,27 +0,0 @@
type House implements Node {
id: ID!
name: String!
power_data(after: String, first: Int, before: String, last: Int): [PowerDatum]
habitants(after: String, first: Int, before: String, last: Int): [User]
}
interface Node {
id: ID!
}
type PowerDatum implements Node {
id: ID!
power: Float
time: Int
}
type Query {
node(id: ID!): Node
viewer: User
}
type User implements Node {
id: ID!
username: String!
house: House
}

View File

@@ -1,27 +0,0 @@
import {
GraphQLObjectType,
GraphQLSchema
} from 'graphql';
import {nodeField} from './node';
import DB from './../database';
export default function(){
var queryType = new GraphQLObjectType({
name: 'Query',
fields: () => ({
node: nodeField,
viewer: {
type: DB.User.graphql_type,
resolve: (_, args) => {
return DB.User.findOne({where: {username: 'bethany'}});
}
},
}),
});
return new GraphQLSchema({
query: queryType
});
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
export default {
modules: 'es6',
'target-version': '0.14.3',
'suffix': '.rt'
};

View File

@@ -0,0 +1 @@
design.js

View File

@@ -0,0 +1,41 @@
const ROOT = __dirname + '/../../../';
module.exports = {
entry: {
app: ROOT + 'client/app',
style: ROOT + 'client/style'
},
output: {
filename: '[name].js',
path: ROOT + 'client/build/development'
},
externals: {
jquery: "$",
d3: "d3"
},
module: {
loaders: [
{
test: /\.scss$/,
loader: ['style', 'raw', 'sass']
}, {
test: /\.css$/,
loader: ['style', 'raw']
}
]
},
sassLoader: {
includePaths: [ROOT + 'client', ROOT + 'node_modules']
},
// Use the plugin to specify the resulting filename (and add needed behavior to the compiler)
plugins: [
new ExtractTextPlugin("style.css", {
allChunks: true
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
})
]
}

View File

@@ -0,0 +1,55 @@
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import webpack from 'webpack';
const ROOT = __dirname + '/../../../';
module.exports = {
entry: {
app: ROOT + 'client/app',
style: ROOT + 'client/style'
},
devtool: 'source-map',
output: {
filename: '[name].min.js',
path: ROOT + 'client/build/production'
},
externals: {
jquery: "$",
d3: "d3"
},
module: {
loaders: [
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract("style-loader", "raw-loader!sass-loader")
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "raw-loader")
}, {
test: /\.js$/,
loader: 'babel'
}, {
test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&minetype=application/font-woff"
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader"
}
]
},
sassLoader: {
includePaths: [ROOT + 'client', ROOT + 'node_modules']
},
// Use the plugin to specify the resulting filename (and add needed behavior to the compiler)
plugins: [
new ExtractTextPlugin("style.min.css", {
allChunks: true
}),
new webpack.optimize.UglifyJsPlugin({minimize: true}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
})
]
};