[build] switch to webpack from browserify
This commit is contained in:
@ -17,9 +17,9 @@ module.exports = function (grunt) {
|
|||||||
|
|
||||||
grunt.task.run([
|
grunt.task.run([
|
||||||
'clean:dist',
|
'clean:dist',
|
||||||
'browserify:browser_client',
|
'webpack:browser_client',
|
||||||
'browserify:angular_client',
|
'webpack:angular_client',
|
||||||
'browserify:jquery_client',
|
'webpack:jquery_client',
|
||||||
'uglify:dist',
|
'uglify:dist',
|
||||||
'concat:dist_banners'
|
'concat:dist_banners'
|
||||||
]);
|
]);
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
yaml_suite: {
|
|
||||||
options: {
|
|
||||||
external: [
|
|
||||||
'optimist'
|
|
||||||
],
|
|
||||||
ignore: [
|
|
||||||
'test/integration/yaml_suite/reporter',
|
|
||||||
'src/elasticsearch.js'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
files: {
|
|
||||||
'test/integration/browser_yaml_suite/yaml_tests.js': 'test/integration/yaml_suite/index.js'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
browser_client: {
|
|
||||||
files: {
|
|
||||||
'<%= distDir %>/elasticsearch.js': 'src/elasticsearch.js'
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
standalone: 'elasticsearch',
|
|
||||||
ignore: [
|
|
||||||
'src/lib/connectors/jquery.js',
|
|
||||||
'src/lib/connectors/angular.js'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
angular_client: {
|
|
||||||
files: {
|
|
||||||
'<%= distDir %>/elasticsearch.angular.js': ['src/elasticsearch.angular.js']
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
ignore: [
|
|
||||||
'src/lib/connectors/jquery.js',
|
|
||||||
'src/lib/connectors/xhr.js',
|
|
||||||
'promise/lib/es6-extensions'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
jquery_client: {
|
|
||||||
files: {
|
|
||||||
'<%= distDir %>/elasticsearch.jquery.js': ['src/elasticsearch.jquery.js']
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
ignore: [
|
|
||||||
'src/lib/connectors/angular.js',
|
|
||||||
'src/lib/connectors/xhr.js',
|
|
||||||
'promise/lib/es6-extensions'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
5
grunt/config/webpack.js
Normal file
5
grunt/config/webpack.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
browser_client: require('../../webpack_config/browser'),
|
||||||
|
angular_client: require('../../webpack_config/angular'),
|
||||||
|
jquery_client: require('../../webpack_config/jquery'),
|
||||||
|
}
|
||||||
12
package.json
12
package.json
@ -41,13 +41,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aliasify": "~1.2.4",
|
|
||||||
"@spalger/eslint-config-personal": "^0.4.0",
|
"@spalger/eslint-config-personal": "^0.4.0",
|
||||||
"async": "~0.8.0",
|
"async": "~0.8.0",
|
||||||
"babel-eslint": "^6.0.4",
|
"babel-eslint": "^6.0.4",
|
||||||
"blanket": "~1.1.5",
|
"blanket": "~1.1.5",
|
||||||
"bluebird": "^2.9.14",
|
"bluebird": "^2.9.14",
|
||||||
"browserify": "~2.35.1",
|
|
||||||
"eslint": "^2.9.0",
|
"eslint": "^2.9.0",
|
||||||
"eslint-config-airbnb": "^8.0.0",
|
"eslint-config-airbnb": "^8.0.0",
|
||||||
"eslint-plugin-import": "^1.6.1",
|
"eslint-plugin-import": "^1.6.1",
|
||||||
@ -58,13 +56,12 @@
|
|||||||
"find-root": "~0.1.1",
|
"find-root": "~0.1.1",
|
||||||
"glob": "~3.2.7",
|
"glob": "~3.2.7",
|
||||||
"grunt": "~0.4.1",
|
"grunt": "~0.4.1",
|
||||||
"grunt-browserify": "~1.2.11",
|
|
||||||
"grunt-cli": "~0.1.13",
|
"grunt-cli": "~0.1.13",
|
||||||
"grunt-contrib-clean": "~0.5.0",
|
"grunt-contrib-clean": "~0.5.0",
|
||||||
"grunt-contrib-compress": "~0.5.3",
|
"grunt-contrib-compress": "~0.5.3",
|
||||||
"grunt-contrib-concat": "~0.3.0",
|
"grunt-contrib-concat": "~0.3.0",
|
||||||
"grunt-contrib-copy": "~0.4.1",
|
"grunt-contrib-copy": "~0.4.1",
|
||||||
"grunt-contrib-uglify": "^0.11.0",
|
"grunt-contrib-uglify": "^1.0.1",
|
||||||
"grunt-contrib-watch": "~0.5.3",
|
"grunt-contrib-watch": "~0.5.3",
|
||||||
"grunt-esvm": "^3.1.1",
|
"grunt-esvm": "^3.1.1",
|
||||||
"grunt-mocha-cov": "^0.4.0",
|
"grunt-mocha-cov": "^0.4.0",
|
||||||
@ -73,6 +70,7 @@
|
|||||||
"grunt-run": "~0.2.2",
|
"grunt-run": "~0.2.2",
|
||||||
"grunt-s3": "~0.2.0-alpha.3",
|
"grunt-s3": "~0.2.0-alpha.3",
|
||||||
"grunt-saucelabs": "~8.2.0",
|
"grunt-saucelabs": "~8.2.0",
|
||||||
|
"grunt-webpack": "^1.0.11",
|
||||||
"jquery": "~2.1.1",
|
"jquery": "~2.1.1",
|
||||||
"js-yaml": "^3.6.0",
|
"js-yaml": "^3.6.0",
|
||||||
"load-grunt-config": "~0.7.0",
|
"load-grunt-config": "~0.7.0",
|
||||||
@ -82,6 +80,7 @@
|
|||||||
"mocha-screencast-reporter": "~0.1.4",
|
"mocha-screencast-reporter": "~0.1.4",
|
||||||
"moment": "~2.4.0",
|
"moment": "~2.4.0",
|
||||||
"nock": "~0.28.3",
|
"nock": "~0.28.3",
|
||||||
|
"null-loader": "^0.1.1",
|
||||||
"open": "0.0.4",
|
"open": "0.0.4",
|
||||||
"optimist": "~0.6.0",
|
"optimist": "~0.6.0",
|
||||||
"semver": "^4.3.6",
|
"semver": "^4.3.6",
|
||||||
@ -89,6 +88,8 @@
|
|||||||
"split": "~0.3.2",
|
"split": "~0.3.2",
|
||||||
"through2": "~0.6.3",
|
"through2": "~0.6.3",
|
||||||
"through2-map": "~1.4.0",
|
"through2-map": "~1.4.0",
|
||||||
|
"webpack": "^1.13.0",
|
||||||
|
"webpack-dev-server": "^1.14.1",
|
||||||
"xmlbuilder": "~0.4.3"
|
"xmlbuilder": "~0.4.3"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@ -105,7 +106,8 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "grunt test",
|
"test": "grunt test",
|
||||||
"generate": "node scripts/generate"
|
"generate": "node scripts/generate",
|
||||||
|
"grunt": "grunt"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8"
|
"node": ">=0.8"
|
||||||
|
|||||||
25
webpack_config/angular.js
vendored
Normal file
25
webpack_config/angular.js
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
const DefinePlugin = require('webpack/lib/DefinePlugin')
|
||||||
|
const { ignoreLoader, rel } = require('./lib')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
context: rel('src'),
|
||||||
|
entry: './elasticsearch.angular.js',
|
||||||
|
output: {
|
||||||
|
filename: 'elasticsearch.angular.js',
|
||||||
|
path: rel('dist'),
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
ignoreLoader([
|
||||||
|
'src/lib/connectors/jquery.js',
|
||||||
|
'src/lib/connectors/xhr.js',
|
||||||
|
'promise/lib/es6-extensions',
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new DefinePlugin({
|
||||||
|
'process.env.NODE_ENV': '"production"',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}
|
||||||
25
webpack_config/browser.js
Normal file
25
webpack_config/browser.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
const DefinePlugin = require('webpack/lib/DefinePlugin')
|
||||||
|
const { ignoreLoader, rel } = require('./lib')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
context: rel('src'),
|
||||||
|
entry: './elasticsearch.js',
|
||||||
|
output: {
|
||||||
|
filename: 'elasticsearch.js',
|
||||||
|
path: rel('dist'),
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
ignoreLoader([
|
||||||
|
'src/lib/connectors/jquery.js',
|
||||||
|
'src/lib/connectors/angular.js',
|
||||||
|
'promise/lib/es6-extensions',
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new DefinePlugin({
|
||||||
|
'process.env.NODE_ENV': '"production"',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}
|
||||||
25
webpack_config/jquery.js
vendored
Normal file
25
webpack_config/jquery.js
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
const DefinePlugin = require('webpack/lib/DefinePlugin')
|
||||||
|
const { ignoreLoader, rel } = require('./lib')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
context: rel('src'),
|
||||||
|
entry: './elasticsearch.jquery.js',
|
||||||
|
output: {
|
||||||
|
filename: 'elasticsearch.jquery.js',
|
||||||
|
path: rel('dist'),
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
ignoreLoader([
|
||||||
|
'src/lib/connectors/angular.js',
|
||||||
|
'src/lib/connectors/xhr.js',
|
||||||
|
'promise/lib/es6-extensions',
|
||||||
|
]),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new DefinePlugin({
|
||||||
|
'process.env.NODE_ENV': '"production"',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}
|
||||||
21
webpack_config/lib.js
Normal file
21
webpack_config/lib.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
const rel = require('path').resolve.bind(null, __dirname, '..')
|
||||||
|
|
||||||
|
function ignoreLoader(ignores) {
|
||||||
|
return {
|
||||||
|
loader: 'null-loader',
|
||||||
|
test(path) {
|
||||||
|
return ignores.some(ignore => path.includes(ignore))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function jsLoader() {
|
||||||
|
return {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
test: /\.js$/,
|
||||||
|
include: rel('src'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { ignoreLoader, jsLoader, rel }
|
||||||
Reference in New Issue
Block a user