Skip to content

Commit

Permalink
v2.3.1 Close #22 ES5 build, add SourceMap
Browse files Browse the repository at this point in the history
  • Loading branch information
dmythro committed Jan 29, 2018
1 parent 58be0e2 commit b814a0a
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 28 deletions.
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "Countries",
"version": "2.4.0",
"version": "2.3.1",
"homepage": "http://annexare.github.io/Countries/",
"author": {
"name": "Dmytro",
Expand Down
2 changes: 1 addition & 1 deletion composer.json
@@ -1,6 +1,6 @@
{
"name": "annexare/countries-list",
"version": "2.4.0",
"version": "2.3.1",
"description": "Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.",
"type": "library",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions dist/index.es5.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index.es5.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 43 additions & 21 deletions gulpfile.js
Expand Up @@ -144,37 +144,59 @@ gulp.task(DO_EMOJI, function (callback) {
callback && callback();
});

gulp.task(DO_MIN_ES5, function () {
const babel = require('gulp-babel');
const header = require('gulp-header');
gulp.task(DO_MIN_ES5, function (callback) {
const pkg = require('./package.json');
const uglify = require('gulp-uglify');
const webpack = require('webpack-stream');
const banner = `${pkg.name} v${pkg.version} by Annexare | ${pkg.license}`;
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

const banner = '/*! <%= pkg.name %> v<%= pkg.version %> by Annexare | <%= pkg.license %> */\n';

return gulp.src('dist/index.js')
.pipe(webpack({
const webpackConfig = {
entry: `${DIST}index.js`,
output: {
filename: `index.${DO_MIN_ES5}.${JS_EXT}`,
libraryTarget: 'umd',
library: NAME,
path: require('path').resolve(__dirname, DIST),
umdNamedDefine: true,
},
stats: false
}))
.pipe(babel({
presets: [
['env', {
targets: {
uglify: true
module: {
rules: [
{
test: /\.js$/, use: {
loader: 'babel-loader',
options: {
presets: ['babel-preset-env']
}
}
}]
}
]
}))
.pipe(uglify())
.pipe(header(banner, { pkg }))
.pipe(gulp.dest('dist/'));
},
plugins: [
new UglifyJsPlugin({
uglifyOptions: {
// compress: true,
ecma: 5,
ie8: true,
output: {
// comments: false,
// beautify: false,
ecma: 5,
},
}
}),
new webpack.BannerPlugin(banner),
],
stats: false,
target: 'web',
};

webpack(webpackConfig, (err, stats) => {
if (err || stats.hasErrors()) {
console.error('ERROR', err || stats.toJson('errors-only'));
}

callback();
});
});

gulp.task(DO_MIN, function (callback) {
Expand Down
9 changes: 6 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "countries-list",
"version": "2.4.0",
"version": "2.3.1",
"description": "Continents & countries: ISO 3166-1 alpha-2 code, name, ISO 639-1 languages, capital, currency, native name, phone. JSON, CSV and SQL.",
"main": "./dist/index.es5.min.js",
"repository": {
Expand Down Expand Up @@ -36,13 +36,16 @@
"typings": "./dist/index.d.ts",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1",
"eslint": "^4.14.0",
"gulp": "^3.9.1",
"gulp-babel": "^7.0.0",
"gulp-header": "^1.8.9",
"gulp-babel": "^7.0.1",
"gulp-header": "^2.0.1",
"gulp-uglify": "^3.0.0",
"punycode": "^2.1.0",
"uglifyjs-webpack-plugin": "^1.1.6",
"webpack": "^3.10.0",
"webpack-stream": "^4.0.0"
},
"devEngines": {
Expand Down

0 comments on commit b814a0a

Please sign in to comment.