npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

create-mendix-widget

v1.1.0

Published

Create a working Mendix widget with one command.

Downloads

49

Readme

Create Mendix Widget

Create Mendix Widget with one command.

Create Mendix Widget works on macOS, Windows, and Linux. If something doesn’t work, please [file an issue](https://github.com/hm-mx/create-mendix-widget/issues/new . Please DONOT file issues regarding this tool to Mendix support, or asking questions in Mendix Forum.

Why

This project is not affiliated with Mendix. It is a personal project developed for research purposes. Use this widget creator at your own risk.

Mendix is moving from Dojo to React very soon. From version 7.13.1 and above, you can already build widgets in React without Dojo. Pluggable widget is awesome, but it is only available on Mendix 8. From version 7.13.1 or higher, Mendix has an experimental API that allows you to use widgets in React without Dojo. Before you upgrade to Mendix 8, you might already want to rebuild your Dojo widgets in React. Later you can easily copy the React code and paste it into Pluggable Widget template.

If you want to use hooks, you can choose DOJO wrapper with Preact, which bundles Preact in a DOJO widgert, so that you can freely use the latest syntax. I have tried this approach on Production, and it works pretty well. However, the size of Preact is ~3k. Donot use this approach is you cannot tolerate 3k more bundle size.

Requirements

  • NodeJS
  • Mendix version 7.13.1 or above (also works on Mendix 8)
  • Git

NOTE: the current version of React in Mendix is 16.6.3, meaning that you cannot use React hooks in your Mendix widgets just yet. If you choose DOJO wrapper with Preact, then you don't have this limitation (but you will have ~3k more bundle size).

Installation

First, Install create-mendix-widget globally.

npm i -g create-mendix-widget

Usage

Run the following command followed by the name of your new widget.

create-mendix-widget awesome-widget

If you have an existing folder

cd awesome-widget
create-mendix-widget .

You will be prompted with several questions to initialize your new widget. It will generate the boilerplate and install dependencies.

Next, follow the instruction to navigate to the folder of your newly-created widget and you are ready to build your new widget!

Development

In the root folder of your widget, you can find dev.config.js. DO NOT change the content of this file. This file serves as a fallback, and it should be part of the code base.

To allow local development, create dev.config.local.js next to dev.config.js and change the content according to your local settings.

// dev.config.local.js
// normally you only need to overwrite the path
module.exports = {
  mxProjectRootDir: '/Users/johndoe/Documents/Mendix/MyAwesomeMendixApp',
};

You don't need to commit dev.config.local.js (it is git-ignored by default). This setup is to prevent exposing personal local configurations to the code base.

After creating dev.config.local.js, you need to build your widget as follows:

npm run build

It will generate the mpk file and put it into your Mendix app. If it builds successfully, you should be able to find your new widget in your Mendix Studio Pro. Drag it into your app as you normally do. Then run your Mendix app locally.

Finally, run the following command to spin up the dev server. It will automatically open your browser and go to http://localhost:3000 (or if you configure it differently in your dev.config.local.js).


npm run start

This command will watch any changes you make, and trigger an unoptimized build with source maps. Your browser will automatically reload your app (However, HMR is not yet supported). Then you can see your widget in action.

Build

Once you finished development, remember to run build script again.

npm run build

It will build an optimized (minified & uglified) version of your widget without source maps, and directly put it into your Mendix app.

Writing Your React Widget

We try to align the environment settings of the widget as close as possible with the industry standard. You can develop the widget just like a normal React component. However, the current version of React in Mendix is 16.6.3, meaning that you cannot use React hooks just yet.

For testing, we use jest and react-testing-library by default. You need to configure it yourself if you want to use other testing libraries.

Issues

If something doesn’t work, please file an issue.

Acknowledgements

This project is forked from Osama Najjar's create-hyper-mendix-widget

License

create-mendix-widget is licensed as MIT.