Create and run scripts from the package

Have a look to the scripts entry (line 6 and 7 of the above screen shot). This entry represents a JavaScript literal object with one default property called test. This object is a way to extend the commands set of npm.

Go back to the opened Command Prompt and type the following command:

> npm test

You can use the scripts object to start any executable. To do this add the following property to the scripts object:

"myCommand" : "notepad"

The package.json file should look like :

To run your custom command type the following command in the Command Prompt window:

> npm run myCommand

You can even use npm to start the Android Device Emulator you have created in the section Android Emulator setup.

To do this add the following property to the scripts object:

"myEmulator" : "emulator -avd NativeScript_Android_Emulator"

The package.json file should look like :

To run your custom android emulator type the following command in the Command Prompt window:

> npm run myEmulator

The scripts content is fully described at https://docs.npmjs.com/misc/scripts

results matching ""

    No results matching ""