Update: build to support windows (i think)

This commit is contained in:
cybice 2015-09-24 21:47:06 +03:00
parent be292fb9f9
commit 079af60831
9 changed files with 7483 additions and 54 deletions

View File

@ -1,3 +1,4 @@
{
"stage": 0
"stage": 0,
"loose": "all",
}

7407
dist/GoogleMapReact.js vendored Normal file

File diff suppressed because it is too large Load Diff

7
dist/GoogleMapReact.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -4,8 +4,11 @@
"description": "isomorphic google map react component, allows render react components on the google map",
"main": "lib/index",
"scripts": {
"build": "./scripts/build.sh",
"prepublish": "npm run build",
"build:lib": "babel ./src -d lib --ignore '__tests__'",
"build:umd": "webpack src/index.js dist/GoogleMapReact.js --config webpack.config.dev.js",
"build:umd:min": "webpack src/index.js dist/GoogleMapReact.min.js --config webpack.config.prod.js",
"clean": "rimraf lib dist",
"prepublish": "npm run clean && npm run build:lib && npm run build:umd && npm run build:umd:min",
"eyetest": "babel-node ./src/__tests__/eye_test.js",
"es5eyetest": "node ./lib/__tests__/eye_test.js"
},
@ -48,6 +51,7 @@
"babel-loader": "^5.3.2",
"react": "^0.14.0-rc1",
"react-dom": "^0.14.0-rc1",
"rimraf": "^2.4.3",
"webpack": "^1.12.2"
}
}

View File

@ -1,13 +0,0 @@
#!/bin/sh
babel=`npm bin`/babel
webpack=`npm bin`/webpack
build_dir=lib
rm -rf $build_dir
$babel ./src -d $build_dir --ignore "__tests__" --loose all
NODE_ENV=production $webpack src/index.js $build_dir/umd/GoogleMapReact.js
NODE_ENV=production $webpack -p src/index.js $build_dir/umd/GoogleMapReact.min.js
#echo "gzipped, the global build is `gzip -c $build_dir/umd/GoogleMapReact.min.js | wc -c | sed -e 's/^[[:space:]]*//'` bytes"

31
webpack.config.base.js Normal file
View File

@ -0,0 +1,31 @@
var webpack = require('webpack');
var reactExternal = {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
};
var reactDomExternal = {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom'
};
module.exports = {
output: {
library: 'GoogleMapReact',
libraryTarget: 'umd'
},
externals: {
'react': reactExternal,
'react-dom': reactDomExternal,
},
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' }
]
},
};

12
webpack.config.dev.js Normal file
View File

@ -0,0 +1,12 @@
var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');
var config = Object.create(baseConfig);
config.plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
];
module.exports = config;

View File

@ -1,38 +0,0 @@
var webpack = require('webpack');
module.exports = {
output: {
library: 'GoogleMapReact',
libraryTarget: 'umd'
},
externals: [
{
"react": {
root: "React",
commonjs2: "react",
commonjs: "react",
amd: "react"
}
}
],
module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel?loose=all' }
]
},
node: {
Buffer: false
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
]
};

18
webpack.config.prod.js Normal file
View File

@ -0,0 +1,18 @@
var webpack = require('webpack');
var baseConfig = require('./webpack.config.base');
var config = Object.create(baseConfig);
config.plugins = [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
screw_ie8: true,
warnings: false
}
})
];
module.exports = config;