mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Updated build pipeline for distribution of compiled assets
This commit is contained in:
parent
b3ad81570e
commit
cf3a77c073
1782
dist/clipboard.js
vendored
1782
dist/clipboard.js
vendored
File diff suppressed because it is too large
Load Diff
2
dist/clipboard.min.js
vendored
2
dist/clipboard.min.js
vendored
File diff suppressed because one or more lines are too long
18
gulpfile.js
Normal file
18
gulpfile.js
Normal file
@ -0,0 +1,18 @@
|
||||
var gulp = require('gulp');
|
||||
var uglify = require('gulp-uglify');
|
||||
var rename = require('gulp-rename');
|
||||
var webpack = require('gulp-webpack');
|
||||
var concat = require('gulp-concat');
|
||||
var browserSync = require('browser-sync');
|
||||
|
||||
gulp.task('build', function () {
|
||||
gulp.src('index.js')
|
||||
.pipe(webpack(require('./webpack.config.js')))
|
||||
.pipe(concat('clipboard.js'))
|
||||
.pipe(gulp.dest('dist'))
|
||||
.pipe(uglify())
|
||||
.pipe(rename({extname: '.min.js' }))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('default', ['build']);
|
11
index.js
Normal file
11
index.js
Normal file
@ -0,0 +1,11 @@
|
||||
import Clipboard from './src/clipboard';
|
||||
import ClipboardAction from './src/clipboard-action';
|
||||
import DelegateEvents from 'delegate-events';
|
||||
import TinyEmitter from 'tiny-emitter';
|
||||
|
||||
// expose bundled libraries
|
||||
Clipboard.ClipboardAction = ClipboardAction;
|
||||
Clipboard.DelegateEvents = DelegateEvents;
|
||||
Clipboard.TinyEmitter = TinyEmitter;
|
||||
|
||||
export default Clipboard;
|
43
package.json
43
package.json
@ -4,30 +4,29 @@
|
||||
"description": "Modern copy to clipboard. No Flash. Just 2kb",
|
||||
"repository": "zenorocha/clipboard.js",
|
||||
"license": "MIT",
|
||||
"main": "dist/clipboard.js",
|
||||
"browser": "src/clipboard.js",
|
||||
"browserify": {
|
||||
"transform": [
|
||||
[
|
||||
"babelify",
|
||||
{
|
||||
"loose": "all"
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"main": "index.js",
|
||||
"browser": "dist/clipboard.js",
|
||||
"keywords": [
|
||||
"clipboard",
|
||||
"copy",
|
||||
"cut"
|
||||
],
|
||||
"dependencies": {
|
||||
"babelify": "^6.3.0",
|
||||
"browserify": "^11.2.0",
|
||||
"delegate-events": "^1.1.1",
|
||||
"tiny-emitter": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "^5.8.23",
|
||||
"babel-loader": "^5.3.2",
|
||||
"babel-runtime": "^5.8.20",
|
||||
"babelify": "^6.3.0",
|
||||
"browser-sync": "^2.8.2",
|
||||
"browserify": "^11.2.0",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-uglify": "^1.3.0",
|
||||
"gulp-webpack": "^1.5.0",
|
||||
"karma": "^0.13.10",
|
||||
"karma-browserify": "^4.4.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
@ -37,15 +36,15 @@
|
||||
"mocha": "^2.3.3",
|
||||
"phantomjs-polyfill": "0.0.1",
|
||||
"uglify": "^0.1.5",
|
||||
"watchify": "^3.4.0"
|
||||
"watchify": "^3.4.0",
|
||||
"webpack": "^1.12.1"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build-debug && npm run build-min",
|
||||
"build-debug": "browserify src/clipboard.js -s Clipboard -o dist/clipboard.js",
|
||||
"build-min": "uglify -s dist/clipboard.js -o dist/clipboard.min.js",
|
||||
"build-watch": "watchify src/clipboard.js -s Clipboard -o dist/clipboard.js -v",
|
||||
"test": "npm run test-browser && npm run test-server",
|
||||
"test-browser": "karma start --single-run",
|
||||
"test-server": "mocha test/module-systems.js"
|
||||
"build-debug": "webpack",
|
||||
"build": "gulp build",
|
||||
"watch": "webpack --watch",
|
||||
"test": "npm run build-debug && npm run test-browser && npm run test-server",
|
||||
"test-browser": "npm run build-debug && karma start --single-run",
|
||||
"test-server": "npm run build-debug && mocha test/module-systems.js"
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import Emitter from 'tiny-emitter';
|
||||
* Base class which takes a selector, delegates a click event to it,
|
||||
* and instantiates a new `ClipboardAction` on each click.
|
||||
*/
|
||||
class Clipboard extends Emitter {
|
||||
export default class Clipboard extends Emitter {
|
||||
/**
|
||||
* @param {String} selector
|
||||
* @param {Object} options
|
||||
@ -119,5 +119,3 @@ function getAttributeValue(suffix, element) {
|
||||
|
||||
return element.getAttribute(attribute);
|
||||
}
|
||||
|
||||
export default Clipboard;
|
||||
|
@ -3,7 +3,7 @@ var browserify = require('browserify');
|
||||
|
||||
describe('CommonJS', function() {
|
||||
it('should import the lib in a commonjs env without babel', function(done) {
|
||||
browserify('./dist/clipboard.js').bundle(function(err) {
|
||||
browserify('./index.js').bundle(function(err) {
|
||||
assert.equal(err, null);
|
||||
done();
|
||||
});
|
||||
|
18
webpack.config.js
Normal file
18
webpack.config.js
Normal file
@ -0,0 +1,18 @@
|
||||
var path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: path.resolve(path.join(__dirname, '.', 'index.js')),
|
||||
output: {
|
||||
path: path.resolve(path.join(__dirname, '.', 'dist')),
|
||||
library: 'Clipboard',
|
||||
libraryTarget: 'umd',
|
||||
filename: 'clipboard.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [{test: /\.js?$/, exclude: /(node_modules|bower_components)/, loader: 'babel?optional[]=runtime&stage=0'}]
|
||||
},
|
||||
externals: [
|
||||
// delegate-events and tiny-emitter could go here if you want them externally provided
|
||||
// {library: {root: 'LibraryWindowSymbol', amd: 'library', commonjs: 'library', commonjs2: 'library'}},
|
||||
]
|
||||
};
|
Loading…
Reference in New Issue
Block a user