paritytech / opstooling-js

Shared functionality for OpsTooling projects
https://www.npmjs.com/package/@eng-automation/js
Apache License 2.0
0 stars 1 forks source link

Introduction

This repository hosts shared functionality for OpsTooling projects.

GitHub Issue Sync

Docs

Docs deployed

Find the docs in paritytech.github.io/opstooling-js. They are deployed automatically.

Installation

Yarn: yarn add @eng-automation/js

NPM: npm install --save @eng-automation/js

Release

Trigger the Release workflow which will create a tag with the version passed as input.

CLI

This package adds opstooling-scripts executable, which is "umbrella" for arbitrary subcommands that we might want to share across projects.

See opstooling-scripts -h to get a list of available commands, also check out src/cli directory for sources

Adding new CLI command

opstooling-scripts generate-types

We utilize joi-to-typescript to define types together with validation schemas.

To add this functionality to a project:

How to use generated types with validation

import { validate } from "opstooling-js"

import { YourType } from "#src/types"
import { YourTypeSchema } from "#src/schemas/YourTypeSchema"

const input: unknown = getSomeData()

const item = validate<YourType>(input, YourTypeSchema)