Skip to content

Commit

Permalink
Merge pull request #10 from mendix/bugfix/imageNode-undefined-mx7
Browse files Browse the repository at this point in the history
Bugfix/image node undefined mx7
  • Loading branch information
Osama Mohammad Najjar authored Feb 4, 2019
2 parents ad67fbf + d747461 commit 8239611
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 128 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ test/.project
.idea/

dist/
build/

node_modules/
.editorconfig
Expand Down
150 changes: 96 additions & 54 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,79 +10,121 @@ var MODELER_ARGS = "/file:{path}";
* Do not edit anything below, unless you know what you are doing
********************************************************************************/
var gulp = require("gulp"),
zip = require("gulp-zip"),
del = require("del"),
newer = require("gulp-newer"),
gutil = require("gulp-util"),
gulpif = require("gulp-if"),
jsonTransform = require("gulp-json-transform"),
intercept = require("gulp-intercept"),
argv = require("yargs").argv,
widgetBuilderHelper = require("widgetbuilder-gulp-helper"),
jsValidate = require("gulp-jsvalidate");
zip = require("gulp-zip"),
del = require("del"),
newer = require("gulp-newer"),
gutil = require("gulp-util"),
gulpif = require("gulp-if"),
jsonTransform = require("gulp-json-transform"),
intercept = require("gulp-intercept"),
argv = require("yargs").argv,
widgetBuilderHelper = require("widgetbuilder-gulp-helper"),
jsValidate = require("gulp-jsvalidate"),
minify = require("gulp-minify"),
fs = require("fs-extra"),
del = require("del");

var pkg = require("./package.json"),
paths = widgetBuilderHelper.generatePaths(pkg),
xmlversion = widgetBuilderHelper.xmlversion;
paths = widgetBuilderHelper.generatePaths(pkg),
xmlversion = widgetBuilderHelper.xmlversion;

gulp.task("default", function() {
gulp.watch("./src/**/*", ["compress"]);
gulp.watch("./src/**/*.js", ["copy:js"]);
gulp.watch("./src/**/*", [ "compress" ]);
gulp.watch("./src/**/*.js", [ "copy:js" ]);
});

