added es6 distribution & gulp task for es6 distribution
This commit is contained in:
parent
eff6fb1cc5
commit
f6c5051472
@ -131,6 +131,7 @@ This is a complete rewrite of the 0.5 version of Yjs. Since Yjs 1.0 it is possib
|
|||||||
* The Connector definition slightly changed (I'll update the wiki)
|
* The Connector definition slightly changed (I'll update the wiki)
|
||||||
* The Type definitions completely changed, so you have to rewrite them (I'll rewrite the article in the wiki)
|
* The Type definitions completely changed, so you have to rewrite them (I'll rewrite the article in the wiki)
|
||||||
* Support for several packaging systems
|
* Support for several packaging systems
|
||||||
|
* Flowtype
|
||||||
|
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
|
0
declarations/Type.js
Normal file
0
declarations/Type.js
Normal file
2
dist
2
dist
@ -1 +1 @@
|
|||||||
Subproject commit 14a3fbc638737b17478a426b542a3984cba22bc3
|
Subproject commit b471c91d1d70b1d9e31ba81664d8fab4aff414a2
|
@ -1,6 +1,9 @@
|
|||||||
|
|
||||||
var $ = require('gulp-load-plugins')()
|
var $ = require('gulp-load-plugins')()
|
||||||
var minimist = require('minimist')
|
var minimist = require('minimist')
|
||||||
|
var browserify = require('browserify')
|
||||||
|
var source = require('vinyl-source-stream')
|
||||||
|
var buffer = require('vinyl-buffer')
|
||||||
|
|
||||||
module.exports = function (gulp, helperOptions) {
|
module.exports = function (gulp, helperOptions) {
|
||||||
var runSequence = require('run-sequence').use(gulp)
|
var runSequence = require('run-sequence').use(gulp)
|
||||||
@ -31,21 +34,10 @@ module.exports = function (gulp, helperOptions) {
|
|||||||
files.dist = ['node_modules/regenerator/runtime.js', files.dist]
|
files.dist = ['node_modules/regenerator/runtime.js', files.dist]
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('dist', function () {
|
gulp.task('dist:es5', function () {
|
||||||
var browserify = require('browserify')
|
var babelOptions = {
|
||||||
var source = require('vinyl-source-stream')
|
presets: ['es2015']
|
||||||
var buffer = require('vinyl-buffer')
|
|
||||||
|
|
||||||
var babelOptions
|
|
||||||
if (options.es6 || options.debug) {
|
|
||||||
babelOptions = {}
|
|
||||||
} else {
|
|
||||||
babelOptions = {
|
|
||||||
presets: ['es2015']
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(JSON.stringify(files.dist))
|
|
||||||
return (browserify({
|
return (browserify({
|
||||||
entries: files.dist,
|
entries: files.dist,
|
||||||
debug: true
|
debug: true
|
||||||
@ -54,11 +46,30 @@ module.exports = function (gulp, helperOptions) {
|
|||||||
.pipe(source(options.targetName))
|
.pipe(source(options.targetName))
|
||||||
.pipe(buffer())
|
.pipe(buffer())
|
||||||
.pipe($.sourcemaps.init({loadMaps: true}))
|
.pipe($.sourcemaps.init({loadMaps: true}))
|
||||||
.pipe($.if(!options.debug && !options.es6, $.uglify()))
|
.pipe($.uglify())
|
||||||
.pipe($.sourcemaps.write('.'))
|
.pipe($.sourcemaps.write('.'))
|
||||||
.pipe(gulp.dest('./dist/')))
|
.pipe(gulp.dest('./dist/')))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
gulp.task('dist:es6', function () {
|
||||||
|
return (browserify({
|
||||||
|
entries: files.dist,
|
||||||
|
debug: true
|
||||||
|
}).bundle()
|
||||||
|
.pipe(source(options.targetName))
|
||||||
|
.pipe(buffer())
|
||||||
|
.pipe($.sourcemaps.init({loadMaps: true}))
|
||||||
|
// .pipe($.uglify()) -- generators not yet supported see #448
|
||||||
|
.pipe($.rename({
|
||||||
|
extname: '.es6'
|
||||||
|
}))
|
||||||
|
.pipe($.sourcemaps.write('.'))
|
||||||
|
|
||||||
|
.pipe(gulp.dest('./dist/')))
|
||||||
|
})
|
||||||
|
|
||||||
|
gulp.task('dist', ['dist:es6', 'dist:es5'])
|
||||||
|
|
||||||
gulp.task('watch:dist', function (cb) {
|
gulp.task('watch:dist', function (cb) {
|
||||||
options.debug = true
|
options.debug = true
|
||||||
gulp.src(['./README.md'])
|
gulp.src(['./README.md'])
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "0.6.41",
|
"version": "0.6.42",
|
||||||
"description": "A framework for real-time p2p shared editing on arbitrary complex data types",
|
"description": "A framework for real-time p2p shared editing on arbitrary complex data types",
|
||||||
"main": "y.js",
|
"main": "y.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -46,6 +46,7 @@
|
|||||||
"babel-preset-es2015": "^6.1.18",
|
"babel-preset-es2015": "^6.1.18",
|
||||||
"babelify": "^7.2.0",
|
"babelify": "^7.2.0",
|
||||||
"browserify": "^12.0.1",
|
"browserify": "^12.0.1",
|
||||||
|
"eslint": "^1.10.2",
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.0",
|
||||||
"gulp-bump": "^1.0.0",
|
"gulp-bump": "^1.0.0",
|
||||||
"gulp-concat": "^2.6.0",
|
"gulp-concat": "^2.6.0",
|
||||||
@ -61,11 +62,12 @@
|
|||||||
"gulp-shell": "^0.5.1",
|
"gulp-shell": "^0.5.1",
|
||||||
"gulp-sourcemaps": "^1.5.2",
|
"gulp-sourcemaps": "^1.5.2",
|
||||||
"gulp-tag-version": "^1.3.0",
|
"gulp-tag-version": "^1.3.0",
|
||||||
"gulp-uglify": "^1.4.2",
|
"gulp-uglify": "^1.5.1",
|
||||||
"gulp-util": "^3.0.6",
|
"gulp-util": "^3.0.6",
|
||||||
"gulp-watch": "^4.3.5",
|
"gulp-watch": "^4.3.5",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"pre-commit": "^1.1.1",
|
"pre-commit": "^1.1.1",
|
||||||
|
"regenerator": "^0.8.42",
|
||||||
"run-sequence": "^1.1.4",
|
"run-sequence": "^1.1.4",
|
||||||
"standard": "^5.2.2",
|
"standard": "^5.2.2",
|
||||||
"vinyl-buffer": "^1.0.0",
|
"vinyl-buffer": "^1.0.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user