Skip to content

Commit

Permalink
Updated the package builds to support umd, esm and common versions
Browse files Browse the repository at this point in the history
  • Loading branch information
benatespina committed May 23, 2018
1 parent 2fdacc9 commit e64d629
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
This changelog references the relevant changes done between versions.

To get the diff for a specific change, go to https://github.com/FriendsOfECMAScript/BenGorCookies/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/FriendsOfECMAScript/BenGorCookies/compare/v0.8.0...v0.9.0
To get the diff between two versions, go to https://github.com/FriendsOfECMAScript/BenGorCookies/compare/v0.9.0...v0.10.0

* 0.10.0
* Updated the package builds to support `umd`, `esm` and `common` versions.
* 0.9.0
* Added modern theme with its how to use section in the readme.
* Removed custom `prepend` method from DomHelpers.
Expand Down
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bengor-cookies",
"version": "0.9.0",
"version": "0.10.0",
"license": "MIT",
"description": "Cookie warning banner that request user consent, European law compilant. Zero dependencies, fully customizable",
"keywords": [
Expand All @@ -20,7 +20,8 @@
"homepage": "http://gorkalaucirica.net"
}
],
"main": "dist/bengor-cookies.js",
"main": "dist/common/index.js",
"module": "dist/esm/index.js",
"repository": {
"type": "git",
"url": "https://github.com/FriendsOfECMAScript/BenGorCookies"
Expand All @@ -31,9 +32,10 @@
"scripts": {
"test": "node_modules/.bin/jest",
"prebuild": "node_modules/.bin/rimraf dist && node_modules/.bin/mkdirp dist",
"build": "npm-run-all --parallel build:*",
"build:main": "node_modules/.bin/babel src/js -d dist --ignore umd.js && rename dist/index.js bengor-cookies.js",
"build:webpack": "node_modules/.bin/webpack -p && node_modules/.bin/rimraf dist/*ie9.j* && node_modules/.bin/rimraf dist/*modern.j*",
"build": "yarn prebuild && yarn cs && yarn common-bundle && yarn esm-bundle && yarn umd-bundle",
"common-bundle": "node_modules/.bin/babel --copy-files --out-dir dist/common src",
"esm-bundle": "cp -R src/ dist/esm",
"umd-bundle": "node_modules/.bin/webpack -p && node_modules/.bin/rimraf dist/*ie9.j* && node_modules/.bin/rimraf dist/*modern.j*",
"cs": "npm run prettier && npm run eslint && npm run stylelint",
"prettier": "node_modules/.bin/prettier 'src/js/**/*.js' 'test/**/*.js' --write --single-quote --no-bracket-spacing --trailing-comma es5 --print-width 120",
"eslint": "node_modules/.bin/eslint -c .eslintrc.js src/js/ test/js/",
Expand Down Expand Up @@ -70,13 +72,15 @@
}
}
},
"dependencies": {
"babel-preset-env": "^1.7.0",
"babel-preset-minify": "^0.5.0-alpha.a28b6b00"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-jest": "^21.2.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-minify": "^0.2.0",
"css-loader": "^0.28.7",
"cssnano": "^3.10.0",
"eslint": "^4.12.0",
Expand Down
10 changes: 7 additions & 3 deletions src/js/Cookies.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ import * as CookieHelpers from './Helpers/CookieHelpers.js';
import * as DomHelpers from './Helpers/DomHelpers.js';

class Cookies {
constructor(
{triggers = 'html', maxPageYOffset = false, plugins = [], template = null, onAcceptCallback = () => {}} = {}
) {
constructor({
triggers = 'html',
maxPageYOffset = false,
plugins = [],
template = null,
onAcceptCallback = () => {},
} = {}) {
this.triggers = [...document.querySelectorAll(triggers)];
this.cookieName = 'bengor-cookie';
this.scrollMovement = 0;
Expand Down

0 comments on commit e64d629

Please sign in to comment.