Skip to content

Commit

Permalink
v2.4.1 Fix Webpack 4 globalObject; add <script> test
Browse files Browse the repository at this point in the history
  • Loading branch information
dmythro committed Jan 2, 2019
1 parent 622084e commit a387ddd
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
@@ -1,5 +1,6 @@
{
"env": {
"browser": true,
"jest": true,
"node": true
},
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "Countries",
"version": "2.4.0",
"version": "2.4.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.4.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.

13 changes: 13 additions & 0 deletions dist/index.es5.min.test.js
@@ -1,3 +1,4 @@
const fs = require('fs');
const es5 = require('./index.es5.min.js');
const lib = require('./index.js');

Expand All @@ -9,3 +10,15 @@ test('has proper ES5 export', () => {
expect(es5.hasOwnProperty(prop)).toBeTruthy();
});
});

test('loads ES5 <script> properly', () => {
const scriptEl = document.createElement('script');
scriptEl.text = fs.readFileSync(__dirname + '/index.es5.min.js');
document.body.appendChild(scriptEl);

expect(window.Countries).toBeDefined();

Object.keys(lib).forEach(prop => {
expect(window.Countries.hasOwnProperty(prop)).toBeTruthy();
});
});
13 changes: 7 additions & 6 deletions gulpfile.js
Expand Up @@ -152,13 +152,14 @@ exports[DO_MIN_ES5] = function min_es5(callback) {

const webpackConfig = {
entry: `${DIST}index.js`,
output: {
filename: `index.${DO_MIN_ES5}.${JS_EXT}`,
libraryTarget: 'umd',
library: NAME,
output: {
globalObject: 'this',
filename: `index.${DO_MIN_ES5}.${JS_EXT}`,
libraryTarget: 'umd',
library: NAME,
path: require('path').resolve(__dirname, DIST),
umdNamedDefine: true,
},
umdNamedDefine: true,
},
module: {
rules: [
{
Expand Down
3 changes: 2 additions & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "countries-list",
"version": "2.4.0",
"version": "2.4.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 @@ -55,6 +55,7 @@
"/node_modules/",
".*\\.min\\.js"
],
"testEnvironment": "jsdom",
"verbose": true
},
"license": "MIT",
Expand Down

0 comments on commit a387ddd

Please sign in to comment.