diff --git a/.bowerrc b/.bowerrc deleted file mode 100644 index 7bbfd3739f6d2ad765168d7b230b2b9975574f90..0000000000000000000000000000000000000000 --- a/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "../" -} diff --git a/.gitignore b/.gitignore index 863bd2916b8aaa3799a8564cc100a603e8f1331f..383bd88bb1d6e1edf874d8490c2745e64bf00dc9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ build_test .validate.json /y.js /y.js.map +/y-* diff --git a/Examples/OfflineEditing/index.html b/Examples/OfflineEditing/index.html deleted file mode 100644 index 9bfd45256bac5e110bcfc2ea42ee2a0326b60cf4..0000000000000000000000000000000000000000 --- a/Examples/OfflineEditing/index.html +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<body> - <button id="button">Disconnect</button> - <h1 id="contenteditable" contentEditable></h1> - <textarea style="width:80%;" rows=40 id="textfield"></textarea> - - <script src="../../node_modules/simplewebrtc/simplewebrtc.bundle.js"></script> - <script src="../../y.js"></script> - <script src="./index.js"></script> -</body> -</html> diff --git a/Examples/OfflineEditing/index.js b/Examples/OfflineEditing/index.js deleted file mode 100644 index 78a347b7d4a3df03bad3e71667949233108bd7af..0000000000000000000000000000000000000000 --- a/Examples/OfflineEditing/index.js +++ /dev/null @@ -1,50 +0,0 @@ -/* global Y */ - -// create a shared object. This function call will return a promise! -Y({ - db: { - name: 'IndexedDB', - namespace: 'offlineEditingDemo' - }, - connector: { - name: 'WebRTC', - room: 'offlineEditingDemo', - debug: true - } -}).then(function (yconfig) { - // yconfig holds all the information about the shared object - window.yconfig = yconfig - // yconfig.root holds the shared element - window.y = yconfig.root - - // now we bind the textarea and the contenteditable h1 element - // to a shared element - var textarea = document.getElementById('textfield') - var contenteditable = document.getElementById('contenteditable') - yconfig.root.observePath(['text'], function (text) { - // every time the 'text' property of the yconfig.root changes, - // this function is called. Then we bind it to the html elements - if (text != null) { - // when the text property is deleted, text may be undefined! - // This is why we have to check if text exists.. - text.bind(textarea) - text.bind(contenteditable) - } - }) - // create a shared TextBind - var textpromise = yconfig.root.get('text') - if (textpromise == null) { - yconfig.root.set('text', Y.TextBind) - } - // We also provide a button for disconnecting/reconnecting the shared element - var button = document.querySelector('#button') - button.onclick = function () { - if (button.innerText === 'Disconnect') { - yconfig.disconnect() - button.innerText = 'Reconnect' - } else { - yconfig.reconnect() - button.innerText = 'Disconnect' - } - } -}) diff --git a/Examples/TextBind/index.html b/Examples/TextBind/index.html deleted file mode 100644 index 9bfd45256bac5e110bcfc2ea42ee2a0326b60cf4..0000000000000000000000000000000000000000 --- a/Examples/TextBind/index.html +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<html> -<body> - <button id="button">Disconnect</button> - <h1 id="contenteditable" contentEditable></h1> - <textarea style="width:80%;" rows=40 id="textfield"></textarea> - - <script src="../../node_modules/simplewebrtc/simplewebrtc.bundle.js"></script> - <script src="../../y.js"></script> - <script src="./index.js"></script> -</body> -</html> diff --git a/Examples/TextBind/index.js b/Examples/TextBind/index.js deleted file mode 100644 index d489a02ac95afd3793eb02d83c3e48947388bd25..0000000000000000000000000000000000000000 --- a/Examples/TextBind/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* global Y */ - -// create a shared object. This function call will return a promise! -Y({ - db: { - name: 'Memory' - }, - connector: { - name: 'WebRTC', - room: 'TextBindDemo', - debug: true - } -}).then(function (yconfig) { - // yconfig holds all the information about the shared object - window.yconfig = yconfig - // yconfig.root holds the shared element - window.y = yconfig.root - - // now we bind the textarea and the contenteditable h1 element - // to a shared element - var textarea = document.getElementById('textfield') - var contenteditable = document.getElementById('contenteditable') - yconfig.root.observePath(['text'], function (text) { - // every time the 'text' property of the yconfig.root changes, - // this function is called. Then we bind it to the html elements - if (text != null) { - // when the text property is deleted, text may be undefined! - // This is why we have to check if text exists.. - text.bind(textarea) - text.bind(contenteditable) - } - }) - // create a shared TextBind - yconfig.root.set('text', Y.TextBind) - - // We also provide a button for disconnecting/reconnecting the shared element - var button = document.querySelector('#button') - button.onclick = function () { - if (button.innerText === 'Disconnect') { - yconfig.disconnect() - button.innerText = 'Reconnect' - } else { - yconfig.reconnect() - button.innerText = 'Disconnect' - } - } -}) diff --git a/dist b/dist index 33b7588497538d07a514b3be4cfe53e26fc366a4..e2e89e198f47689fe6df908c0ea1cef6d800be0d 160000 --- a/dist +++ b/dist @@ -1 +1 @@ -Subproject commit 33b7588497538d07a514b3be4cfe53e26fc366a4 +Subproject commit e2e89e198f47689fe6df908c0ea1cef6d800be0d diff --git a/gulpfile.js b/gulpfile.js index 2b6feccb2ee28f2ac8bfdaf9bceff8d1327c6131..ea244435e05b92e358b5f2275069e7cc4a89f6b4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -44,15 +44,8 @@ */ var gulp = require('gulp') -var sourcemaps = require('gulp-sourcemaps') -var babel = require('gulp-babel') -var uglify = require('gulp-uglify') var minimist = require('minimist') -var jasmine = require('gulp-jasmine') -var jasmineBrowser = require('gulp-jasmine-browser') var concat = require('gulp-concat') -var watch = require('gulp-watch') -var shell = require('gulp-shell') var $ = require('gulp-load-plugins')() var options = minimist(process.argv.slice(2), { @@ -102,16 +95,16 @@ if (options.regenerator) { gulp.task('deploy:build', function () { return gulp.src(files.src) - .pipe(sourcemaps.init()) + .pipe($.sourcemaps.init()) .pipe(concat('y.js')) - .pipe(babel({ + .pipe($.babel({ loose: 'all', modules: 'ignore', experimental: true })) - .pipe(uglify()) - .pipe(sourcemaps.write('.')) - .pipe(gulp.dest('.')) + .pipe($.uglify()) + .pipe($.sourcemaps.write('./dist/')) + .pipe(gulp.dest('./dist/')) }) gulp.task('deploy:updateSubmodule', function () { @@ -119,19 +112,19 @@ gulp.task('deploy:updateSubmodule', function () { }) gulp.task('deploy:copy', function () { - return gulp.src(['./y.js', './y.js.map', './README.md', 'package.json', 'LICENSE']) - .pipe(gulp.dest('./dist/')) + return gulp.src(['README.md'], {base: '.'}) + .pipe(gulp.dest('dist/')) }) gulp.task('deploy:bump', function () { - return gulp.src('./package.json') + return gulp.src(['./package.json', './dist/package.json'], {base: '.'}) .pipe($.bump({type: 'patch'})) .pipe(gulp.dest('./')) }) gulp.task('deploy', ['test', 'deploy:updateSubmodule', 'deploy:bump', 'deploy:build', 'deploy:copy'], function () { return gulp.src('./package.json', {read: false}) - .pipe(shell([ + .pipe($.shell([ 'standard', 'echo "Deploying version <%= getVersion(file.path) %>"', 'git pull', @@ -161,16 +154,16 @@ gulp.task('build:test', function () { babelOptions.blacklist = 'regenerator' } gulp.src(files.src) - .pipe(sourcemaps.init()) + .pipe($.sourcemaps.init()) .pipe(concat('y.js')) - .pipe(babel(babelOptions)) - .pipe(sourcemaps.write()) + .pipe($.babel(babelOptions)) + .pipe($.sourcemaps.write()) .pipe(gulp.dest('.')) return gulp.src('src/**/*.js') - .pipe(sourcemaps.init()) - .pipe(babel(babelOptions)) - .pipe(sourcemaps.write()) + .pipe($.sourcemaps.init()) + .pipe($.babel(babelOptions)) + .pipe($.sourcemaps.write()) .pipe(gulp.dest('build')) }) @@ -182,9 +175,9 @@ gulp.task('dev:browser', ['build:test'], function () { gulp.watch('src/**/*.js', ['build:test']) gulp.src(files.test) - .pipe(watch(['build/**/*.js'])) - .pipe(jasmineBrowser.specRunner()) - .pipe(jasmineBrowser.server({port: options.testport})) + .pipe($.watch(['build/**/*.js'])) + .pipe($.jasmineBrowser.specRunner()) + .pipe($.jasmineBrowser.server({port: options.testport})) }) gulp.task('dev', ['build:test'], function () { @@ -192,13 +185,20 @@ gulp.task('dev', ['build:test'], function () { gulp.start('dev:node') }) +gulp.task('copy:dist', ['deploy:build']) + +gulp.task('dev:Examples', ['copy:dist'], function () { + gulp.watch('src/**/*.js', ['copy:dist']) + return $.serve('dist/Examples')() +}) + gulp.task('test', ['build:test'], function () { var testfiles = files.test if (typeof Promise === 'undefined') { testfiles.concat(['src/polyfills.js']) } return gulp.src(testfiles) - .pipe(jasmine({ + .pipe($.jasmine({ verbose: true, includeStuckTrace: true })) diff --git a/package.json b/package.json index eb34c5fb0b10dff947400fc4125870da6db48631..904ea969fd928d905304dbde6446141767b73d79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yjs", - "version": "0.6.23", + "version": "0.6.25", "description": "A framework for real-time p2p shared editing on arbitrary complex data types", "main": "y.js", "scripts": { @@ -52,6 +52,7 @@ "gulp-jasmine": "^2.0.1", "gulp-jasmine-browser": "^0.2.3", "gulp-load-plugins": "^1.0.0", + "gulp-serve": "^1.2.0", "gulp-shell": "^0.5.1", "gulp-sourcemaps": "^1.5.2", "gulp-tag-version": "^1.3.0",