Commit bcad7805 authored by Wikiki's avatar Wikiki

build:

parent 86b6fa49
......@@ -15,7 +15,6 @@
}
},
"plugins": [
"transform-object-rest-spread",
"transform-object-assign"
"transform-object-rest-spread"
]
}
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"globals": {
"ENV": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 6,
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
},
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
}
}
......@@ -7,8 +7,6 @@ notifications:
node_js:
- '9'
- '8'
- '6'
- '4'
after_success:
- npm run travis-deploy-once "npm run semantic-release"
branches:
......
......@@ -105,15 +105,15 @@ var KEY_BACKSPACE = 8,
KEY_DELETE = 46,
KEY_COMMA = 188;
var bulmaTagsInput = function (_EventEmitter) {
_inherits(bulmaTagsInput, _EventEmitter);
var bulmaTagsinput = function (_EventEmitter) {
_inherits(bulmaTagsinput, _EventEmitter);
function bulmaTagsInput(selector) {
function bulmaTagsinput(selector) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, bulmaTagsInput);
_classCallCheck(this, bulmaTagsinput);
var _this = _possibleConstructorReturn(this, (bulmaTagsInput.__proto__ || Object.getPrototypeOf(bulmaTagsInput)).call(this));
var _this = _possibleConstructorReturn(this, (bulmaTagsinput.__proto__ || Object.getPrototypeOf(bulmaTagsinput)).call(this));
_this.element = __WEBPACK_IMPORTED_MODULE_2__utils_type__["a" /* isString */](selector) ? document.querySelector(selector) : selector;
// An invalid selector or non-DOM node has been provided.
......@@ -146,7 +146,7 @@ var bulmaTagsInput = function (_EventEmitter) {
*/
_createClass(bulmaTagsInput, [{
_createClass(bulmaTagsinput, [{
key: 'init',
value: function init() {
if (!this.options.disabled) {
......@@ -474,17 +474,17 @@ var bulmaTagsInput = function (_EventEmitter) {
var elements = document.querySelectorAll(selector);
[].forEach.call(elements, function (element) {
setTimeout(function () {
instances.push(new bulmaTagsInput(element, options));
instances.push(new bulmaTagsinput(element, options));
}, 100);
});
return instances;
}
}]);
return bulmaTagsInput;
return bulmaTagsinput;
}(__WEBPACK_IMPORTED_MODULE_0__utils_events__["a" /* default */]);
/* harmony default export */ __webpack_exports__["default"] = (bulmaTagsInput);
/* harmony default export */ __webpack_exports__["default"] = (bulmaTagsinput);
/***/ }),
/* 1 */
......@@ -702,5 +702,5 @@ var isDate = function isDate(unknown) {
};
/***/ })
/******/ ]);
/******/ ])["default"];
});
\ No newline at end of file
This diff is collapsed.
const pkg = require('./package.json');
const gulp = require('gulp');
const webpack = require('webpack');
......@@ -9,7 +10,9 @@ const cleancss = require('gulp-clean-css');
const colors = require('ansi-colors');
const concat = require('gulp-concat');
const del = require('del');
const fs = require('fs');
const log = require('fancy-log');
const nop = require('gulp-nop');
const postcss = require('gulp-postcss');
const sass = require('gulp-sass');
const uglify = require('gulp-uglify');
......@@ -55,26 +58,34 @@ const config = {
// Uses Sass compiler to process styles, adds vendor prefixes, minifies, then
// outputs file to the appropriate location.
gulp.task('build:styles', function() {
return gulp
.src(config.sass.dependencies.concat([config.sass.source + config.sass.input]))
.pipe(concat(config.sass.output.filename + '.sass'))
.pipe(sass({
style: config.sass.output.format,
trace: true,
loadPath: [config.sass.source],
includePaths: ['node_modules/bulma/sass/utilities/']
}))
.pipe(concat(config.sass.output.filename + (config.sass.output.format === 'compressed' ? '.min' : '') + '.css'))
.pipe(postcss([autoprefixer({browsers: pkg.broswers})]))
.pipe(cleancss())
.pipe(gulp.dest(config.sass.destination));
if (fs.existsSync(config.sass.source + config.sass.input)) {
return gulp
.src(config.sass.dependencies.concat([config.sass.source + config.sass.input]))
.pipe(concat(config.sass.output.filename + '.sass'))
.pipe(sass({
style: config.sass.output.format,
trace: true,
loadPath: [config.sass.source],
includePaths: ['node_modules/bulma/sass/utilities/']
}))
.pipe(concat(config.sass.output.filename + (config.sass.output.format === 'compressed' ? '.min' : '') + '.css'))
.pipe(postcss([autoprefixer({browsers: pkg.broswers})]))
.pipe(cleancss())
.pipe(gulp.dest(config.sass.destination));
} else {
return gulp.src('.').pipe(nop());
}
});
// Copy original sass file to dist
gulp.task('build:styles:copy', function() {
return gulp.src(config.sass.source + config.sass.input)
.pipe(concat(config.sass.output.filename + '.sass'))
.pipe(gulp.dest(config.sass.destination));
if (fs.existsSync(config.sass.source + config.sass.input)) {
return gulp.src(config.sass.source + config.sass.input)
.pipe(concat(config.sass.output.filename + '.sass'))
.pipe(gulp.dest(config.sass.destination));
} else {
return gulp.src('.').pipe(nop());
}
});
gulp.task('clean:styles', function() {
......@@ -93,42 +104,43 @@ gulp.task('clean:styles', function() {
// Concatenates and uglifies global JS files and outputs result to the
// appropriate location.
gulp.task('build:scripts', function() {
return gulp
.src(config.javascript.source + config.javascript.input)
.pipe(webpackStream({
output: {
filename: config.javascript.output.filename + '.js',
library: config.javascript.output.name,
libraryTarget: config.javascript.output.format,
// libraryExport: 'default'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
options: {
babelrc: './babelrc'
}
},
],
},
// plugins: [
// new webpack.optimize.ModuleConcatenationPlugin()
// ]
}), webpack)
.pipe(concat(config.javascript.output.filename + '.js'))
.pipe(gulp.dest(config.javascript.destination))
.pipe(concat(config.javascript.output.filename + '.min.js'))
.pipe(uglify().on('error', function(err) {
log(colors.red('[Error]'), err.toString());
}))
.pipe(gulp.dest(config.javascript.destination)
.on('error', function(err) {
if (fs.existsSync(config.javascript.source + config.javascript.input)) {
return gulp
.src(config.javascript.source + config.javascript.input)
.pipe(webpackStream({
output: {
filename: config.javascript.output.filename + '.js',
library: config.javascript.output.name,
libraryTarget: config.javascript.output.format,
libraryExport: 'default'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules)/,
loader: 'babel-loader',
options: {
babelrc: './babelrc'
}
},
],
}
}), webpack)
.pipe(concat(config.javascript.output.filename + '.js'))
.pipe(gulp.dest(config.javascript.destination))
.pipe(concat(config.javascript.output.filename + '.min.js'))
.pipe(uglify().on('error', function(err) {
log(colors.red('[Error]'), err.toString());
})
);
}))
.pipe(gulp.dest(config.javascript.destination)
.on('error', function(err) {
log(colors.red('[Error]'), err.toString());
})
);
} else {
return gulp.src('.').pipe(nop());
}
});
gulp.task('clean:scripts', function() {
......
This diff is collapsed.
{
"name": "bulma-tagsinput",
"version": "1.1.0",
"version": "2.0.0",
"description": "Bulma.io extension to add interaction on input tags",
"main": "dist/bulma-tagsinput.sass",
"main": "./dist/js/bulma-tagsinput.min.js",
"style": "./dist/css/bulma-tagsinput.min.css",
"scripts": {
"build": "gulp",
"commit": "git-cz",
"precommit": "npm test",
"travis-deploy-once": "travis-deploy-once",
"semantic-release": "semantic-release"
"semantic-release": "semantic-release",
"watch:test": "jest test/index.test.js -w",
"test": "jest test/index.test.js"
},
"repository": {
"type": "git",
......@@ -26,42 +31,41 @@
"homepage": "https://github.com/Wikiki/bulma-tagsinput#readme",
"devDependencies": {
"ansi-colors": "^2.0.1",
"babel-core": "latest",
"babel-jest": "latest",
"babel-loader": "latest",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "latest",
"babel-preset-env": "latest",
"bulma": "latest",
"camelcase": "latest",
"commitizen": "latest",
"cz-conventional-changelog": "latest",
"del": "latest",
"autoprefixer": "^8.6.2",
"babel-core": "^6.26.3",
"babel-jest": "^23.0.1",
"babel-loader": "^7.1.4",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"bulma": "^0.7.1",
"camelcase": "^5.0.0",
"commitizen": "^2.10.1",
"cz-conventional-changelog": "^2.1.0",
"del": "^3.0.0",
"fancy-log": "^1.3.2",
"gulp": "^4.0.0",
"gulp-autoprefixer": "latest",
"gulp-clean-css": "latest",
"gulp-concat": "latest",
"gulp-postcss": "latest",
"gulp-sass": "latest",
"gulp-uglify": "latest",
"husky": "latest",
"jest": "latest",
"regenerator-runtime": "latest",
"rollup": "latest",
"semantic-release": "latest",
"travis-deploy-once": "latest",
"webpack": "latest",
"webpack-stream": "latest"
"gulp-autoprefixer": "^5.0.0",
"gulp-clean-css": "^3.9.4",
"gulp-concat": "^2.6.1",
"gulp-nop": "0.0.3",
"gulp-postcss": "^7.0.1",
"gulp-sass": "^4.0.1",
"gulp-uglify": "^3.0.0",
"jest": "^23.1.0",
"regenerator-runtime": "^0.11.1",
"semantic-release": "^15.5.2",
"travis-deploy-once": "^5.0.0",
"webpack": "^4.12.0",
"webpack-stream": "^4.0.3"
},
"czConfig": {
"path": "node_modules/cz-conventional-changelog"
"config": {
"commitizen": {
"path": "node_modules/cz-conventional-changelog"
}
},
"files": [
"dist/css/bulma-tagsinput.sass",
"dist/css/bulma-tagsinput.min.css",
"dist/js/bulma-tagsinput.js",
"dist/js/bulma-tagsinput.min.js",
"dist/**",
"src/**",
"LICENSE",
"README.md"
]
......
......@@ -11,7 +11,7 @@ const KEY_BACKSPACE = 8,
KEY_DELETE = 46,
KEY_COMMA = 188;
export default class bulmaTagsInput extends EventEmitter {
class bulmaTagsinput extends EventEmitter {
constructor(selector, options = {}) {
super();
......@@ -52,7 +52,7 @@ export default class bulmaTagsInput extends EventEmitter {
const elements = document.querySelectorAll(selector);
[].forEach.call(elements, element => {
setTimeout(() => {
instances.push(new bulmaTagsInput(element, options));
instances.push(new bulmaTagsinput(element, options));
}, 100);
});
return instances;
......@@ -354,3 +354,5 @@ export default class bulmaTagsInput extends EventEmitter {
this.element = null;
}
}
export default bulmaTagsinput;
\ No newline at end of file
'use strict';
const bulmaTagsinput = require('../src/js/index').default;
describe('bulmaTagsinput', () => {
test('Should throw exception if instanciate with no/wrong selector', () => {
expect(() => {
new bulmaTagsinput();
}).toThrow('An invalid selector or non-DOM node has been provided.');
});
test('Should return an array', () => {
var instances = bulmaTagsinput.attach('.selector');
expect(Array.isArray(instances)).toBe(true);
});
test('Should return an array of bulmaTagsinput instances', () => {
var instances = bulmaTagsinput.attach();
instances.every(i => expect(i).toBeInstanceOf(bulmaTagsinput));
});
test('Should return an array of bulmaTagsinput instances with options', () => {
var instances = bulmaTagsinput.attach('[type="date"]', {
minDate: '2018-01-01',
maxDate: '2018-12-31',
dateFormat: 'yyyy-mm-dd',
});
instances.every(i => expect(i).toBeInstanceOf(bulmaTagsinput));
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment