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

@antsa/cli

v1.0.0

Published

Antsa Command Line Interface

Downloads

41

Readme

Antsa Command Line Interface

The Antsa CLI (Command Line Interface) is a set of command line tools to quickly deploy Antsa web applications and Antsa bots.

Installation

Add as a dependency:

npm install @antsa/cli

Config file

Create a Antsa config file called antsa.config.json:

{
  "bots": [
    {
      "name": "hello-world",
      "id": "f0465c2e-11d4-4c36-b834-8e86f7472b4b",
      "source": "src/index.ts",
      "dist": "dist/index.js"
    }
  ]
}

The name property is a friendly name you can use to reference the Bot in commands.

The id property refers to the Bot ID in your Antsa project.

The source property is the file path to the original source. When you "save" the Bot, the contents of this file will be saved to the Bot code property. This file can be JavaScript or TypeScript.

The dist property is the optional file path to the compiled source. If omitted, the command falls back to using the source property. When you "deploy" the Bot, the contents of this file will be deployed to the Bot runtime. This file must be JavaScript.

Usage

Syntax:

npx antsa <command> <args>

save-bot

Updates the code value on a Bot resource

Syntax:

npx antsa save-bot <bot name>

Example:

npx antsa save-bot hello-world

deploy-bot

Deploys the Bot code

Syntax:

npx antsa deploy-bot <bot name>

Example:

npx antsa-deploy-bot <bot name>

Authentication

Authentication requires client credentials in environment variables ANTSA_CLIENT_ID and ANTSA_CLIENT_SECRET. This supports most use cases, including secrets from CI/CD. dotenv is enabled, so you can store them in a .env file.

Example

Create a Antsa config file antsa.config.json:

{
  "bots": [
    {
      "name": "hello-world",
      "id": "f0465c2e-11d4-4c36-b834-8e86f7472b4b",
      "source": "src/hello-world.ts",
      "dist": "dist/hello-world.js"
    }
  ]
}

Replace the sample id with your Bot's ID.

Write your bot in src/hello-world.ts. This can be TypeScript. It can reference @antsa/core and node-fetch:

import { AntsaClient } from '@antsa/core';
import { Resource } from '@antsa/fhirtypes';

export async function handler(antsa: AntsaClient, event: BotEvent): Promise<any> {
  console.log('Hello world');
}

You can use the Antsa CLI to save it:

npx antsa save-bot hello-world

Compile with vanilla tsc (no bundler required)

npx tsc

The result will be JavaScript output in dist/hello-world.js:

export async function handler(antsa, input) {
  console.log('Hello world');
}

You can then use the Antsa CLI to deploy it.

npx antsa deploy-bot hello-world

About Antsa

Antsa is a healthcare platform that helps you quickly develop high-quality compliant applications. Antsa includes a FHIR server, React component library, and developer app.

License

Apache 2.0. Copyright © Antsa 2023