Skip to content

Commit 8991820

Browse files
committed
Update tooling to generator-mendix 2.2.5
1 parent f822cc2 commit 8991820

File tree

5 files changed

+2111
-1671
lines changed

5 files changed

+2111
-1671
lines changed

.yo-rc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Gulpfile.js

Lines changed: 90 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated on 2017-01-02 using generator-mendix 2.0.4 :: git+https://github.com/mendix/generator-mendix.git
1+
// Generated on 2020-08-05 using generator-mendix 2.2.5 :: git+https://github.com/mendix/generator-mendix.git
22
/*jshint -W069,-W097*/
33
"use strict";
44

@@ -13,7 +13,9 @@ var gulp = require("gulp"),
1313
zip = require("gulp-zip"),
1414
del = require("del"),
1515
newer = require("gulp-newer"),
16-
gutil = require("gulp-util"),
16+
log = require('fancy-log'),
17+
colors = require('ansi-colors'),
18+
plumber = require("gulp-plumber"),
1719
gulpif = require("gulp-if"),
1820
jsonTransform = require("gulp-json-transform"),
1921
intercept = require("gulp-intercept"),
@@ -25,64 +27,89 @@ var pkg = require("./package.json"),
2527
paths = widgetBuilderHelper.generatePaths(pkg),
2628
xmlversion = widgetBuilderHelper.xmlversion;
2729

28-
gulp.task("default", function() {
29-
gulp.watch("./src/**/*", ["compress"]);
30-
gulp.watch("./src/**/*.js", ["copy:js"]);
31-
});
32-
33-
gulp.task("clean", function () {
34-
return del([
35-
paths.WIDGET_TEST_DEST,
36-
paths.WIDGET_DIST_DEST
37-
], { force: true });
38-
});
39-
40-
gulp.task("compress", ["clean"], function () {
41-
return gulp.src("src/**/*")
42-
.pipe(zip(pkg.name + ".mpk"))
43-
.pipe(gulp.dest(paths.TEST_WIDGETS_FOLDER))
44-
.pipe(gulp.dest("dist"));
45-
});
46-
47-
gulp.task("copy:js", function () {
48-
return gulp.src(["./src/**/*.js"])
49-
.pipe(jsValidate())
50-
.pipe(newer(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER))
51-
.pipe(gulp.dest(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER));
52-
});
53-
54-
gulp.task("version:xml", function () {
55-
return gulp.src(paths.PACKAGE_XML)
56-
.pipe(xmlversion(argv.n))
57-
.pipe(gulp.dest("./src/"));
58-
});
59-
60-
gulp.task("version:json", function () {
61-
return gulp.src("./package.json")
62-
.pipe(gulpif(typeof argv.n !== "undefined", jsonTransform(function(data) {
63-
data.version = argv.n;
64-
return data;
65-
}, 2)))
66-
.pipe(gulp.dest("./"));
67-
});
68-
69-
gulp.task("icon", function (cb) {
70-
var icon = (typeof argv.file !== "undefined") ? argv.file : "./icon.png";
71-
console.log("\nUsing this file to create a base64 string: " + gutil.colors.cyan(icon));
72-
gulp.src(icon)
73-
.pipe(intercept(function (file) {
74-
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");
75-
cb();
76-
}));
77-
});
78-
79-
gulp.task("folders", function () {
80-
paths.showPaths(); return;
81-
});
82-
83-
gulp.task("modeler", function (cb) {
84-
widgetBuilderHelper.runmodeler(MODELER_PATH, MODELER_ARGS, paths.TEST_PATH, cb);
85-
});
86-
87-
gulp.task("build", ["compress"]);
88-
gulp.task("version", ["version:xml", "version:json"]);
30+
gulp.task("clean", function () {
31+
return del([
32+
paths.WIDGET_TEST_DEST,
33+
paths.WIDGET_DIST_DEST
34+
], { force: true });
35+
});
36+
37+
gulp.task("compress", gulp.series(["clean"], function () {
38+
return gulp.src("src/**/*")
39+
.pipe(zip(pkg.name + ".mpk"))
40+
.pipe(gulp.dest(paths.TEST_WIDGETS_FOLDER))
41+
.pipe(gulp.dest("dist"));
42+
}));
43+
44+
gulp.task("build", gulp.series(["compress"]));
45+
46+
gulp.task("default", gulp.series(['build'], function() {
47+
gulp.watch("./src/**/*", ["compress"]);
48+
gulp.watch("./src/**/*.js", ["copy:js"]);
49+
gulp.watch("./src/**/*.html", ["copy:html"])
50+
}));
51+
52+
gulp.task("compress", gulp.series(["clean"], function () {
53+
return gulp.src("src/**/*")
54+
.pipe(zip(pkg.name + ".mpk"))
55+
.pipe(gulp.dest(paths.TEST_WIDGETS_FOLDER))
56+
.pipe(gulp.dest("dist"));
57+
}));
58+
59+
gulp.task("copy:js", function () {
60+
return gulp.src(["./src/**/*.js"])
61+
.pipe(plumber(function (error) {
62+
var msg = colors.red("Error");
63+
if (error.fileName) {
64+
msg += colors.red(" in ") + colors.cyan(error.fileName);
65+
}
66+
msg += " : " + colors.cyan(error.message);
67+
log(msg);
68+
this.emit("end");
69+
}))
70+
.pipe(jsValidate())
71+
.pipe(newer(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER))
72+
.pipe(gulp.dest(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER));
73+
});
74+
75+
gulp.task("copy:html", function () {
76+
return gulp.src(["./src/**/*.html"])
77+
.pipe(newer(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER))
78+
.pipe(gulp.dest(paths.TEST_WIDGETS_DEPLOYMENT_FOLDER));
79+
});
80+
81+
gulp.task("version:xml", function () {
82+
return gulp.src(paths.PACKAGE_XML)
83+
.pipe(xmlversion(argv.n))
84+
.pipe(gulp.dest("./src/"));
85+
});
86+
87+
gulp.task("version:json", function () {
88+
return gulp.src("./package.json")
89+
.pipe(gulpif(typeof argv.n !== "undefined", jsonTransform(function(data) {
90+
data.version = argv.n;
91+
return data;
92+
}, 2)))
93+
.pipe(gulp.dest("./"));
94+
});
95+
96+
gulp.task("icon", function (cb) {
97+
var icon = (typeof argv.file !== "undefined") ? argv.file : "./icon.png";
98+
console.log("\nUsing this file to create a base64 string: " + colors.cyan(icon));
99+
gulp.src(icon)
100+
.pipe(intercept(function (file) {
101+
console.log("\nCopy the following to your " + pkg.name + ".xml (after description):\n\n" + colors.cyan("<icon>") + file.contents.toString("base64") + colors.cyan("<\/icon>") + "\n");
102+
cb();
103+
}));
104+
});
105+
106+
gulp.task("folders", function () {
107+
paths.showPaths(); return;
108+
});
109+
110+
gulp.task("modeler", function (cb) {
111+
widgetBuilderHelper.runmodeler(MODELER_PATH, MODELER_ARGS, paths.TEST_PATH, cb);
112+
});
113+
114+
gulp.task("version", gulp.parallel(["version:xml", "version:json"]));
115+

0 commit comments

Comments
 (0)