Added Gulp package files
authorThierry Florac <tflorac@ulthar.net>
Wed, 17 Oct 2018 11:30:37 +0200
changeset 434 5635abeac42d
parent 433 f8b091800256
child 435 bcd694fda81d
Added Gulp package files
gulpfile.js
package.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gulpfile.js	Wed Oct 17 11:30:37 2018 +0200
@@ -0,0 +1,48 @@
+var gulp = require('gulp'),
+	concat = require('gulp-concat');
+
+var package = require("./package.json"),
+	scripts = package.scripts,
+	sources = scripts.sources;
+
+
+/** Fix pipe function */
+function fixPipe(stream) {
+	var origPipe = stream.pipe;
+	stream.pipe = function (dest) {
+		arguments[0] = dest.on('error', function (error) {
+			var nextStreams = dest._nextStreams;
+			if (nextStreams) {
+				nextStreams.forEach(function (nextStream) {
+					nextStream.emit('error', error);
+				});
+			} else if (dest.listeners('error').length === 1) {
+				throw error;
+			}
+		});
+		var nextStream = fixPipe(origPipe.apply(this, arguments));
+		(this._nextStreams || (this._nextStreams = [])).push(nextStream);
+		return nextStream;
+	};
+	return stream;
+}
+
+var origSrc = gulp.src;
+
+gulp.src = function() {
+	return fixPipe(origSrc.apply(this, arguments));
+};
+
+
+// Gulp tasks
+gulp.task('scripts', function() {
+	return gulp.src(sources, {cwd: scripts.base})
+		.pipe(concat(scripts.target.replace(/{version}/, package.version)))
+		.pipe(gulp.dest(scripts.base));
+});
+
+gulp.task('watch', function() {
+	gulp.watch(sources, {cwd: scripts.base}, ['scripts']);
+});
+
+gulp.task('default', ['scripts', 'watch']);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package.json	Wed Oct 17 11:30:37 2018 +0200
@@ -0,0 +1,35 @@
+{
+	"name": "myams",
+	"version": "0.1.21",
+	"private": true,
+	"scripts": {
+		"base": "./src/pyams_skin/resources/js/",
+		"sources": [
+			"myams-core.js",
+			"myams-utf8.js",
+			"myams-menus.js",
+			"myams-event.js",
+			"myams-browser.js",
+			"myams-error.js",
+			"myams-ajax.js",
+			"myams-jsonrpc.js",
+			"myams-xmlrpc.js",
+			"myams-form.js",
+			"myams-dialog.js",
+			"myams-helpers.js",
+			"myams-plugins.js",
+			"myams-callbacks.js",
+			"myams-events.js",
+			"myams-container.js",
+			"myams-tree.js",
+			"myams-skin.js",
+			"myams-stats.js",
+			"myams-init.js"
+		],
+		"target": "myams.js"
+	},
+	"devDependencies": {
+		"gulp": "^3.9.1",
+		"gulp-concat": "^2.6.1"
+	}
+}