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

sn-typescript-util

v1.4.2

Published

A TypeScript utility for ServiceNow developers using VS Code

Downloads

181

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. Project Structure
  7. 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 TypeScript compiler --watch command to start looking for TypeScript code changes in the ts directory.

tsc --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

Remove

Remove & clean the ts build directory.

snts --remove

# or

snts -r

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

Project Structure

Inside of the application directory (after the build), the project structure will look something like this.

/
├── background scripts/
├── scratch/
├── src/
│   ├── Server Development/
│   │   └── Script Includes/
│   │       └── DataService.script.js
│   │       └── Utils.script.js
│   └── Service Portal/
│       └── Widgets/
│           └── Dashboard/
│               └── Dashboard.client_script.js
│               └── Dashboard.css.scss
│               └── Dashboard.demo_data.json
│               └── Dashboard.link.js
│               └── Dashboard.option_schema.json
│               └── Dashboard.script.js
│               └── Dashboard.template.html
├── system/
├── ts/
│   ├── Server Development/
│   │   └── Script Includes/
│   │       └── DataService.script.ts
│   │       └── Utils.script.ts
│   ├── Service Portal/
│   │   └── Widgets/
│   │       └── Dashboard/
│   │           └── Dashboard.client_script.ts
│   │           └── Dashboard.link.ts
│   │           └── Dashboard.script.ts
│   └── Types/
│       └── BaseTable.ts
│       └── User.ts
├── .eslintrc
└── app.config.json

This example project has two script includes, a widget, and a Types directory for interfaces & types.

Back to top

License

MIT License

Back to top