A faster, more modern, superior alternative for Mendix PWT.
Bascially, hyper-pwt is a drop-in replacement for Mendix PWT.
First, install hyper-pwt from npm.
npm install --dev hyper-pwtSecond, replace pluggable-widgets-tools to hyper-pwt in widget's package.json.
{
"scripts": {
"dev": "hyper-pwt start:web",
"build": "hyper-pwt build:web",
"lint": "hyper-pwt lint",
"lint:fix": "hyper-pwt lint:fix",
"format": "hyper-pwt format",
"test:unit": "hyper-pwt test:unit:web",
"prerelease": "npm run lint",
"release": "hyper-pwt release:web"
}
}Use hyper-pwt build:web --production when you want the production build
path without switching your script to release:web.
Third, open tsconfig.json and change extends to hyper-pwt like below.
{
"extends": "hyper-pwt/src/configurations/typescript/tsconfig.base",
"include": ["./src", "./typings"]
}First, proceed with the basic replacement process.
If the widget does not function properly after installing hyper-pwt, you can customize your Vite configuration by referring to the “Custom build configurations” section.
Create vite.config.mjs on your pwt root directory.
import { definePWTConfig } from "hyper-pwt";
export default definePWTConfig(() => {
return {
// Your custom configuration in here.
};
});hyper-pwt uses the @vitejs/plugin-react plugin. The settings for this plugin can be changed as follows.
import { definePWTConfig } from "hyper-pwt";
export default definePWTConfig(() => {
return {
reactPluginOptions: {
jsxRuntime: "classic",
},
};
});definePWTConfig also supports asynchronous mode. It can be used as follows.
import { definePWTConfig } from "hyper-pwt";
export default definePWTConfig(async () => {
const promise = await somethingPromise();
return {};
});TODO
hyper-pwt runs lint, lint:fix, and format with oxlint and oxfmt.
For drop-in migration, existing Mendix PWT .eslintrc.js and
prettier.config.js files can remain in the widget project. When no
.oxlintrc or .oxfmtrc config exists, hyper-pwt applies generated
oxlint/oxfmt compatibility settings that mirror the Mendix PWT Prettier
defaults.
The command targets follow Mendix PWT:
lint: format check forsrc,typings, andtests, then lintsrc.lint:fix: format write forsrc,typings, andtests, then fixsrc.format: format write forsrc,typings, andtests.
hyper-pwt runs test:unit and test:unit:web with the web Jest
configuration used by Mendix PWT. Jest arguments are passed through, so common
flags such as --runInBand, --coverage, --coverage=false, --ci,
--no-cache, and --u work as they do with PWT. The Mendix
--subprojectPath <value> wrapper argument is stripped before Jest is invoked.
The default web unit-test configuration discovers
src/**/*.spec.{js,jsx,ts,tsx}, runs in jsdom, loads
@testing-library/jest-dom, provides TextEncoder and TextDecoder, and
writes coverage to dist/coverage when coverage is enabled.
The results below were obtained using our own tools within the benchmark directory, and the code for the benchmarked widgets is also available for review.
If you wish to reproduce the benchmark results, you can do so using the tools and widgets within the benchmark directory.
| Category | @mendix/pluggable-widgets-tools | hyper-pwt | Result |
|---|---|---|---|
| Build time | 27475ms | 4135ms | -23340.00ms (84.95% faster) |
| Memory Usage | 0.11MB | 0.08MB | -0.03MB (26.93% less) |
| MPK File Size | 1.26MB | 557.08KB | -731.37KB (56.76% less) |
TODO
- start:web
- start:native
- build:web
- build:native
- release:web
- release:native
- lint
- lint:fix
- format
- test:unit:web
- test:unit:native
- Widget Generator
- Web
- Basic Functions
- Linter and Formatting
- TDD Functions
- Native
- Basic Functions
- Linter and Formatting
- TDD Functions
hyper-pwt is distributed under the MIT License.
Please refer to the LICENSE.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. THE DEVELOPERS AND shiinamachi DO NOT GUARANTEE THAT THE SOFTWARE IS FREE OF BUGS, ERRORS, OR OTHER DEFECTS.
IN NO EVENT SHALL THE DEVELOPERS OR shiinamachi BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THIS INCLUDES, BUT IS NOT LIMITED TO, LOSS OF DATA, DAMAGE TO MENDIX PROJECTS, BUSINESS INTERRUPTION, OR LOST PROFITS. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU.
IT IS THE USER'S SOLE RESPONSIBILITY TO ENSURE THE ADEQUATE BACKUP OF ANY AND ALL DATA, INCLUDING MENDIX PROJECTS, BEFORE USING THIS TOOL. WE STRONGLY RECOMMEND PERFORMING A FULL BACKUP BEFORE RUNNING ANY BUILD PROCESS WITH THIS SOFTWARE.
This is an unofficial tool developed independently by shiinamachi and is not affiliated with, endorsed, sponsored, or supported by Mendix Technology BV or its parent company Siemens AG.
Mendix® is a registered trademark of Mendix Technology BV. Any use of the Mendix trademark is for nominative purposes only, to identify that this tool is designed to work with the Mendix platform, and does not imply any official association.
This tool was developed for a specific version of the Mendix platform and its Pluggable Widget Tools (PWT). Future updates to the Mendix platform may break the functionality of this tool without notice. We do not guarantee ongoing compatibility or provide any obligation to maintain, support, update, or otherwise service this software.