gulp.task("clean", function () {
return del([
paths.WIDGET_TEST_DEST,
paths.WIDGET_DIST_DEST
], { force: true });
gulp.task("clean", function() {
return del([ paths.WIDGET_TEST_DEST, paths.WIDGET_DIST_DEST ], {
force : true,
});
});

gulp.task("compress", ["clean"], function () {
return gulp.src("src/**/*")
.pipe(zip(pkg.name + ".mpk"))
.pipe(gulp.dest(paths.TEST_WIDGETS_FOLDER))
.pipe(gulp.dest("dist"));
gulp.task("compress", [ "clean" ], function() {
return gulp
.src("src/**/*")
.pipe(zip(pkg.name + ".mpk"))
.pipe(gulp.dest(paths.TEST_WIDGETS_FOLDER))
.pipe(gulp.dest("dist"));
});

gulp.task("copy:js", function () {
return gulp.src(["./src/**/*.js"])
.pipe(jsValidate())
.pipe(newer(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER))
.pipe(gulp.dest(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER));
gulp.task("copy:js", function() {
return gulp
.src([ "./src/**/*.js" ])
.pipe(jsValidate())
.pipe(newer(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER))
.pipe(gulp.dest(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER));
});

gulp.task("version:xml", function () {
return gulp.src(paths.PACKAGE_XML)
.pipe(xmlversion(argv.n))
.pipe(gulp.dest("./src/"));
gulp.task("version:xml", function() {
return gulp.src(paths.PACKAGE_XML).pipe(xmlversion(argv.n)).pipe(gulp.dest("./src/"));
});

gulp.task("version:json", function () {
return gulp.src("./package.json")
.pipe(gulpif(typeof argv.n !== "undefined", jsonTransform(function(data) {
data.version = argv.n;
return data;
}, 2)))
.pipe(gulp.dest("./"));
gulp.task("version:json", function() {
return gulp
.src("./package.json")
.pipe(
gulpif(
typeof argv.n !== "undefined",
jsonTransform(function(data) {
data.version = argv.n;
return data;
}, 2),
),
)
.pipe(gulp.dest("./"));
});

gulp.task("icon", function (cb) {
var icon = (typeof argv.file !== "undefined") ? argv.file : "./icon.png";
console.log("\nUsing this file to create a base64 string: " + gutil.colors.cyan(icon));
gulp.src(icon)
.pipe(intercept(function (file) {
console.log("\nCopy the following to your " + pkg.name + ".xml (after description):\n\n" + gutil.colors.cyan("<icon>") + file.contents.toString("base64") + gutil.colors.cyan("<\/icon>") + "\n");
cb();
}));
gulp.task("icon", function(cb) {
var icon = typeof argv.file !== "undefined" ? argv.file : "./icon.png";
console.log("\nUsing this file to create a base64 string: " + gutil.colors.cyan(icon));
gulp.src(icon).pipe(
intercept(function(file) {
console.log(
"\nCopy the following to your " +
pkg.name +
".xml (after description):\n\n" +
gutil.colors.cyan("<icon>") +
file.contents.toString("base64") +
gutil.colors.cyan("</icon>") +
"\n",
);
cb();
}),
);
});

gulp.task("folders", function () {
paths.showPaths(); return;
gulp.task("folders", function() {
paths.showPaths();
return;
});

gulp.task("modeler", function (cb) {
widgetBuilderHelper.runmodeler(MODELER_PATH, MODELER_ARGS, paths.TEST_PATH, cb);
gulp.task("modeler", function(cb) {
widgetBuilderHelper.runmodeler(MODELER_PATH, MODELER_ARGS, paths.TEST_PATH, cb);
});

gulp.task("build", ["compress"]);
gulp.task("version", ["version:xml", "version:json"]);
gulp.task("build:prod", function() {
try {
del.sync("build/**", {force: true}); // cleanup buid dir
fs.copySync("src", "build"); // copy everthing
gulp
.src([ "src/**/*.js" ]) // overwrite .js files with the minified ones.
.pipe(
minify({
ext : {
min : ".js",
},
noSource : true,
mangle : true,
}),
)
.pipe(gulp.dest("build"));
return gulp
.src("build/**/*")
.pipe(zip(pkg.name + ".mpk"))
.pipe(gulp.dest(paths.TEST_WIDGETS_FOLDER))
.pipe(gulp.dest("build"))
.pipe(gulp.dest("dist"));
} catch (e) {
console.error(e);
}
});
Binary file removed dist/DynamicImageViewer-5.7.0.mpk
Binary file not shown.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"name": "DynamicImage",
"version": "5.0.0",
"version": "5.0.1",
"description": "",
"license": "",
"author": "",
"private": true,
"dependencies": {},
"devDependencies": {
"del": "^2.2.2",
"del": "^3.0.0",
"fs-extra": "^7.0.1",
"gulp": "^3.9.1",
"gulp-if": "^2.0.1",
"gulp-intercept": "^0.1.0",
"gulp-json-transform": "^0.4.2",
"gulp-jsvalidate": "^3.0.0",
"gulp-minify": "^0.0.15",
"gulp-newer": "^1.3.0",
"gulp-util": "^3.0.7",
"gulp-zip": "^3.2.0",
"gulp-jsvalidate": "^3.0.0",
"widgetbuilder-gulp-helper": "https://github.com/JelteMX/widgetbuilder-gulp-helper/archive/1.0.1.tar.gz",
"yargs": "^6.0.0"
},
Expand All @@ -29,9 +31,10 @@
},
"scripts": {
"build": "node ./node_modules/gulp/bin/gulp build",
"build:prod": "node ./node_modules/gulp/bin/gulp build:prod",
"version": "node ./node_modules/gulp/bin/gulp version",
"icon": "node ./node_modules/gulp/bin/gulp icon",
"folders": "node ./node_modules/gulp/bin/gulp folders",
"modeler": "node ./node_modules/gulp/bin/gulp modeler"
}
}
}
Loading

0 comments on commit 8239611

Please sign in to comment.