mendixlabs / generator-mendix Goto Github PK
View Code? Open in Web Editor NEWYeoman generator for Mendix widgets
License: MIT License
Yeoman generator for Mendix widgets
License: MIT License
I'm using Mendix 8.6 version and node js 12x LTS and while running the command gulp in the terminal it shows error
PS C:\Users\Gayatree\test-widget\EnterToAction> gulp [11:59:53] Using gulpfile ~\test-widget\EnterToAction\gulpfile.js [11:59:53] Starting 'default'... [11:59:53] Starting 'build'... [11:59:53] Starting 'compress'... [11:59:53] Starting 'clean'... [11:59:53] Finished 'clean' after 16 ms [11:59:53] Starting '<anonymous>'... [11:59:53] Finished '<anonymous>' after 66 ms [11:59:53] Finished 'compress' after 101 ms [11:59:53] Finished 'build' after 120 ms [11:59:53] Starting '<anonymous>'... [11:59:53] '<anonymous>' errored after 3.3 ms [11:59:53] Error: watching ./src/**/*: watch task has to be a function (optionally generated by using gulp.parallel or gulp.series) at Gulp.watch (C:\Users\Gayatree\test-widget\EnterToAction\node_modules\gulp\index.js:31:11) at C:\Users\Gayatree\test-widget\EnterToAction\gulpfile.js:47:14 at bound (domain.js:419:14) at runBound (domain.js:432:12) at asyncRunner (C:\Users\Gayatree\test-widget\EnterToAction\node_modules\async-done\index.js:55:18) at processTicksAndRejections (internal/process/task_queues.js:76:11) [11:59:53] 'default' errored after 137 ms
@JelteMX
I need help sir.
I just got started with Mendix Studio Pro 8.5 (and Mendix in general). It seems the Test project was generated in a rather ancient version, and cannot be opened with the latest version (8.5). I would've thought that the official generator would keep up with the updates?
<file path="WidgetName/widget/" />
is unnecessary in package.xml for Mendix 6, removing it will solve a couple of problems when zipping the src folder with Windows zip. Unfortunately, this will break backwards compatibility with Mendix 5. So we might ask the user for compatibility (whether or not it needs to work in 5 as well) and based on that edit the package.xml file
When updating a widget using the generator, it will parse the name and version of the widget. In the XML you can use for example version 1.0
, but the generator only accepts a format x.x.x (major.minor.patch)
. So you cannot use the parsed version.
We need to parse the version using semver
and directly set this to a x.x.x
format
Sharing some information:
https://github.com/mendix/generator-mendix/blob/master/generators/app/templates/WidgetBoilerplate/src/WidgetName/widget/WidgetName.js.ejs#L76
Found a limitation on the https://apidocs.mendix.com/6/client/mx.ui.html#.action
Though documentation states that origin: this.mxform
is not needed, it is not completely true. It is not working for full pages but does not work for popups. So this call action will close the page but not a popup. : (
So I think we need to reintroduce the origin again.
Cheers.
Add 'help' which will show the different predefined tasks
Plans to add the SASS support anyday soon? Noticed the item in the "backlog".
The below mentioned gulp task generates the following error.
Code:
gulp.task("default", gulp.series(['build'], function() { gulp.watch("./src/**/*", ["compress"]); gulp.watch("./src/**/*.js", ["copy:js"]); gulp.watch("./src/**/*.html", ["copy:html"]) }));
Error:
Error: watching ./src/**/*: watch task has to be a function (optionally generated by using gulp.parallel or gulp.series) at Gulp.watch (E:\Activities\Mendix\mendix_workspace\GridSelector-master\node_modules\gulp\index.js:31:11) at E:\Activities\Mendix\mendix_workspace\GridSelector-master\gulpfile.js:47:14 at bound (domain.js:395:14) at runBound (domain.js:408:12) at asyncRunner (E:\Activities\Mendix\mendix_workspace\GridSelector-master\node_modules\async-done\index.js:55:18) at process._tickCallback (internal/process/next_tick.js:61:11)
Fix to Overcome the same - Add Gulp.series calls for all the watch functions.
Code:
gulp.task("watch", gulp.series(['build'], function() { gulp.watch("./src/**/*", gulp.series("compress")); gulp.watch("./src/**/*.js", gulp.series("copy:js")); gulp.watch("./src/**/*.html", gulp.series("copy:html")) }));
If the issue is replicable for all the users, it is better we fix the same
When creating a new widget with default parameters using 'yo mendix', the resulting test project contains invalid references to the newly created widget.
Error message in the modeler:
Could not find widget type WidgetName.widget.WidgetName
Just tried to create a new widget in Mx 7.8.0, using the generator and the boilerplate. After having updated the app from 5 to 6 to 7.8, I notice that just running gulp and pressing F5 in the browser is no longer enough. Now you also need to restart the app via the modeler to see any JS changes.
Hi there,
I am taking over a widget development task from a colleague who left our company.
I downloaded the generator (using gulp for tasks) to my machine, copied in the files to the src folder, the mpk file is generated in the dist and the test/widgets folder too and I still get the error... tried to replace the mpk file in the widgets folder as one forum comment suggested but no luck... Can anyone please help out? How should I start modifying an existing widget?
Running the yo mendix reported some deprecated dependencies like graceful and minimatch, these seem not to be compatible with the current version of nodejs.
What should I do?
Some developers prefer Grunt over Gulp. We should give them the choice which one is used.
Excluding the theme leads to funny errors and and empty style when cloning the project from GitHub.
While using yo mendix
on a current widget (updating development files) the repository property is written in a wrong way, resulting in a corrupted package.json. This should be fixed by either duplicating the json file and replacing (dev)dependencies, or removing the (obsolete) repository property
In order to make the Gruntfile.js easy to update, we should move the options (Path to custom test project & path to modeler in case of issues) to package.json. This will make it easier to maintain.
Currently the Boilerplate is an example widget, meaning there are a couple of things included that might not be necessary. We should ask the user a couple of questions:
If not, remove the dependency, do not copy the template folder
If not, remove the dependency, do not copy the jquery included in the lib folder
<file path="WidgetName/widget/" />
We might have to include the widget.js file in the generator itself and use it as a jade template (like we do with _package.json), this makes it easy to omit unnecessary lines in the code
When using the generator, you can update the development files of an existing widget (run yo mendix
in the root of the widget). This uses a template. Unfortunately, it does not ask whether you have a repository defined in the package.json. It the automatically adds this to this files, but Githubuser is undefined. This results in:
"repository": {
"type": "git",
"url": "http://github.com/undefined/<widgetName>"
},
(So widgetName is defined, but the Github user is not)
Hi there
when trying to create a new widget on the step npm run build I get this error
[email protected] build
node ./node_modules/gulp/bin/gulp build
shell.js: internal error
Error: Command failed: "C:\Program Files\nodejs\node.exe" C:\Users\Ryan\AppData\Local\Temp\shelljs_096fc30c0a6ad23cdb1d
at checkExecSyncError (child_process.js:790:11)
at Object.execSync (child_process.js:863:15)
at execSync (C:\Users\Ryan\testWid\node_modules\node-mendix-modeler-path\node_modules\shelljs\src\exec.js:81:11)
at Object._exec (C:\Users\Ryan\testWid\node_modules\node-mendix-modeler-path\node_modules\shelljs\src\exec.js:214:12)
at Object.exec (C:\Users\Ryan\testWid\node_modules\node-mendix-modeler-path\node_modules\shelljs\src\common.js:182:23)
at getShellOutput (C:\Users\Ryan\testWid\node_modules\node-mendix-modeler-path\index.js:10:21)
at findModeler (C:\Users\Ryan\testWid\node_modules\node-mendix-modeler-path\index.js:30:11)
at Object. (C:\Users\Ryan\testWid\node_modules\node-mendix-modeler-path\index.js:74:2)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
I have tried updating my Gruntfile.js to point to the mendix version selector but still get the same error
When you make a mistake and use the backspace, the backspace isn't taken into account which results in very strange initial input.
Example: typing in a package name, press backspace a few times and enter some new text.
Hi Jelte,
I'm learning Mendix and I'm following the Mendix learning path 'Build a Pluggable Widget'. For some reason the widget is not getting built correctly by MX Generator. I tried reinstalling Node.js, Yeoman and the MX Generator, closed my Studio Pro to see whether that was it, looked for the error on Google but couldn't find it.
Do you know what might be the problem here?
Stack trace:
Running MX Widgets Tools script lint:fix...
src\components\HelloWorldSample.tsx 276ms
src\TestWidget.editorPreview.tsx 18ms
src\TestWidget.tsx 14ms
[email protected] build C:\Users\Gebruiker\documents\mendix\Build_a_pluggable_widget-main\CustomWidgets\testWidget
pluggable-widgets-tools build:web
Running MX Widgets Tools script build:web...
Project Path: C:\Users\Gebruiker\Documents\Mendix\Build_a_pluggable_widget-main/
[!] TypeError: The "path" argument must be of type string. Received an instance of RegExp
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of RegExp
at validateString (internal/validators.js:124:11)
at Object.resolve (path.js:162:9)
at C:\Users\Gebruiker\Documents\Mendix\Build_a_pluggable_widget-main\CustomWidgets\testWidget\node_modules\rollup-plugin-sass\node_modules\rollup-pluginutils\dist\pluginutils.cjs.js:183:68
at Array.map ()
at Object.createFilter (C:\Users\Gebruiker\Documents\Mendix\Build_a_pluggable_widget-main\CustomWidgets\testWidget\node_modules\rollup-plugin-sass\node_modules\rollup-pluginutils\dist\pluginutils.cjs.js:183:35)
at Object.plugin [as default] (C:\Users\Gebruiker\Documents\Mendix\Build_a_pluggable_widget-main\CustomWidgets\testWidget\node_modules\rollup-plugin-sass\src\index.ts:134:14)
at C:\Users\Gebruiker\Documents\Mendix\Build_a_pluggable_widget-main\CustomWidgets\testWidget\node_modules@mendix\pluggable-widgets-tools\configs\rollup.config.js:298:45
at Array.forEach ()
at rollup_config (C:\Users\Gebruiker\Documents\Mendix\Build_a_pluggable_widget-main\CustomWidgets\testWidget\node_modules@mendix\pluggable-widgets-tools\configs\rollup.config.js:286:23)
at getConfigList (C:\Users\Gebruiker\Documents\Mendix\Build_a_pluggable_widget-main\CustomWidgets\testWidget\node_modules\rollup\dist\shared\loadConfigFile.js:565:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: pluggable-widgets-tools build:web
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Gebruiker\AppData\Roaming\npm-cache_logs\2021-08-24T10_15_58_070Z-debug.log
Widget successfully built!! Please open Mendix Studio Pro and start playing with your new widget.
I would like to get the option to start in a folder that is NOT empty, instead of a complete block.
For instance, when I create a Github project and load that folder locally I would like to be able to use that folder with the generator. Now, this is not possible due to the fact that Github already adds some required files making the folder filled with something.
People might forget to install Grunt. Either add this in the README as a requirement, or do a check in the generator whether or not Grunt is installed. If not, execute npm install grunt-cli -g
When updating the HTML Template or CSS sheets of a widget, I have to restart the application to see the effects. Would be really nice if it would directly copy the changes to the deployment directory.
I'm using the Webstorm Javascript development environment, with my node / yeoman setup I get the following error when generating the widget, does anyone have an idea how to fix this?
__ ____ __ _ _ _
| \/ \ \ / / (_) | | | |
| \ / |\ V / __ ___ __| | __ _ ___| |_
| |\/| | > < \ \ /\ / / |/ _` |/ _` |/ _ \ __|
| | | |/ . \ \ V V /| | (_| | (_| | __/ |_
|_| |_/_/ \_\ \_/\_/ |_|\__,_|\__, |\___|\__|
__/ |
|___/
Generator, version: 2.0.1
Issues? Please report them at : https://github.com/mendix/generator-mendix/issues
events.js:160
throw er; // Unhandled 'error' event
^
TypeError: this.env.adapter.prompt(...).then is not a function
at constructor.Base.prompt (C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\yeoman-generator\lib\base.js:240:45)
at constructor.prompting (C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\generators\app\index.js:93:10)
at Object.<anonymous> (C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\yeoman-generator\lib\base.js:439:23)
at C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\run-async\index.js:26:25
at C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\run-async\index.js:25:19
at C:\Users\username\AppData\Roaming\npm\node_modules\generator-mendix\node_modules\yeoman-generator\lib\base.js:440:9
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5)
Yesterday grunt would work just fine. Today I wanted to start working on a new widget, but when I run yo mendix I receive the following error:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'update' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: Failed to parse json
4 verbose stack No value found for key url at 26:12
4 verbose stack "url": "http://github.com/Criccle/MyWidget"
4 verbose stack ^
4 verbose stack at parseError (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:379:11)
4 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:68:23)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:48:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:76:16
4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3)
5 verbose cwd D:\Mendix Widgets\GoogleCombo2
6 error Windows_NT 10.0.10586
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "update"
8 error node v4.2.6
9 error npm v2.14.12
10 error file D:\Mendix Widgets\GoogleCombo2\package.json
11 error code EJSONPARSE
12 error Failed to parse json
12 error No value found for key url at 26:12
12 error "url": "http://github.com/Criccle/MyWidget"
12 error ^
13 error File: D:\Mendix Widgets\GoogleCombo2\package.json
14 error Failed to parse package.json data.
14 error package.json must be actual JSON, not just JavaScript.
14 error
14 error This is not a bug in npm.
14 error Tell the package author to fix their package.json file. JSON.parse
15 verbose exit [ 1, true ]
Any idea what I might be doing wrong or what I should do differently?
You cannot set version 2.0.0. This needs to be fixed (when you are rebuilding the widget for example). Minimum is 1.0.0. (Use semver to check the version number)
When questioning "Add a license"; what ever the licence chosen it always add the Apache 2 licence file in you project.
https://github.com/mendix/generator-mendix/blob/master/generators/app/index.js#L220
Would be nice if there are multiple way of adding the licence headers / disclaimers.
https://www.smashingmagazine.com/2010/03/a-short-guide-to-open-source-and-similar-licenses/
This issue got me into trouble before.... difficult client... however he was right.
An interesting question to ask the Mendix legal guys; What is the right licencing structure for a widgets. Specially when it uses other libraries are (Mendix API, dojo, Jquery, and others).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.