forked from channl/dynamodb-lambda-autoscale
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further flow fixes and limited testing
- Loading branch information
Showing
5 changed files
with
133 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* @flow */ | ||
declare module 'measured' { | ||
declare class MeasuredCollection { | ||
_metrics: any; | ||
|
||
timer(name: string): MeasuredTimer; | ||
|
||
counter(name: string): MeasuredCounter; | ||
|
||
toJSON(): any; | ||
} | ||
|
||
declare class MeasuredTimer { | ||
start(): Stopwatch; | ||
} | ||
|
||
declare class MeasuredCounter { | ||
inc(value: number): void; | ||
} | ||
|
||
declare class Stopwatch { | ||
end(): void; | ||
} | ||
|
||
declare function createCollection(): MeasuredCollection; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,92 @@ | ||
var path = require("path"); | ||
var webpack = require("webpack"); | ||
var StatsPlugin = require("stats-webpack-plugin"); | ||
var ContextReplacementPlugin = require("webpack/lib/ContextReplacementPlugin"); | ||
var path = require('path'); | ||
var webpack = require('webpack'); | ||
var StatsPlugin = require('stats-webpack-plugin'); | ||
var ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin'); | ||
|
||
module.exports = function(options) { | ||
var entry = { 'index': './src/Index.js' }; | ||
module.exports = function (options) { | ||
|
||
var entry = { index: './src/Index.js' }; | ||
var loaders = [ | ||
{ test: /\.jsx$/, loader: options.hotComponents ? ["react-hot-loader", "babel-loader?stage=0"] : "babel-loader?stage=0"}, | ||
{ test: /\.js$/, loader: "babel-loader", include: path.join(__dirname, "src")}, | ||
{ test: /\.jsx$/, loader: options.hotComponents ? | ||
[ 'react-hot-loader', 'babel-loader?stage=0' ] : 'babel-loader?stage=0'}, | ||
{ test: /\.js$/, loader: 'babel-loader', include: path.join(__dirname, 'src')}, | ||
{ test: /\.json$/, loader: 'json-loader' }, | ||
{ test: /\.md|markdown$/, loader: 'markdown-loader'} | ||
]; | ||
|
||
var alias = {}; | ||
var aliasLoader = {}; | ||
var externals = [ | ||
var alias = {}; | ||
var aliasLoader = {}; | ||
var externals = [ | ||
{ 'aws-sdk': 'commonjs aws-sdk' } // This is already available on the lambda server | ||
]; | ||
var modulesDirectories = ['node_modules', 'web_modules']; | ||
var extensions = ["", ".web.js", ".js", ".jsx", ".json"]; | ||
var root = __dirname; | ||
var modulesDirectories = [ 'node_modules', 'web_modules' ]; | ||
var extensions = [ '', '.web.js', '.js', '.jsx', '.json' ]; | ||
var root = __dirname; | ||
|
||
var publicPath = options.devServer ? | ||
"http://localhost:2992/assets/" : | ||
"/assets/"; | ||
var publicPath = options.devServer ? 'http://localhost:2992/assets/' : '/assets/'; | ||
|
||
var output = { | ||
path: path.join(__dirname, "dist"), | ||
publicPath, | ||
filename: "[name].js", | ||
chunkFilename: options.devServer ? "[id].js" : "[name].js", | ||
sourceMapFilename: "debugging/[file].map", | ||
pathinfo: options.debug, | ||
libraryTarget: 'umd' | ||
}; | ||
var output = { | ||
path: path.join(__dirname, 'dist'), | ||
publicPath, | ||
filename: '[name].js', | ||
chunkFilename: options.devServer ? '[id].js' : '[name].js', | ||
sourceMapFilename: 'debugging/[file].map', | ||
pathinfo: options.debug, | ||
libraryTarget: 'umd' | ||
}; | ||
|
||
var excludeFromStats = [ | ||
/node_modules[\\\/]react(-router)?[\\\/]/, | ||
/node_modules[\\\/]items-store[\\\/]/ | ||
]; | ||
var excludeFromStats = [ | ||
/node_modules[\\\/]react(-router)?[\\\/]/, | ||
/node_modules[\\\/]items-store[\\\/]/ | ||
]; | ||
|
||
var plugins = [ | ||
new StatsPlugin(path.join(__dirname, "build", "stats.json"), { | ||
chunkModules: true, | ||
exclude: excludeFromStats | ||
}), | ||
new ContextReplacementPlugin(/moment\.js[\/\\]lang$/, /^\.\/(de|pl)$/) | ||
]; | ||
var plugins = [ | ||
new StatsPlugin(path.join(__dirname, 'build', 'stats.json'), { | ||
chunkModules: true, | ||
exclude: excludeFromStats | ||
}), | ||
new ContextReplacementPlugin(/moment\.js[\/\\]lang$/, /^\.\/(de|pl)$/) | ||
]; | ||
|
||
if(options.minimize) { | ||
plugins.push( | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compressor: { | ||
warnings: false | ||
} | ||
}), | ||
new webpack.optimize.DedupePlugin() | ||
); | ||
plugins.push( | ||
new webpack.DefinePlugin({ | ||
"process.env": { | ||
NODE_ENV: JSON.stringify("production") | ||
} | ||
}), | ||
if(options.minimize) { | ||
plugins.push( | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compressor: { | ||
warnings: false | ||
} | ||
}), | ||
new webpack.optimize.DedupePlugin() | ||
); | ||
plugins.push( | ||
new webpack.DefinePlugin({'process.env': { NODE_ENV: JSON.stringify('production')}}), | ||
new webpack.NoErrorsPlugin() | ||
); | ||
} | ||
} | ||
|
||
return { | ||
entry: entry, | ||
output: output, | ||
target: 'node', | ||
module: { loaders: loaders }, | ||
devtool: options.devtool, | ||
debug: options.debug, | ||
resolveLoader: { | ||
root: path.join(__dirname, "node_modules"), | ||
alias: aliasLoader | ||
}, | ||
externals: externals, | ||
resolve: { | ||
root: root, | ||
modulesDirectories: modulesDirectories, | ||
extensions: extensions, | ||
alias: alias | ||
}, | ||
plugins: plugins, | ||
devServer: { | ||
stats: { | ||
cached: false, | ||
exclude: excludeFromStats | ||
} | ||
} | ||
}; | ||
return { | ||
entry, | ||
output, | ||
target: 'node', | ||
module: { loaders }, | ||
devtool: options.devtool, | ||
debug: options.debug, | ||
resolveLoader: { | ||
root: path.join(__dirname, 'node_modules'), | ||
alias: aliasLoader | ||
}, | ||
externals, | ||
resolve: { | ||
root, | ||
modulesDirectories, | ||
extensions, | ||
alias | ||
}, | ||
plugins, | ||
devServer: { | ||
stats: { | ||
cached: false, | ||
exclude: excludeFromStats | ||
} | ||
} | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters