Links

NPM Scripts

Overview

Dynamics Mobile apps come with predefined NPM scripts - they are defined in package.json. The scripts allow the developer to use simple command to perform frequent tasks during the development process.

Standard Scripts Cheat Sheet

Script
Command line
Description
build
npm run build
Runs the build process of the app. Used to build/debug the app. Hitting F5/Ctr+Shift+F5 in Visual Studio Code executes the same script.
genbo
npm run genbo
Generates Typescript definitions from the business object json definition files. Do not use it directly.
genmap
npm run genmap
Generates and opens html document with human readable description of the business objects in the current app
start
npm run start
Starts local development web server on accessible via http://localhost:3001. Must be executed once, before starting the development process.
release
npm run release
Builds the application in release mode, which compresses the outputted code as well as runs a deep code check to catch any issues. Might capture more errors than the npm run build command. Can be used to check your code before publishing.
directpublish
npm run directpublish pushtoall
Compiles the code in release mode and deploys the app in the current application area, making it available to everyone. Use it to publish the app to production.
test
npm run test
Runs unit tests by utilizing jest. NOTE: You need to manually setup jest for your project, before using this command.
i18n
npm run i18n
Exports or imports translation resources to/from CSV files

Adding new scripts

The developer can add more scripts in package.json to use during his daily routines.