sn-typescript-util

A TypeScript utility for ServiceNow developers using VS Code

Usage no npm install needed!

<script type="module">
  import snTypescriptUtil from 'https://cdn.skypack.dev/sn-typescript-util';
</script>

README

SN TypeScript Util

npm version

A TypeScript CLI utility that works on-top of the ServiceNow Extension for VS Code. This tool activates a TypeScript-based workflow for ServiceNow developers using VS Code.

Table of Contents

  1. Benefits
  2. Prerequisites
  3. Installation and Setup
  4. Basic Workflow
  5. Commands
  6. License

Benefits

Using TypeScript, the CLI provides an enhanced developer workflow.

  • Work in modern JavaScript ES2015 (ES6) and beyond
  • Extend JavaScript by using types
  • Unlock code navigation and intelligent code completion
  • Catch bugs before syncing to the instance

Back to top

Prerequisites

Back to top

Installation and Setup

Install the npm package.

npm install -g sn-typescript-util

Build the TypeScript and configuration files. This only needs to be done once for an application.

snts --build

In the application directory created by the ServiceNow Extension for VS Code, the build creates a ts directory from the JavaScript files in the src directory. This is where all the TypeScript code resides and where the workflow begins.

Back to top

Basic Workflow

After installation & setup, simply run the watch script to start looking for TypeScript code changes in the ts directory.

npm run watch

Any JavaScript ES2015 (ES6) code added will get converted down to ES5 and moved to the src directory. Then changes are ready to sync with the target instance using the ServiceNow Extension for VS Code.

Back to top

Commands

Installing the CLI globally provides access to the snts command.

snts [command]

Build

Build project utility files and package dependencies. Creates a ts directory from the JavaScript files in the src directory.

snts --build

# or

snts -b

Compile

Compile TypeScript files in the ts directory to JavaScript ES5 and moves them to the src directory.

snts --compile

# or

snts -c

Help

Display help for the command.

snts --help

# or

snts -h

Sync

Sync new instance-based src files to the ts directory.

snts --sync

# or

snts -s

Version

Output the version number.

snts --version

# or

snts -V

Back to top

License

MIT License

Back to top