🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@thinknimble/tnm-cli

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thinknimble/tnm-cli

`tnm-cli` is a command line interface for auto-generating [tn-models](https://github.com/thinknimble/tn-models-fp) model definitions for your app's frontend from OpenAPI schema files provided by your app's backend. This is the standard pattern we use in a

latest
npmnpm
Version
0.0.3-c
Version published
Weekly downloads
61
Maintainers
0
Weekly downloads
 
Created
Source

TN Models CLI

tnm-cli is a command line interface for auto-generating tn-models model definitions for your app's frontend from OpenAPI schema files provided by your app's backend. This is the standard pattern we use in all apps at ThinkNimble.

Installation

First, install bun (required):

curl -fsSL https://bun.sh/install | bash

Then use the CLI by installing it from NPM or BUN

npm install -g tnm-cli
bun install -g tnm-cli

OR use npx/bunx

npx/bunx @thinknimble/tnm-cli read <source>

Usage

Generate Models from a ThinkNimble App Schema

assuming you are retrieving the yaml file from swagger on a TN App you may also need to pass a token

bunx @thinknimble/tnm-cli read 'https://YOUR_PROJECT.com/api/schema?format=yaml' -t YOUR_API_KEY -u '/api/users/' -o somepath.ts

Options:

  • -u, --uri - the uri to the resource you want models of, this must be an exact match with the opening and trailing slash
  • -t, --auth - auth token to the url if it is behind authentication
  • -o, --output - output file otherwise the output is logged

Make Models from a Local Schema

You can also generate models using a local yaml file

bunx @thinknimble/tnm-cli read 'some-yaml-path.yaml' -u '/api/users/ -o somepath.ts'
bunx @thinknimble/tnm-cli read 'some-yaml-url.com/sample.yaml' -u'/api/users/ -o somepath.ts'

with output

bunx @thinknimble/tnm-cli read 'your-local-file.yaml' -u '/api/users/' -o somepath.ts

tnm-cli Development

To install dependencies:

bun install

To run:

bun run index.ts

This project was created using bun init in bun v1.1.22. Bun is a fast all-in-one JavaScript runtime.

FAQs

Package last updated on 01 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts