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

mendix-widget-build-script

v1.0.3

Published

Build script for checkout, build, upload and start a Mendix project in a cloud node

Downloads

35

Readme

Mendix widget build script

For the purpose of continuous integration and testing. These script can checkout a Mendix project, update the latest widget, build, upload and start the project on a cloud node. After these scripts, integration tests could be run on the node.

Usage

  1. install this module

npm install --save mendix-widget-build-script

  1. Copy the sample.travis.yml to your project root .travis.yml Note that your-app-name is the part in the sandbox URL: https://your-app-name.mxapps.io/ that might differ from the name of the project. Update the env: global variable:
  - MX_APP_NAME=your-app-name
  - MX_PROJECT_ID=your-project-id
  - [email protected]

When needed, it is possible to overwrite the default values by adding the variable in the section env: global:

  - MX_TEAM_SERVER_URL=https://teamserver.sprintr.com
  - MX_BRANCH_NAME=trunk
  - MX_API_URL=https://deploy.mendix.com/api/1
  - MX_ENVIRONMENT=Sandbox
  1. To run your build script locally, copy the dist/localSettings.js to the project root.
exports.settings = {
    appName: "your-app-name",
    key: "your-mendix-account-api-key",
    password: "your-mendix-password",
    projectId: "your-project-id",
    user: "[email protected]"
};

!! Important !! Add this file to your git ignore, as the password and key are not encrypted they should never be committed into a public repository

.gitignore

localSettings.js

When needed, you can overwrite the default values by adding them in the exports.setting object:

   branchName: "trunk",
   environment: "Sandbox",
   testProjectName: "TestProject.mpk",
   apiUrl: "https://deploy.mendix.com/api/1",
   teamServerUrl: "https://teamserver.sprintr.com"
  1. Add to the npm package.json the "widgetName" (string | string[]) and the required scripts for deployment.
"widgetName": "MyAwesomeWidget",
"scripts": {
    "pretest": "<build script, output the widget into 'dist/<version>'>",
    "test": "npm run <some other tests> && npm run test:conditional",
    "test:conditional": "node ./node_modules/mendix-widget-build-script/dist/CheckPullRequestFromFork.js && echo 'Skip tests on forked pull request' || npm run deployAndTest",
    "deployAndTest": "npm run deploy && npm run <your integration test>",
    "deploy": " npm run updateProject && npm run deployApp",
    "updateProject": "node ./node_modules/mendix-widget-build-script/dist/UpdateMxProject.js",
    "deployApp": "node ./node_modules/mendix-widget-build-script/dist/DeployMxApp.js"
  },
  1. Enable your repository at https://travis-ci.org

Set your secret environment variables https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings

MX_PASSWORD
MX_API_KEY
GITHUB_KEY

Note: for security reasons, it is advisable to create a CI user that can only access the testing repositories.

  • The Mendix API key could be generated in your Mendix account, using the following instructions https://docs.mendix.com/apidocs-mxsdk/apidocs/authentication
  • The GitHub API key could be generated for your GitHub account from https://github.com/settings/tokens
    • Click "Generate new token"
    • Set a "Token description" like "Automatic releases via Travis CI"
    • Set scope public_repo
    • Click "Generate token"

Make sure you keep the 'Display value in build log' stays 'off' else your passwords will be in the build log for everybody to read.

Note: that the environment variables in the travis-ci.org can be used to overwrite other settings from .travis.xml when need be.

  1. Add the awesome badges to the README.md to show build status.
[![Build Status](https://travis-ci.org/<user/org>/<repo>.svg?branch=master)](https://travis-ci.org/<user/org>/<repo>)
  1. Commit the changes into your repository (Except the local config)

  2. Checkout how your build is doing https://travis-ci.org/<user/org>/<repo>/

  3. When a tag is create in the git repository, the Travis CI script will start build, test and automatically add the .mpk to the GitHub release on success.

Development

For further development of the widget build scripts:

  1. Fork the code or checkout the code:

git clone https://github.com/FlockOfBirds/mendix-widget-build-script.git

  1. Create a copy of ./dist/localSettings.js into the project root and configure like step 3 of the usage instructions. To run a local test:

npm test

  1. To create a release build:

npm run build