Skip to content

Commit

Permalink
Add local dev environment
Browse files Browse the repository at this point in the history
  • Loading branch information
siamalekpour committed Sep 25, 2017
1 parent f877f83 commit 4d9267a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 5 deletions.
8 changes: 7 additions & 1 deletion .babelrc
@@ -1,3 +1,9 @@
{
"presets": ["es2015"]
"presets": ["es2015"],
"plugins": [
"syntax-object-rest-spread", "transform-object-rest-spread", "transform-class-properties",
["module-resolver", {
"root": ["./src"]
}]
]
}
15 changes: 11 additions & 4 deletions package.json
Expand Up @@ -5,8 +5,9 @@
"main": "build/gapi-js.js",
"module": "src/gapi-js.js",
"scripts": {
"build": "webpack --display-error-details -p --progress --colors",
"build:watch": "webpack --display-error-details -p --progress --colors --watch",
"start": "webpack-dev-server -d --inline --progress --colors --history-api-fallback --config webpack.development.js",
"build": "webpack --display-error-details -p --progress --colors --config webpack.production.js",
"build:watch": "webpack --display-error-details -p --progress --colors --watch --config webpack.production.js",
"prepublish": "npm run build",
"test": "jest"
},
Expand All @@ -19,10 +20,16 @@
"babel-core": "^6.23.1",
"babel-jest": "^19.0.0",
"babel-loader": "^6.3.2",
"babel-preset-es2015": "^6.22.0",
"babel-plugin-syntax-object-rest-spread": "^6.13.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"clean-webpack-plugin": "^0.1.15",
"html-webpack-plugin": "^2.30.1",
"jest": "^19.0.2",
"webpack": "^2.2.1"
"webpack": "^2.2.1",
"webpack-dev-server": "^2.8.2"
},
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions src/examples.js
@@ -0,0 +1,7 @@
import Gapi from './gapi-js';


const g = new Gapi({ key: 'xxx', proxy: 'version=alldossiers' });
g.countries.list().page(1, 5).end((err, res) => {
console.log(res.body.res)
});
40 changes: 40 additions & 0 deletions webpack.development.js
@@ -0,0 +1,40 @@
const path = require('path'),
webpack = require('webpack'),
HtmlWebpackPlugin = require('html-webpack-plugin');

const PATHS = {
main: path.join(__dirname, 'src', 'examples.js'),
build: path.join(__dirname, 'build')
};

module.exports = {
entry: {
'gapi-js': ['babel-polyfill', PATHS.main]
},
cache: true,
output: {
path: PATHS.build,
filename: '[name].js',
sourceMapFilename : '[file].map',
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin ({ title : 'Gapi JS Examples' }),
new webpack.HotModuleReplacementPlugin({ multiStep: true }),
new webpack.DefinePlugin({
conf: {
api: {
url: 'https://rest.gadventures.com',
key: 'xxx'
}
}
}),
],
devServer: {
historyApiFallback: true,
hot: true,
inline: true,
stats: 'errors-only',
port: 5000
},
};
File renamed without changes.

0 comments on commit 4d9267a

Please sign in to comment.