Pluggable Widgets Tools
Library to build, test, format, run, release and lint your Pluggable Widget
How to install
Install from npm using npm install @mendix/pluggable-widgets-tools
How to use
In your package.json
include the task:
"mx-script": "cd ./node_modules/@mendix/pluggable-widgets-tools && node bin/mx-scripts.js",
In your tasks, use the following replacing task with the desired task:
npm run mx-script task
Available tasks
start:server
Used to start webpack-dev-server and run your WEB project. Accepts --open
option to auto open your browserstart:js
Used to build and watch the changes of your JavaScript ES6 Web projectstart:ts
Used to build and watch the changes of your TypeScript Web projectstart:js:native
Used to build and watch the changes of your JavaScript ES6 Native projectstart:ts:native
Used to build and watch the changes of your Typescript Native projectbuild:js
Used to build your JavaScript ES6 Web projectbuild:ts
Used to build your TypeScript Web projectbuild:js:native
Used to build your JavaScript ES6 Native projectbuild:ts:native
Used to build your TypeScript Web projectrelease:js
Used to build your JavaScript ES6 Web project for productionrelease:ts
Used to build your TypeScript Web project for productionrelease:js:native
Used to build your JavaScript ES6 Native project for productionrelease:ts:native
Used to build your TypeScript Web project for productionlint
Used to lint your project using ESLintlint:fix
Used to fix lint problems/warning using ESLintformat
Used to format your code using Prettiertest:unit
Used to execute unit tests using Jest for your Web Project. Accepts option --u
to update, --no-cache
ro remove previous snapshots, --ci
assumes use of a CI environment, --coverage
to support coverage test. the snapshots. Files should be inside src/components/__tests__
test:unit:native
Used to execute unit tests using Jest for your Native Project. Accepts option --u
to update, --no-cache
ro remove previous snapshots, --ci
assumes use of a CI environment, --coverage
to support coverage test.. Files should be inside src/components/__tests__
test:e2e:js
Used to execute End-to-end tests using Wdio in your JavaScript Web Projecttest:e2e:ts
Used to execute End-to-end tests using Wdio in your TypeScript Web Project
Examples
"start": "npm run mx-script start:server -- --open"
"build": "npm run mx-script build:js"
"lint": "npm run mx-script lint"
"lint:fix": "npm run mx-script lint:fix"
"test:unit": "npm run mx-script test:unit -- --coverage"
##Notes
If you are using mono repositories and need to build multiples widgets using Lerna or some other tool, you can provide the option --subprojectPath
for the tasks build
, start
and release
.
- Example
"buildSubProject": "npm run mx-script build:ts -- --subProjectPath \"/packages/mysubproject\"