Skip to content

Commit

Permalink
feat: clean up build
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Nov 2, 2018
1 parent 133bf36 commit cb47455
Show file tree
Hide file tree
Showing 31 changed files with 7,223 additions and 216 deletions.
3 changes: 1 addition & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"presets": ["latest", "stage-3"],
"plugins": ["add-module-exports"]
"presets": ["@react-bootstrap/babel-preset"]
}
6 changes: 3 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

parser: babel-eslint
extends: jason
{
"extends": "jason"
}
5 changes: 0 additions & 5 deletions .npmignore

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
addons:
addons:
firefox: latest
branches:
only:
Expand Down
103 changes: 0 additions & 103 deletions karma-sauce.conf.js

This file was deleted.

44 changes: 19 additions & 25 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
'use strict';
'use strict'

var isCI = process.env.CONTINUOUS_INTEGRATION === 'true';

module.exports = function (config) {
var isCI = process.env.CONTINUOUS_INTEGRATION === 'true'

module.exports = function(config) {
config.set({

basePath: '',

frameworks: ['mocha', 'sinon'],

reporters: ['mocha'],

files: [
'test/fixtures/*.html',
'test.js'
],
files: ['test/fixtures/*.html', 'test.js'],

port: 9876,
colors: true,
Expand All @@ -24,38 +19,37 @@ module.exports = function (config) {

logLevel: config.LOG_INFO,

browsers: [ isCI ? 'ChromeTravisCI' : 'Chrome', 'Firefox' ],
browsers: [isCI ? 'ChromeTravisCI' : 'Chrome', 'Firefox'],

customLaunchers: {
ChromeTravisCI: {
base: 'Chrome',
flags: ['--no-sandbox']
}
flags: ['--no-sandbox'],
},
},

preprocessors: {
'test/fixtures/*.html': 'html2js',
'test.js': ['webpack', 'sourcemap']
'test.js': ['webpack', 'sourcemap'],
},

webpack: {
devtool: 'inline-source-map',

entry: __dirname + '/test.js',
module: {
loaders: [
rules: [
{
test: /.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
}
test: /.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
],
},
},

webpackServer: {
noInfo: true
}

});
};
noInfo: true,
},
})
}
57 changes: 26 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dom-helpers",
"version": "3.3.1",
"description": "tiny modular DOM lib for ie8+ ",
"description": "tiny modular DOM lib for ie8+",
"author": {
"name": "Jason Quense",
"email": "[email protected]"
Expand All @@ -27,50 +27,45 @@
"scripts": {
"test": "karma start --single-run",
"tdd": "karma start",
"clean": "rimraf ./lib/*",
"copy": "cpy ./README.md ./lib",
"build": "babel src --out-dir lib && npm run copy",
"build": "babel src --out-dir lib --delete-dir-on-start",
"lint": "eslint src",
"release": "release"
"release": "rollout"
},
"release-script": {
"altPkgRootFolder": "lib"
"release": {
"publishDir": "lib",
"conventionalCommits": true
},
"devDependencies": {
"babel-cli": "^6.16.0",
"babel-core": "^6.17.0",
"babel-eslint": "^7.0.0",
"babel-loader": "^6.2.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-preset-latest": "^6.16.0",
"babel-preset-stage-3": "^6.17.0",
"cpy-cli": "^1.0.1",
"es5-shim": "^4.5.9",
"eslint": "^3.7.1",
"@4c/rollout": "^1.2.0",
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@react-bootstrap/babel-preset": "^1.1.2",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.4",
"cpy-cli": "^2.0.0",
"eslint": "^5.8.0",
"eslint-config-jason": "^4.0.0",
"eslint-plugin-import": "^2.0.1",
"expect.js": "^0.3.1",
"get-saucelabs-browsers": "^1.0.1",
"imports-loader": "^0.6.3",
"jquery": "^1.11.3",
"json-loader": "^0.5.1",
"karma": "^1.3.0",
"jquery": "^3.3.1",
"karma": "^3.1.1",
"karma-chrome-launcher": "^2.0.0",
"karma-firefox-launcher": "^1.0.1",
"karma-html2js-preprocessor": "^1.1.0",
"karma-mocha": "~0.1.9",
"karma-mocha-reporter": "^0.3.1",
"karma-mocha": "~1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-sauce-launcher": "^1.0.0",
"karma-sinon": "^1.0.5",
"karma-sourcemap-loader": "^0.3.2",
"karma-webpack": "^1.8.0",
"less-loader": "^2.0.0",
"merge-stream": "^0.1.7",
"mocha": "^1.21.4",
"release-script": "^1.0.2",
"karma-webpack": "^3.0.5",
"mocha": "^5.2.0",
"rimraf": "^2.2.8",
"simulant": "^0.1.3",
"sinon": "^1.17.6",
"webpack": "^1.13.2"
"simulant": "^0.2.2",
"sinon": "^7.1.1",
"webpack": "^4.23.1"
},
"dependencies": {
"@babel/runtime": "^7.1.2"
}
}
4 changes: 2 additions & 2 deletions src/class/addClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default function addClass(element, className){
element.classList.add(className)
else if ( !hasClass(element, className))
if (typeof element.className === 'string')
element.className = element.className + ' ' + className
element.className = `${element.className } ${ className}`
else
element.setAttribute('class', (element.className && element.className.baseVal || '') + ' ' + className)
element.setAttribute('class', `${element.className && element.className.baseVal || '' } ${ className}`)
}
3 changes: 1 addition & 2 deletions src/class/hasClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
export default function hasClass(element, className) {
if ( element.classList)
return !!className && element.classList.contains(className)
else
return ` ${element.className.baseVal || element.className} `.indexOf(` ${className} `) !== -1
return ` ${element.className.baseVal || element.className} `.indexOf(` ${className} `) !== -1
}
4 changes: 2 additions & 2 deletions src/class/removeClass.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

function replaceClassName(origClass, classToRemove) {
return origClass.replace(new RegExp('(^|\\s)' + classToRemove + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
return origClass.replace(new RegExp(`(^|\\s)${ classToRemove }(?:\\s|$)`, 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
}

module.exports = function removeClass(element, className){
Expand Down
4 changes: 2 additions & 2 deletions src/events/off.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ if (canUseDOM) {
return (node, eventName, handler, capture) =>
node.removeEventListener(eventName, handler, capture || false);

else if (document.attachEvent)
if (document.attachEvent)
return (node, eventName, handler) =>
node.detachEvent('on' + eventName, handler);
node.detachEvent(`on${ eventName}`, handler);
})();
}

Expand Down
4 changes: 2 additions & 2 deletions src/events/on.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ if (canUseDOM) {
return (node, eventName, handler, capture) =>
node.addEventListener(eventName, handler, capture || false);

else if (document.attachEvent)
if (document.attachEvent)
return (node, eventName, handler) =>
node.attachEvent('on' + eventName, (e) => {
node.attachEvent(`on${ eventName}`, (e) => {
e = e || window.event;
e.target = e.target || e.srcElement;
e.currentTarget = node;
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';

import style from './style'
import events from './events'
import query from './query'
Expand Down
6 changes: 3 additions & 3 deletions src/query/contains.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export default (function(){
? function(context, node){
if (context.contains) {
return context.contains(node);
} else if (context.compareDocumentPosition){
} if (context.compareDocumentPosition){
return context === node || !!(context.compareDocumentPosition(node) & 16);
} else {
return fallback(context, node);
}
return fallback(context, node);

}
: fallback;
})()
Expand Down
2 changes: 1 addition & 1 deletion src/query/matches.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function matches(node, selector) {
}

function ie8MatchesSelector(node, selector) {
var matches = qsa(node.document || node.ownerDocument, selector)
let matches = qsa(node.document || node.ownerDocument, selector)
, i = 0;

while (matches[i] && matches[i] !== node) i++;
Expand Down
2 changes: 1 addition & 1 deletion src/query/offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import getWindow from './isWindow'
import ownerDocument from '../ownerDocument'

export default function offset(node) {
var doc = ownerDocument(node)
let doc = ownerDocument(node)
, win = getWindow(doc)
, docElem = doc && doc.documentElement
, box = { top: 0, left: 0, height: 0, width: 0 };
Expand Down
2 changes: 1 addition & 1 deletion src/query/offsetParent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function nodeName(node) {
}

export default function offsetParent(node) {
var doc = ownerDocument(node)
let doc = ownerDocument(node)
, offsetParent = node && node.offsetParent;

while (offsetParent && nodeName(node) !== 'html' && css(offsetParent, 'position') === 'static' ) {
Expand Down
Loading

0 comments on commit cb47455

Please sign in to comment.